libpgm-5.1.118-1~dfsg/0000755000175000017500000000000011640407424013311 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/0000755000175000017500000000000011640407424014756 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/0000755000175000017500000000000011644640134015542 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/socket_unittest.c0000644000175000017500000011067611640407354021151 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM socket. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #ifndef _WIN32 # include # include # include # include #else # include # include #endif #include #include /* mock state */ #define TEST_NETWORK "" #define TEST_PORT 7500 #define TEST_MAX_TPDU 1500 #define TEST_TXW_SQNS 32 #define TEST_RXW_SQNS 32 #define TEST_HOPS 16 #define TEST_SPM_AMBIENT ( pgm_secs(30) ) #define TEST_SPM_HEARTBEAT_INIT { pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(1300), pgm_secs(7), pgm_secs(16), pgm_secs(25), pgm_secs(30) } #define TEST_PEER_EXPIRY ( pgm_secs(300) ) #define TEST_SPMR_EXPIRY ( pgm_msecs(250) ) #define TEST_NAK_BO_IVL ( pgm_msecs(50) ) #define TEST_NAK_RPT_IVL ( pgm_secs(2) ) #define TEST_NAK_RDATA_IVL ( pgm_secs(2) ) #define TEST_NAK_DATA_RETRIES 5 #define TEST_NAK_NCF_RETRIES 2 #define pgm_ipproto_pgm mock_pgm_ipproto_pgm #define pgm_peer_unref mock_pgm_peer_unref #define pgm_on_nak_notify mock_pgm_on_nak_notify #define pgm_send_spm mock_pgm_send_spm #define pgm_timer_prepare mock_pgm_timer_prepare #define pgm_timer_check mock_pgm_timer_check #define pgm_timer_expiration mock_pgm_timer_expiration #define pgm_timer_dispatch mock_pgm_timer_dispatch #define pgm_txw_create mock_pgm_txw_create #define pgm_txw_shutdown mock_pgm_txw_shutdown #define pgm_rate_create mock_pgm_rate_create #define pgm_rate_destroy mock_pgm_rate_destroy #define pgm_rate_remaining mock_pgm_rate_remaining #define pgm_rs_create mock_pgm_rs_create #define pgm_rs_destroy mock_pgm_rs_destroy #define pgm_time_update_now mock_pgm_time_update_now #define SOCK_DEBUG #include "socket.c" int mock_pgm_ipproto_pgm = IPPROTO_PGM; static void mock_setup (void) { if (!g_thread_supported ()) g_thread_init (NULL); } static void mock_teardown (void) { } /* stock create pgm sockaddr structure for calls to pgm_bind() */ static struct pgm_sockaddr_t* generate_asm_sockaddr (void) { const pgm_gsi_t gsi = { 200, 202, 203, 204, 205, 206 }; struct pgm_sockaddr_t* pgmsa = g_new0 (struct pgm_sockaddr_t, 1); pgmsa->sa_port = TEST_PORT; memcpy (&pgmsa->sa_addr.gsi, &gsi, sizeof(gsi)); return pgmsa; } /* apply minimum socket options to new socket to pass bind() */ static void prebind_socket ( struct pgm_sock_t* sock ) { sock->max_tpdu = TEST_MAX_TPDU; sock->max_tsdu = TEST_MAX_TPDU - sizeof(struct pgm_ip) - pgm_pkt_offset (FALSE, FALSE); sock->max_tsdu_fragment = TEST_MAX_TPDU - sizeof(struct pgm_ip) - pgm_pkt_offset (TRUE, FALSE); sock->max_apdu = MIN(TEST_TXW_SQNS, PGM_MAX_FRAGMENTS) * sock->max_tsdu_fragment; /* tx */ sock->can_send_data = TRUE; sock->spm_ambient_interval = TEST_SPM_AMBIENT; const guint interval_init[] = TEST_SPM_HEARTBEAT_INIT; sock->spm_heartbeat_len = sizeof(interval_init) / sizeof(interval_init[0]); sock->spm_heartbeat_interval = g_new0 (guint, sock->spm_heartbeat_len + 1); for (guint i = 1; i < sock->spm_heartbeat_len; i++) sock->spm_heartbeat_interval[i] = interval_init[i]; sock->txw_sqns = TEST_TXW_SQNS; /* rx */ sock->can_recv_data = TRUE; sock->rxw_sqns = TEST_RXW_SQNS; sock->peer_expiry = TEST_PEER_EXPIRY; sock->spmr_expiry = TEST_SPMR_EXPIRY; sock->nak_bo_ivl = TEST_NAK_BO_IVL; sock->nak_rpt_ivl = TEST_NAK_RPT_IVL; sock->nak_rdata_ivl = TEST_NAK_RDATA_IVL; sock->nak_data_retries = TEST_NAK_DATA_RETRIES; sock->nak_ncf_retries = TEST_NAK_NCF_RETRIES; } /* apply minimum sockets options to pass connect() */ static void preconnect_socket ( struct pgm_sock_t* sock ) { /* tx */ ((struct sockaddr*)&sock->send_gsr.gsr_group)->sa_family = AF_INET; ((struct sockaddr_in*)&sock->send_gsr.gsr_group)->sin_addr.s_addr = inet_addr ("239.192.0.1"); /* rx */ sock->recv_gsr_len = 1; ((struct sockaddr*)&sock->recv_gsr[0].gsr_group)->sa_family = ((struct sockaddr*)&sock->send_gsr.gsr_group)->sa_family; ((struct sockaddr*)&sock->recv_gsr[0].gsr_source)->sa_family = ((struct sockaddr*)&sock->send_gsr.gsr_group)->sa_family; ((struct sockaddr_in*)&sock->recv_gsr[0].gsr_group)->sin_addr.s_addr = ((struct sockaddr_in*)&sock->send_gsr.gsr_group)->sin_addr.s_addr; ((struct sockaddr_in*)&sock->recv_gsr[0].gsr_source)->sin_addr.s_addr = ((struct sockaddr_in*)&sock->send_gsr.gsr_group)->sin_addr.s_addr; } /* stock create unconnected socket for pgm_setsockopt(), etc. */ static struct pgm_sock_t* generate_sock (void) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, g_htons(TEST_PORT) }; struct pgm_sock_t* sock = g_new0 (struct pgm_sock_t, 1); memcpy (&sock->tsi, &tsi, sizeof(pgm_tsi_t)); sock->is_bound = FALSE; sock->is_connected = FALSE; sock->is_destroyed = FALSE; sock->is_reset = FALSE; sock->family = AF_INET; sock->protocol = IPPROTO_IP; sock->recv_sock = socket (AF_INET, SOCK_RAW, 113); sock->send_sock = socket (AF_INET, SOCK_RAW, 113); sock->send_with_router_alert_sock = socket (AF_INET, SOCK_RAW, 113); ((struct sockaddr*)&sock->send_addr)->sa_family = AF_INET; ((struct sockaddr_in*)&sock->send_addr)->sin_addr.s_addr = inet_addr ("127.0.0.2"); sock->dport = g_htons(TEST_PORT); sock->window = g_new0 (pgm_txw_t, 1); sock->iphdr_len = sizeof(struct pgm_ip); pgm_spinlock_init (&sock->txw_spinlock); pgm_rwlock_init (&sock->lock); return sock; } /** receiver module */ PGM_GNUC_INTERNAL void mock_pgm_peer_unref ( pgm_peer_t* peer ) { } /** source module */ static bool mock_pgm_on_nak_notify ( GIOChannel* source, GIOCondition condition, gpointer data ) { return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_send_spm ( pgm_sock_t* sock, int flags ) { return TRUE; } /** timer module */ PGM_GNUC_INTERNAL bool mock_pgm_timer_prepare ( pgm_sock_t* const sock ) { return FALSE; } PGM_GNUC_INTERNAL bool mock_pgm_timer_check ( pgm_sock_t* const sock ) { return FALSE; } PGM_GNUC_INTERNAL pgm_time_t mock_pgm_timer_expiration ( pgm_sock_t* const sock ) { return 100L; } PGM_GNUC_INTERNAL bool mock_pgm_timer_dispatch ( pgm_sock_t* const sock ) { return TRUE; } /** transmit window module */ pgm_txw_t* mock_pgm_txw_create ( const pgm_tsi_t* const tsi, const uint16_t tpdu_size, const uint32_t sqns, const unsigned secs, const ssize_t max_rte, const bool use_fec, const uint8_t rs_n, const uint8_t rs_k ) { pgm_txw_t* window = g_new0 (pgm_txw_t, 1); return window; } void mock_pgm_txw_shutdown ( pgm_txw_t* const window ) { g_free (window); } /** rate control module */ PGM_GNUC_INTERNAL void mock_pgm_rate_create ( pgm_rate_t* bucket, ssize_t rate_per_sec, size_t iphdr_len, uint16_t max_tpdu ) { } PGM_GNUC_INTERNAL void mock_pgm_rate_destroy ( pgm_rate_t* bucket ) { } PGM_GNUC_INTERNAL pgm_time_t mock_pgm_rate_remaining ( pgm_rate_t* bucket, gsize packetlen ) { return 0; } /** reed solomon module */ void mock_pgm_rs_create ( pgm_rs_t* rs, const uint8_t n, const uint8_t k ) { } void mock_pgm_rs_destroy ( pgm_rs_t* rs ) { } /** time module */ static pgm_time_t _mock_pgm_time_update_now (void); pgm_time_update_func mock_pgm_time_update_now = _mock_pgm_time_update_now; static pgm_time_t _mock_pgm_time_update_now (void) { return 0x1; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* mock functions for external references */ /* target: * bool * pgm_socket ( * pgm_sock_t** sock, * const sa_family_t family, * const int pgm_sock_type, * const int protocol, * pgm_error_t** error * ) */ START_TEST (test_create_pass_001) { pgm_error_t* err = NULL; pgm_sock_t* sock; /* only one type currently implemented */ const int pgm_sock_type = SOCK_SEQPACKET; /* PGM/IPv4 */ sock = NULL; fail_unless (TRUE == pgm_socket (&sock, AF_INET, pgm_sock_type, IPPROTO_PGM, &err), "create/1 failed"); /* PGM/UDP over IPv4 */ sock = NULL; fail_unless (TRUE == pgm_socket (&sock, AF_INET, pgm_sock_type, IPPROTO_UDP, &err), "create/2 failed"); /* PGM/IPv6 */ sock = NULL; fail_unless (TRUE == pgm_socket (&sock, AF_INET6, pgm_sock_type, IPPROTO_PGM, &err), "create6/1 failed"); /* PGM/UDP over IPv6 */ sock = NULL; fail_unless (TRUE == pgm_socket (&sock, AF_INET6, pgm_sock_type, IPPROTO_UDP, &err), "create6/2 failed"); fail_unless (NULL == err, "error raised"); } END_TEST /* NULL socket */ START_TEST (test_create_fail_002) { pgm_error_t* err = NULL; fail_unless (FALSE == pgm_socket (NULL, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); } END_TEST /* invalid protocol family */ START_TEST (test_create_fail_003) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; fail_unless (FALSE == pgm_socket (&sock, AF_UNSPEC, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); } END_TEST /* invalid socket type */ START_TEST (test_create_fail_004) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; fail_unless (FALSE == pgm_socket (&sock, AF_INET, SOCK_STREAM, IPPROTO_PGM, &err), "create failed"); fail_unless (FALSE == pgm_socket (&sock, AF_INET, SOCK_DGRAM, IPPROTO_PGM, &err), "create failed"); } END_TEST /* invalid protocol */ START_TEST (test_create_fail_005) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; fail_unless (FALSE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_TCP, &err), "create failed"); } END_TEST /* target: * bool * pgm_bind ( * pgm_sock_t* sock, * const struct pgm_sockaddr_t* sockaddr, * const socklen_t sockaddrlen, * pgm_error_t** error * ) */ START_TEST (test_bind_pass_001) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; struct pgm_sockaddr_t* pgmsa = generate_asm_sockaddr (); fail_if (NULL == pgmsa, "generate_asm_sockaddr failed"); fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (NULL == err, "error raised"); fail_unless (TRUE == pgm_bind (sock, pgmsa, sizeof(*pgmsa), &err), "bind failed"); } END_TEST /* fail on unset options */ START_TEST (test_bind_fail_001) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; struct pgm_sockaddr_t* pgmsa = generate_asm_sockaddr (); fail_if (NULL == pgmsa, "generate_asm_sockaddr failed"); fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (NULL == err, "error raised"); fail_unless (FALSE == pgm_bind (sock, pgmsa, sizeof(*pgmsa), &err), "bind failed"); } END_TEST /* invalid parameters */ START_TEST (test_bind_fail_002) { pgm_error_t* err = NULL; fail_unless (FALSE == pgm_bind (NULL, NULL, 0, &err), "bind failed"); } END_TEST /* target: * bool * pgm_bind3 ( * pgm_sock_t* sock, * const struct pgm_sockaddr_t* sockaddr, * const socklen_t sockaddrlen, * const struct pgm_interface_req_t* send_req, * const socklen_t send_req_len, * const struct pgm_interface_req_t* recv_req, * const socklen_t recv_req_len, * pgm_error_t** error * ) */ /* fail on unset options */ START_TEST (test_bind3_fail_001) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; struct pgm_sockaddr_t* pgmsa = generate_asm_sockaddr (); fail_if (NULL == pgmsa, "generate_asm_sockaddr failed"); fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (NULL == err, "error raised"); struct pgm_interface_req_t send_req = { .ir_interface = 0, .ir_scope_id = 0 }, recv_req = { .ir_interface = 0, .ir_scope_id = 0 }; fail_unless (FALSE == pgm_bind3 (sock, pgmsa, sizeof(*pgmsa), &send_req, sizeof(send_req), &recv_req, sizeof(recv_req), &err), "bind failed"); } END_TEST /* invalid parameters */ START_TEST (test_bind3_fail_002) { pgm_error_t* err = NULL; fail_unless (FALSE == pgm_bind3 (NULL, NULL, 0, NULL, 0, NULL, 0, &err), "bind failed"); } END_TEST /* target: * bool * pgm_connect ( * pgm_sock_t* sock, * pgm_error_t** error * ) */ START_TEST (test_connect_pass_001) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; struct pgm_sockaddr_t* pgmsa = generate_asm_sockaddr (); fail_if (NULL == pgmsa, "generate_asm_sockaddr failed"); fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (NULL == err, "error raised"); prebind_socket (sock); fail_unless (TRUE == pgm_bind (sock, pgmsa, sizeof(*pgmsa), &err), "bind failed"); preconnect_socket (sock); fail_unless (TRUE == pgm_connect (sock, &err), "connect failed"); } END_TEST /* invalid parameters */ START_TEST (test_connect_fail_001) { pgm_error_t* err = NULL; fail_unless (FALSE == pgm_connect (NULL, &err), "connect failed"); } END_TEST /* target: * bool * pgm_close ( * pgm_sock_t* sock, * bool flush * ) */ /* socket > close */ START_TEST (test_destroy_pass_001) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (TRUE == pgm_close (sock, FALSE), "destroy failed"); } END_TEST /* socket > bind > close */ START_TEST (test_destroy_pass_002) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; struct pgm_sockaddr_t* pgmsa = generate_asm_sockaddr (); fail_if (NULL == pgmsa, "generate_asm_sockaddr failed"); fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (NULL == err, "error raised"); fail_unless (TRUE == pgm_bind (sock, pgmsa, sizeof(*pgmsa), &err), "bind failed"); fail_unless (TRUE == pgm_close (sock, FALSE), "destroy failed"); } END_TEST /* socket > bind > connect > close */ START_TEST (test_destroy_pass_003) { pgm_error_t* err = NULL; pgm_sock_t* sock = NULL; struct pgm_sockaddr_t* pgmsa = generate_asm_sockaddr (); fail_if (NULL == pgmsa, "generate_asm_sockaddr failed"); fail_unless (TRUE == pgm_socket (&sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &err), "create failed"); fail_unless (NULL == err, "error raised"); fail_unless (TRUE == pgm_bind (sock, pgmsa, sizeof(*pgmsa), &err), "bind failed"); fail_unless (TRUE == pgm_connect (sock, &err), "connect failed"); fail_unless (TRUE == pgm_close (sock, FALSE), "destroy failed"); } END_TEST /* invalid parameters */ START_TEST (test_destroy_fail_001) { fail_unless (FALSE == pgm_close (NULL, FALSE), "destroy failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_MAX_TPDU, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_max_tpdu_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_MTU; const int max_tpdu = 1500; const void* optval = &max_tpdu; const socklen_t optlen = sizeof(max_tpdu); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_max_tpdu failed"); } END_TEST /* invalid parameters */ START_TEST (test_set_max_tpdu_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_MTU; const int max_tpdu = 1500; const void* optval = &max_tpdu; const socklen_t optlen = sizeof(max_tpdu); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_max_tpdu failed"); } END_TEST /* too small */ START_TEST (test_set_max_tpdu_fail_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_MTU; const int max_tpdu = 1; const void* optval = &max_tpdu; const socklen_t optlen = sizeof(max_tpdu); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_max_tpdu failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_MULTICAST_LOOP, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_multicast_loop_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_MULTICAST_LOOP; const int loop_enabled = 1; const void* optval = &loop_enabled; const socklen_t optlen = sizeof(loop_enabled); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_multicast_loop failed"); } END_TEST START_TEST (test_set_multicast_loop_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_MULTICAST_LOOP; const int loop_enabled = 1; const void* optval = &loop_enabled; const socklen_t optlen = sizeof(loop_enabled); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_multicast_loop failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_MULTICAST_HOPS, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_hops_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_MULTICAST_HOPS; const int hops = 16; const void* optval = &hops; const socklen_t optlen = sizeof(hops); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_hops failed"); } END_TEST START_TEST (test_set_hops_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_MULTICAST_HOPS; const int hops = 16; const void* optval = &hops; const socklen_t optlen = sizeof(hops); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_hops failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = SOL_SOCKET, * const int optname = SO_SNDBUF, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_sndbuf_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = SOL_SOCKET; const int optname = SO_SNDBUF; const int bufsize = 131071; /* 128kB */ const void* optval = &bufsize; const socklen_t optlen = sizeof(bufsize); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_sndbuf failed"); } END_TEST START_TEST (test_set_sndbuf_fail_001) { const int level = SOL_SOCKET; const int optname = SO_SNDBUF; const int bufsize = 131071; /* 128kB */ const void* optval = &bufsize; const socklen_t optlen = sizeof(bufsize); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_sndbuf failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = SOL_SOCKET, * const int optname = PGM_RCVBUF, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_rcvbuf_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = SOL_SOCKET; const int optname = SO_RCVBUF; const int bufsize = 131071; /* 128kB */ const void* optval = &bufsize; const socklen_t optlen = sizeof(bufsize); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_rcvbuf failed"); } END_TEST START_TEST (test_set_rcvbuf_fail_001) { const int level = SOL_SOCKET; const int optname = SO_RCVBUF; const int bufsize = 131071; /* 128kB */ const void* optval = &bufsize; const socklen_t optlen = sizeof(bufsize); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_rcvbuf failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_USE_FEC, * const void* optval, * const socklen_t optlen = sizeof(struct pgm_fecinfo_t) * ) */ START_TEST (test_set_fec_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_USE_FEC; const struct pgm_fecinfo_t fecinfo = { .ondemand_parity_enabled = TRUE, .proactive_packets = 16, .var_pktlen_enabled = TRUE, .block_size = 255, .group_size = 64 }; const void* optval = &fecinfo; const socklen_t optlen = sizeof(fecinfo); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_fec failed"); } END_TEST START_TEST (test_set_fec_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_USE_FEC; const struct pgm_fecinfo_t fecinfo = { .ondemand_parity_enabled = TRUE, .proactive_packets = 16, .var_pktlen_enabled = TRUE, .block_size = 255, .group_size = 64 }; const void* optval = &fecinfo; const socklen_t optlen = sizeof(fecinfo); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_fec failed"); } END_TEST /* TODO: invalid Reed-Solomon parameters */ /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_USE_PGMCC, * const void* optval, * const socklen_t optlen = sizeof(struct pgm_pgmccinfo_t) * ) */ START_TEST (test_set_pgmcc_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_USE_PGMCC; const struct pgm_pgmccinfo_t pgmccinfo = { .ack_bo_ivl = pgm_msecs(100), .ack_c = 123, .ack_c_p = 456 }; const void* optval = &pgmccinfo; const socklen_t optlen = sizeof(pgmccinfo); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_pgmcc failed"); } END_TEST START_TEST (test_set_pgmcc_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_USE_PGMCC; const struct pgm_pgmccinfo_t pgmccinfo = { .ack_bo_ivl = pgm_msecs(100), .ack_c = 123, .ack_c_p = 456 }; const void* optval = &pgmccinfo; const socklen_t optlen = sizeof(pgmccinfo); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_pgmcc failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_USE_CR, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_cr_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_USE_CR; const int magic_bunny = 1; const void* optval = &magic_bunny; const socklen_t optlen = sizeof(magic_bunny); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_cr failed"); } END_TEST START_TEST (test_set_cr_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_USE_CR; const int magic_bunny = 1; const void* optval = &magic_bunny; const socklen_t optlen = sizeof(magic_bunny); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_cr failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_SEND_ONLY, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_send_only_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_SEND_ONLY; const int send_only = 1; const void* optval = &send_only; const socklen_t optlen = sizeof(send_only); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_send_only failed"); } END_TEST START_TEST (test_set_send_only_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_SEND_ONLY; const int send_only = 1; const void* optval = &send_only; const socklen_t optlen = sizeof(send_only); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_send_only failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_RECV_ONLY, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_recv_only_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_RECV_ONLY; const int recv_only = 1; const void* optval = &recv_only; const socklen_t optlen = sizeof(recv_only); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_recv_only failed"); } END_TEST START_TEST (test_set_recv_only_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_RECV_ONLY; const int recv_only = 1; const void* optval = &recv_only; const socklen_t optlen = sizeof(recv_only); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_recv_only failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_PASSIVE, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_recv_only_pass_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_PASSIVE; const int passive = 1; const void* optval = &passive; const socklen_t optlen = sizeof(passive); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_passive failed"); } END_TEST START_TEST (test_set_recv_only_fail_002) { const int level = IPPROTO_PGM; const int optname = PGM_PASSIVE; const int passive = 1; const void* optval = &passive; const socklen_t optlen = sizeof(passive); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_passive failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_ABORT_ON_RESET, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_abort_on_reset_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_ABORT_ON_RESET; const int abort_on_reset= 1; const void* optval = &abort_on_reset; const socklen_t optlen = sizeof(abort_on_reset); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_abort_on_reset failed"); } END_TEST START_TEST (test_set_abort_on_reset_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_ABORT_ON_RESET; const int abort_on_reset= 1; const void* optval = &abort_on_reset; const socklen_t optlen = sizeof(abort_on_reset); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_abort_on_reset failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_NOBLOCK, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_noblock_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_NOBLOCK; const int noblock = 1; const void* optval = &noblock; const socklen_t optlen = sizeof(noblock); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_noblock failed"); } END_TEST START_TEST (test_set_noblock_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NOBLOCK; const int noblock = 1; const void* optval = &noblock; const socklen_t optlen = sizeof(noblock); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_noblock failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_UDP_ENCAP_UCAST_PORT, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_udp_unicast_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_NOBLOCK; const int unicast_port = 10001; const void* optval = &unicast_port; const socklen_t optlen = sizeof(unicast_port); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_udp_unicast failed"); } END_TEST START_TEST (test_set_udp_unicast_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NOBLOCK; const int unicast_port = 10001; const void* optval = &unicast_port; const socklen_t optlen = sizeof(unicast_port); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_udp_unicast failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_UDP_ENCAP_MCAST_PORT, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_udp_multicast_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_NOBLOCK; const int multicast_port= 10001; const void* optval = &multicast_port; const socklen_t optlen = sizeof(multicast_port); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_udp_multicast failed"); } END_TEST START_TEST (test_set_udp_multicast_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NOBLOCK; const int multicast_port= 10002; const void* optval = &multicast_port; const socklen_t optlen = sizeof(multicast_port); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_udp_multicast failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_create = tcase_create ("create"); suite_add_tcase (s, tc_create); tcase_add_checked_fixture (tc_create, mock_setup, mock_teardown); tcase_add_test (tc_create, test_create_pass_001); tcase_add_test (tc_create, test_create_fail_002); tcase_add_test (tc_create, test_create_fail_003); tcase_add_test (tc_create, test_create_fail_004); tcase_add_test (tc_create, test_create_fail_005); TCase* tc_bind = tcase_create ("bind"); suite_add_tcase (s, tc_bind); tcase_add_checked_fixture (tc_bind, mock_setup, mock_teardown); tcase_add_test (tc_bind, test_bind_fail_001); tcase_add_test (tc_bind, test_bind_fail_002); TCase* tc_connect = tcase_create ("connect"); suite_add_tcase (s, tc_connect); tcase_add_checked_fixture (tc_connect, mock_setup, mock_teardown); tcase_add_test (tc_connect, test_connect_pass_001); tcase_add_test (tc_connect, test_connect_fail_001); TCase* tc_destroy = tcase_create ("destroy"); suite_add_tcase (s, tc_destroy); tcase_add_checked_fixture (tc_destroy, mock_setup, mock_teardown); tcase_add_test (tc_destroy, test_destroy_pass_001); tcase_add_test (tc_destroy, test_destroy_fail_001); TCase* tc_set_max_tpdu = tcase_create ("set-max-tpdu"); suite_add_tcase (s, tc_set_max_tpdu); tcase_add_checked_fixture (tc_set_max_tpdu, mock_setup, mock_teardown); tcase_add_test (tc_set_max_tpdu, test_set_max_tpdu_pass_001); tcase_add_test (tc_set_max_tpdu, test_set_max_tpdu_fail_001); TCase* tc_set_multicast_loop = tcase_create ("set-multicast-loop"); suite_add_tcase (s, tc_set_multicast_loop); tcase_add_checked_fixture (tc_set_multicast_loop, mock_setup, mock_teardown); tcase_add_test (tc_set_multicast_loop, test_set_multicast_loop_pass_001); tcase_add_test (tc_set_multicast_loop, test_set_multicast_loop_fail_001); TCase* tc_set_hops = tcase_create ("set-hops"); suite_add_tcase (s, tc_set_hops); tcase_add_checked_fixture (tc_set_hops, mock_setup, mock_teardown); tcase_add_test (tc_set_hops, test_set_hops_pass_001); tcase_add_test (tc_set_hops, test_set_hops_fail_001); TCase* tc_set_sndbuf = tcase_create ("set-sndbuf"); suite_add_tcase (s, tc_set_sndbuf); tcase_add_checked_fixture (tc_set_sndbuf, mock_setup, mock_teardown); tcase_add_test (tc_set_sndbuf, test_set_sndbuf_pass_001); tcase_add_test (tc_set_sndbuf, test_set_sndbuf_fail_001); TCase* tc_set_rcvbuf = tcase_create ("set-rcvbuf"); suite_add_tcase (s, tc_set_rcvbuf); tcase_add_checked_fixture (tc_set_rcvbuf, mock_setup, mock_teardown); tcase_add_test (tc_set_rcvbuf, test_set_rcvbuf_pass_001); tcase_add_test (tc_set_rcvbuf, test_set_rcvbuf_fail_001); TCase* tc_set_fec = tcase_create ("set-fec"); suite_add_tcase (s, tc_set_fec); tcase_add_checked_fixture (tc_set_fec, mock_setup, mock_teardown); tcase_add_test (tc_set_fec, test_set_fec_pass_001); tcase_add_test (tc_set_fec, test_set_fec_fail_001); TCase* tc_set_pgmcc = tcase_create ("set-pgmcc"); suite_add_tcase (s, tc_set_pgmcc); tcase_add_checked_fixture (tc_set_pgmcc, mock_setup, mock_teardown); tcase_add_test (tc_set_pgmcc, test_set_pgmcc_pass_001); tcase_add_test (tc_set_pgmcc, test_set_pgmcc_fail_001); TCase* tc_set_cr = tcase_create ("set-cr"); suite_add_tcase (s, tc_set_cr); tcase_add_checked_fixture (tc_set_cr, mock_setup, mock_teardown); tcase_add_test (tc_set_cr, test_set_cr_pass_001); tcase_add_test (tc_set_cr, test_set_cr_fail_001); TCase* tc_set_send_only = tcase_create ("set-send-only"); suite_add_tcase (s, tc_set_send_only); tcase_add_checked_fixture (tc_set_send_only, mock_setup, mock_teardown); tcase_add_test (tc_set_send_only, test_set_send_only_pass_001); tcase_add_test (tc_set_send_only, test_set_send_only_fail_001); TCase* tc_set_recv_only = tcase_create ("set-recv-only"); suite_add_tcase (s, tc_set_recv_only); tcase_add_checked_fixture (tc_set_recv_only, mock_setup, mock_teardown); tcase_add_test (tc_set_recv_only, test_set_recv_only_pass_001); tcase_add_test (tc_set_recv_only, test_set_recv_only_pass_002); tcase_add_test (tc_set_recv_only, test_set_recv_only_fail_001); tcase_add_test (tc_set_recv_only, test_set_recv_only_fail_002); TCase* tc_set_abort_on_reset = tcase_create ("set-abort-on-reset"); suite_add_tcase (s, tc_set_abort_on_reset); tcase_add_checked_fixture (tc_set_abort_on_reset, mock_setup, mock_teardown); tcase_add_test (tc_set_abort_on_reset, test_set_abort_on_reset_pass_001); tcase_add_test (tc_set_abort_on_reset, test_set_abort_on_reset_fail_001); TCase* tc_set_noblock = tcase_create ("set-non-blocking"); suite_add_tcase (s, tc_set_noblock); tcase_add_checked_fixture (tc_set_noblock, mock_setup, mock_teardown); tcase_add_test (tc_set_noblock, test_set_noblock_pass_001); tcase_add_test (tc_set_noblock, test_set_noblock_fail_001); TCase* tc_set_udp_unicast = tcase_create ("set-udp-encap-ucast-port"); suite_add_tcase (s, tc_set_udp_unicast); tcase_add_checked_fixture (tc_set_udp_unicast, mock_setup, mock_teardown); tcase_add_test (tc_set_udp_unicast, test_set_udp_unicast_pass_001); tcase_add_test (tc_set_udp_unicast, test_set_udp_unicast_fail_001); TCase* tc_set_udp_multicast = tcase_create ("set-udp-encap-mcast-port"); suite_add_tcase (s, tc_set_udp_multicast); tcase_add_checked_fixture (tc_set_udp_multicast, mock_setup, mock_teardown); tcase_add_test (tc_set_udp_multicast, test_set_udp_multicast_pass_001); tcase_add_test (tc_set_udp_multicast, test_set_udp_multicast_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifndef _WIN32 if (0 != getuid()) { fprintf (stderr, "This test requires super-user privileges to run.\n"); return EXIT_FAILURE; } #else WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif g_assert (pgm_time_init (NULL)); pgm_messages_init(); pgm_rand_init(); pgm_thread_init(); pgm_rwlock_init (&pgm_sock_list_lock); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_rwlock_free (&pgm_sock_list_lock); pgm_thread_shutdown(); pgm_rand_shutdown(); pgm_messages_shutdown(); g_assert (pgm_time_shutdown()); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/signal_unittest.c0000644000175000017500000000466211640407354021133 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for re-entrant safe signal handling. * * Copyright (c) 2006-2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include /* mock state */ static void on_sigusr1 ( int signum, gpointer user_data ) { g_assert (SIGUSR1 == signum); g_assert (NULL != user_data); GMainLoop* loop = (GMainLoop*)user_data; g_debug ("on_sigusr1 (signum:%d)", signum); g_main_loop_quit (loop); } /* mock functions for external references */ #define SIGNAL_DEBUG #include "signal.c" /* target: * pgm_sighandler_t * pgm_signal_install ( * int signum, pgm_sighandler_t handler * ) */ static gboolean on_startup ( gpointer data ) { g_assert (NULL != data); const int signum = *(const int*)data; fail_unless (0 == raise (signum)); return FALSE; } START_TEST (test_install_pass_001) { const int signum = SIGUSR1; GMainLoop* loop = g_main_loop_new (NULL, FALSE); fail_unless (TRUE == pgm_signal_install (signum, on_sigusr1, loop)); g_timeout_add (0, (GSourceFunc)on_startup, &signum); g_main_loop_run (loop); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_install = tcase_create ("install"); suite_add_tcase (s, tc_install); tcase_add_test (tc_install, test_install_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/packet_test_unittest.c0000644000175000017500000001026011640407354022153 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM packet handling. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ #define PACKET_DEBUG #include "packet_test.c" static struct pgm_sk_buff_t* generate_raw_pgm (void) { const char source[] = "i am not a string"; const guint source_len = sizeof(source); struct pgm_sk_buff_t* skb; GError* err = NULL; skb = pgm_alloc_skb (1500); skb->sock = (pgm_sock_t*)0x1; skb->tstamp = 0x1; skb->data = skb->head; skb->len = sizeof(struct pgm_ip) + sizeof(struct pgm_header) + sizeof(struct pgm_data) + source_len; skb->tail = (guint8*)skb->data + skb->len; /* add IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_hl = sizeof(struct pgm_ip) / 4; iphdr->ip_v = 4; iphdr->ip_tos = 0; iphdr->ip_len = g_htons (skb->len); iphdr->ip_id = 0; iphdr->ip_off = 0; iphdr->ip_ttl = 16; iphdr->ip_p = IPPROTO_PGM; iphdr->ip_sum = 0; iphdr->ip_src.s_addr = inet_addr ("127.0.0.1"); iphdr->ip_dst.s_addr = inet_addr ("127.0.0.2"); /* add PGM header */ struct pgm_header* pgmhdr = (gpointer)(iphdr + 1); pgmhdr->pgm_sport = g_htons ((guint16)1000); pgmhdr->pgm_dport = g_htons ((guint16)7500); pgmhdr->pgm_type = PGM_ODATA; pgmhdr->pgm_options = 0; pgmhdr->pgm_gsi[0] = 1; pgmhdr->pgm_gsi[1] = 2; pgmhdr->pgm_gsi[2] = 3; pgmhdr->pgm_gsi[3] = 4; pgmhdr->pgm_gsi[4] = 5; pgmhdr->pgm_gsi[5] = 6; pgmhdr->pgm_tsdu_length = g_htons (source_len); /* add ODATA header */ struct pgm_data* datahdr = (gpointer)(pgmhdr + 1); datahdr->data_sqn = g_htonl ((guint32)0); datahdr->data_trail = g_htonl ((guint32)-1); /* add payload */ gpointer data = (gpointer)(datahdr + 1); memcpy (data, source, source_len); /* finally PGM checksum */ pgmhdr->pgm_checksum = 0; pgmhdr->pgm_checksum = pgm_csum_fold (pgm_csum_partial (pgmhdr, sizeof(struct pgm_header) + sizeof(struct pgm_data) + source_len, 0)); /* and IP checksum */ iphdr->ip_sum = pgm_inet_checksum (skb->head, skb->len, 0); return skb; } /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * gboolean * pgm_print_packet ( * gpointer data, * gsize len * ) */ START_TEST (test_print_packet_pass_001) { struct pgm_sk_buff_t* skb = generate_raw_pgm (); pgm_print_packet (skb->head, skb->len); } END_TEST START_TEST (test_print_packet_fail_001) { pgm_print_packet (NULL, 0); fail ("reached"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_print_packet = tcase_create ("print-packet"); suite_add_tcase (s, tc_print_packet); tcase_add_test (tc_print_packet, test_print_packet_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_print_packet, test_print_packet_fail_001, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/reed_solomon.c0000644000175000017500000003066011640407354020401 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Reed-Solomon forward error correction based on Vandermonde matrices. * * Output is incompatible with BCH style Reed-Solomon encoding. * * draft-ietf-rmt-bb-fec-rs-05.txt * + rfc5052 * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include /* Vector GF(2⁸) plus-equals multiplication. * * d[] += b • s[] */ static void _pgm_gf_vec_addmul ( pgm_gf8_t* restrict d, const pgm_gf8_t b, const pgm_gf8_t* restrict s, uint16_t len /* length of vectors */ ) { uint_fast16_t i; uint_fast16_t count8; if (PGM_UNLIKELY(b == 0)) return; #ifdef CONFIG_GALOIS_MUL_LUT const pgm_gf8_t* gfmul_b = &pgm_gftable[ (uint16_t)b << 8 ]; #endif i = 0; count8 = len >> 3; /* 8-way unrolls */ if (count8) { while (count8--) { #ifdef CONFIG_GALOIS_MUL_LUT d[i ] ^= gfmul_b[ s[i ] ]; d[i+1] ^= gfmul_b[ s[i+1] ]; d[i+2] ^= gfmul_b[ s[i+2] ]; d[i+3] ^= gfmul_b[ s[i+3] ]; d[i+4] ^= gfmul_b[ s[i+4] ]; d[i+5] ^= gfmul_b[ s[i+5] ]; d[i+6] ^= gfmul_b[ s[i+6] ]; d[i+7] ^= gfmul_b[ s[i+7] ]; #else d[i ] ^= gfmul( b, s[i ] ); d[i+1] ^= gfmul( b, s[i+1] ); d[i+2] ^= gfmul( b, s[i+2] ); d[i+3] ^= gfmul( b, s[i+3] ); d[i+4] ^= gfmul( b, s[i+4] ); d[i+5] ^= gfmul( b, s[i+5] ); d[i+6] ^= gfmul( b, s[i+6] ); d[i+7] ^= gfmul( b, s[i+7] ); #endif i += 8; } /* remaining */ len %= 8; } while (len--) { #ifdef CONFIG_GALOIS_MUL_LUT d[i] ^= gfmul_b[ s[i] ]; #else d[i] ^= gfmul( b, s[i] ); #endif i++; } } /* Basic matrix multiplication. * * C = AB * n * c_i,j = ∑ a_i,j × b_r,j = a_i,1 × b_1,j + a_i,2 × b_2,j + ⋯ + a_i,n × b_n,j * r=1 */ static void _pgm_matmul ( const pgm_gf8_t* restrict a, /* m-by-n */ const pgm_gf8_t* restrict b, /* n-by-p */ pgm_gf8_t* restrict c, /* ∴ m-by-p */ const uint16_t m, const uint16_t n, const uint16_t p ) { for (uint_fast16_t j = 0; j < m; j++) { for (uint_fast16_t i = 0; i < p; i++) { pgm_gf8_t sum = 0; for (uint_fast16_t k = 0; k < n; k++) { sum ^= pgm_gfmul ( a[ (j * n) + k ], b[ (k * p) + i ] ); } c[ (j * p) + i ] = sum; } } } /* Generic square matrix inversion */ #ifdef CONFIG_XOR_SWAP /* whilst cute the xor swap is quite slow */ #define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) #else #define SWAP(a, b) do { const pgm_gf8_t _t = (b); (b) = (a); (a) = _t; } while (0) #endif static void _pgm_matinv ( pgm_gf8_t* M, /* is n-by-n */ const uint8_t n ) { uint8_t pivot_rows[ n ]; uint8_t pivot_cols[ n ]; bool pivots[ n ]; memset (pivots, 0, sizeof(pivots)); pgm_gf8_t identity[ n ]; memset (identity, 0, sizeof(identity)); for (uint_fast8_t i = 0; i < n; i++) { uint_fast8_t row = 0, col = 0; /* check diagonal for new pivot */ if (!pivots[ i ] && M[ (i * n) + i ]) { row = col = i; } else { for (uint_fast8_t j = 0; j < n; j++) { if (pivots[ j ]) continue; for (uint_fast8_t x = 0; x < n; x++) { if (!pivots[ x ] && M[ (j * n) + x ]) { row = j; col = x; goto found; } } } } found: pivots[ col ] = TRUE; /* pivot */ if (row != col) { for (uint_fast8_t x = 0; x < n; x++) { pgm_gf8_t *pivot_row = &M[ (row * n) + x ], *pivot_col = &M[ (col * n) + x ]; SWAP( *pivot_row, *pivot_col ); } } /* save location */ pivot_rows[ i ] = row; pivot_cols[ i ] = col; /* divide row by pivot element */ if (M[ (col * n) + col ] != 1) { const pgm_gf8_t c = M[ (col * n) + col ]; M[ (col * n) + col ] = 1; for (uint_fast8_t x = 0; x < n; x++) { M[ (col * n) + x ] = pgm_gfdiv( M[ (col * n) + x ], c ); } } /* reduce if not an identity row */ identity[ col ] = 1; if (memcmp (&M[ (col * n) ], identity, n * sizeof(pgm_gf8_t))) { for ( uint_fast8_t x = 0; x < n; x++ ) { if (x == col) continue; const pgm_gf8_t c = M[ (x * n) + col ]; M[ (x * n) + col ] = 0; _pgm_gf_vec_addmul (&M[ x * n ], c, &M[ col * n ], n); } } identity[ col ] = 0; } /* revert all pivots */ for (int_fast16_t i = n - 1; i >= 0; i--) { if (pivot_rows[ i ] != pivot_cols[ i ]) { for (uint_fast8_t j = 0; j < n; j++) { pgm_gf8_t *pivot_row = &M[ (j * n) + pivot_rows[ i ] ], *pivot_col = &M[ (j * n) + pivot_cols[ i ] ]; SWAP( *pivot_row, *pivot_col ); } } } } /* Gauss–Jordan elimination optimised for Vandermonde matrices * * matrix = matrix⁻¹ * * A Vandermonde matrix exhibits geometric progression in each row: * * ⎡ 1 α₁ α₁² ⋯ α₁^^(n-1) ⎤ * V = ⎢ 1 α₂ α₂² ⋯ α₂^^(n-1) ⎥ * ⎣ 1 α₃ α₃² ⋯ α₃^^(n-1) ⎦ * * First column is actually α_m⁰, second column is α_m¹. * * nb: produces a modified Vandermonde matrix optimised for subsequent * multiplication terms. */ static void _pgm_matinv_vandermonde ( pgm_gf8_t* V, /* is n-by-n */ const uint8_t n ) { /* trivial cases */ if (n == 1) return; /* P_j(α) is polynomial of degree n - 1 defined by * * n * P_j(α) = ∏ (α - α_m) * m=1 * * 1: Work out coefficients. */ pgm_gf8_t P[ n ]; memset (P, 0, sizeof(P)); /* copy across second row, i.e. j = 2 */ for (uint_fast8_t i = 0; i < n; i++) { P[ i ] = V[ (i * n) + 1 ]; } pgm_gf8_t alpha[ n ]; memset (alpha, 0, sizeof(alpha)); alpha[ n - 1 ] = P[ 0 ]; for (uint_fast8_t i = 1; i < n; i++) { for (uint_fast8_t j = (n - i); j < (n - 1); j++) { alpha[ j ] ^= pgm_gfmul( P[ i ], alpha[ j + 1 ] ); } alpha[ n - 1 ] ^= P[ i ]; } /* 2: Obtain numberators and denominators by synthetic division. */ pgm_gf8_t b[ n ]; b[ n - 1 ] = 1; for (uint_fast8_t j = 0; j < n; j++) { const pgm_gf8_t xx = P[ j ]; pgm_gf8_t t = 1; /* skip first iteration */ for (int_fast16_t i = n - 2; i >= 0; i--) { b[ i ] = alpha[ i + 1 ] ^ pgm_gfmul( xx, b[ i + 1 ] ); t = pgm_gfmul( xx, t ) ^ b[ i ]; } for (uint_fast8_t i = 0; i < n; i++) { V[ (i * n) + j ] = pgm_gfdiv ( b[ i ], t ); } } } /* create the generator matrix of a reed-solomon code. * * s GM e * ⎧ ⎡ s₀ ⎤ ⎡ 1 0 0 ⎤ ⎡ e₀ ⎤ ⎫ * ⎪ ⎢ ⋮ ⎥ ⎢ 0 1 ⎥ = ⎢ ⋮ ⎥ ⎬ n * k ⎨ ⎢ ⋮ ⎥ × ⎢ ⋱ ⎥ ⎣e_{n-1}⎦ ⎭ * ⎪ ⎢ ⋮ ⎥ ⎢ ⋱ ⎥ * ⎩ ⎣s_{k-1}⎦ ⎣ 0 0 1 ⎦ * * e = s × GM */ PGM_GNUC_INTERNAL void pgm_rs_create ( pgm_rs_t* rs, const uint8_t n, const uint8_t k ) { pgm_assert (NULL != rs); pgm_assert (n > 0); pgm_assert (k > 0); rs->n = n; rs->k = k; rs->GM = pgm_new0 (pgm_gf8_t, n * k); rs->RM = pgm_new0 (pgm_gf8_t, k * k); /* alpha = root of primitive polynomial of degree m * ( 1 + x² + x³ + x⁴ + x⁸ ) * * V = Vandermonde matrix of k rows and n columns. * * Be careful, Harry! */ #ifdef CONFIG_PREFER_MALLOC pgm_gf8_t* V = pgm_new0 (pgm_gf8_t, n * k); #else pgm_gf8_t* V = pgm_newa (pgm_gf8_t, n * k); memset (V, 0, n * k); #endif pgm_gf8_t* p = V + k; V[0] = 1; for (uint_fast8_t j = 0; j < (n - 1); j++) { for (uint_fast8_t i = 0; i < k; i++) { /* the {i, j} entry of V_{k,n} is v_{i,j} = α^^(i×j), * where 0 <= i <= k - 1 and 0 <= j <= n - 1. */ *p++ = pgm_gfantilog[ ( i * j ) % PGM_GF_MAX ]; } } /* This generator matrix would create a Maximum Distance Separable (MDS) * matrix, a systematic result is required, i.e. original data is left * unchanged. * * GM = V_{k,k}⁻¹ × V_{k,n} * * 1: matrix V_{k,k} formed by the first k columns of V_{k,n} */ pgm_gf8_t* V_kk = V; pgm_gf8_t* V_kn = V + (k * k); /* 2: invert it */ _pgm_matinv_vandermonde (V_kk, k); /* 3: multiply by V_{k,n} */ _pgm_matmul (V_kn, V_kk, rs->GM + (k * k), n - k, k, k); #ifdef CONFIG_PREFER_MALLOC pgm_free (V); #endif /* 4: set identity matrix for original data */ for (uint_fast8_t i = 0; i < k; i++) { rs->GM[ (i * k) + i ] = 1; } } PGM_GNUC_INTERNAL void pgm_rs_destroy ( pgm_rs_t* rs ) { pgm_assert (NULL != rs); if (rs->RM) { pgm_free (rs->RM); rs->RM = NULL; } if (rs->GM) { pgm_free (rs->GM); rs->GM = NULL; } } /* create a parity packet from a vector of original data packets and * FEC block packet offset. */ PGM_GNUC_INTERNAL void pgm_rs_encode ( pgm_rs_t* restrict rs, const pgm_gf8_t** restrict src, /* length rs_t::k */ const uint8_t offset, pgm_gf8_t* restrict dst, const uint16_t len ) { pgm_assert (NULL != rs); pgm_assert (NULL != src); pgm_assert (offset >= rs->k && offset < rs->n); /* parity packet */ pgm_assert (NULL != dst); pgm_assert (len > 0); memset (dst, 0, len); for (uint_fast8_t i = 0; i < rs->k; i++) { const pgm_gf8_t c = rs->GM[ (offset * rs->k) + i ]; _pgm_gf_vec_addmul (dst, c, src[i], len); } } /* original data block of packets with missing packet entries replaced * with on-demand parity packets. */ PGM_GNUC_INTERNAL void pgm_rs_decode_parity_inline ( pgm_rs_t* restrict rs, pgm_gf8_t** restrict block, /* length rs_t::k */ const uint8_t* restrict offsets, /* offsets within FEC block, 0 < offset < n */ const uint16_t len /* packet length */ ) { pgm_assert (NULL != rs); pgm_assert (NULL != block); pgm_assert (NULL != offsets); pgm_assert (len > 0); /* create new recovery matrix from generator */ for (uint_fast8_t i = 0; i < rs->k; i++) { if (offsets[i] < rs->k) { memset (&rs->RM[ i * rs->k ], 0, rs->k * sizeof(pgm_gf8_t)); rs->RM[ (i * rs->k) + i ] = 1; continue; } memcpy (&rs->RM[ i * rs->k ], &rs->GM[ offsets[ i ] * rs->k ], rs->k * sizeof(pgm_gf8_t)); } /* invert */ _pgm_matinv (rs->RM, rs->k); pgm_gf8_t* repairs[ rs->k ]; /* multiply out, through the length of erasures[] */ for (uint_fast8_t j = 0; j < rs->k; j++) { if (offsets[ j ] < rs->k) continue; #ifdef CONFIG_PREFER_MALLOC pgm_gf8_t* erasure = repairs[ j ] = pgm_malloc0 (len); #else pgm_gf8_t* erasure = repairs[ j ] = pgm_alloca (len); memset (erasure, 0, len); #endif for (uint_fast8_t i = 0; i < rs->k; i++) { pgm_gf8_t* src = block[ i ]; pgm_gf8_t c = rs->RM[ (j * rs->k) + i ]; _pgm_gf_vec_addmul (erasure, c, src, len); } } /* move repaired over parity packets */ for (uint_fast8_t j = 0; j < rs->k; j++) { if (offsets[ j ] < rs->k) continue; memcpy (block[ j ], repairs[ j ], len * sizeof(pgm_gf8_t)); #ifdef CONFIG_PREFER_MALLOC pgm_free (repairs[ j ]); #endif } } /* entire FEC block of original data and parity packets. * * erased packet buffers must be zeroed. */ PGM_GNUC_INTERNAL void pgm_rs_decode_parity_appended ( pgm_rs_t* restrict rs, pgm_gf8_t** restrict block, /* length rs_t::n, the FEC block */ const uint8_t* restrict offsets, /* ordered index of packets */ const uint16_t len /* packet length */ ) { pgm_assert (NULL != rs); pgm_assert (NULL != block); pgm_assert (NULL != offsets); pgm_assert (len > 0); /* create new recovery matrix from generator */ for (uint_fast8_t i = 0; i < rs->k; i++) { if (offsets[i] < rs->k) { memset (&rs->RM[ i * rs->k ], 0, rs->k * sizeof(pgm_gf8_t)); rs->RM[ (i * rs->k) + i ] = 1; continue; } memcpy (&rs->RM[ i * rs->k ], &rs->GM[ offsets[ i ] * rs->k ], rs->k * sizeof(pgm_gf8_t)); } /* invert */ _pgm_matinv (rs->RM, rs->k); /* multiply out, through the length of erasures[] */ for (uint_fast8_t j = 0; j < rs->k; j++) { if (offsets[ j ] < rs->k) continue; uint_fast8_t p = rs->k; pgm_gf8_t* erasure = block[ j ]; for (uint_fast8_t i = 0; i < rs->k; i++) { pgm_gf8_t* src; if (offsets[ i ] < rs->k) src = block[ i ]; else src = block[ p++ ]; const pgm_gf8_t c = rs->RM[ (j * rs->k) + i ]; _pgm_gf_vec_addmul (erasure, c, src, len); } } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConscript.libpgmsnmp0000644000175000017500000000345311640407354021731 0ustar locallocal# -*- mode: python -*- # OpenPGM build script # $Id$ Import('env') e = env.Clone() e.Append(CCFLAGS = '-DGETTEXT_PACKAGE=\'"pgm-snmp"\''); e.MergeFlags(e['SNMP_FLAGS']); src = Split(""" snmp.c pgmMIB.c """) e.StaticLibrary('libpgmsnmp', src); e.StaticSharedLibrary('libpgmsnmp-pic', src); #----------------------------------------------------------------------------- # unit testing if env['WITH_CHECK'] == 'true': te = e.Clone(); # add new suffix so we can re-use libpgm objects te['SHOBJSUFFIX'] = '.snmp' + te['SHOBJSUFFIX']; te['OBJSUFFIX'] = '.snmp' + te['OBJSUFFIX']; te.MergeFlags(env['GLIB_FLAGS']); te.MergeFlags(env['CHECK_FLAGS']); newCCFLAGS = []; for flag in te['CCFLAGS']: if ("-W" != flag[:2]) and ("-pedantic" != flag[:9]): newCCFLAGS.append(flag); te['CCFLAGS'] = newCCFLAGS; # collate tframework = [ te.Object('checksum.c'), te.Object('error.c'), te.Object('galois_tables.c'), te.Object('getifaddrs.c'), te.Object('getnodeaddr.c'), te.Object('hashtable.c'), te.Object('histogram.c'), te.Object('indextoaddr.c'), te.Object('indextoname.c'), te.Object('inet_network.c'), te.Object('list.c'), te.Object('math.c'), te.Object('md5.c'), te.Object('mem.c'), te.Object('messages.c'), te.Object('nametoindex.c'), te.Object('queue.c'), te.Object('rand.c'), te.Object('rate_control.c'), te.Object('reed_solomon.c'), te.Object('slist.c'), te.Object('sockaddr.c'), te.Object('string.c'), te.Object('thread.c'), te.Object('time.c'), te.Object('wsastrerror.c') ]; # snmp te.Program (['snmp_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['pgmMIB_unittest.c', te.Object('snmp.c'), te.Object('gsi.c'), # sunpro linking te.Object('skbuff.c') ] + tframework); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/tsi.c0000644000175000017500000000521411640407354016510 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * transport session ID helper functions. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include //#define TSI_DEBUG /* locals */ /* re-entrant form of pgm_tsi_print() * * returns number of bytes written to buffer on success, returns -1 on * invalid parameters. */ int pgm_tsi_print_r ( const pgm_tsi_t* restrict tsi, char* restrict buf, size_t bufsize ) { pgm_return_val_if_fail (NULL != tsi, -1); pgm_return_val_if_fail (NULL != buf, -1); pgm_return_val_if_fail (bufsize > 0, -1); const uint8_t* gsi = (const uint8_t*)tsi; const uint16_t source_port = tsi->sport; return pgm_snprintf_s (buf, bufsize, _TRUNCATE, "%u.%u.%u.%u.%u.%u.%u", gsi[0], gsi[1], gsi[2], gsi[3], gsi[4], gsi[5], ntohs (source_port)); } /* transform TSI to ASCII string form. * * on success, returns pointer to ASCII string. on error, returns NULL. */ char* pgm_tsi_print ( const pgm_tsi_t* tsi ) { static char buf[PGM_TSISTRLEN]; pgm_return_val_if_fail (tsi != NULL, NULL); pgm_tsi_print_r (tsi, buf, sizeof(buf)); return buf; } /* create hash value of TSI for use with GLib hash tables. * * on success, returns a hash value corresponding to the TSI. on error, fails * on assert. */ PGM_GNUC_INTERNAL pgm_hash_t pgm_tsi_hash ( const void* p ) { const union { pgm_tsi_t tsi; uint32_t l[2]; } *u = p; /* pre-conditions */ pgm_assert (NULL != p); return u->l[0] ^ u->l[1]; } /* compare two transport session identifier TSI values. * * returns TRUE if they are equal, FALSE if they are not. */ bool pgm_tsi_equal ( const void* restrict p1, const void* restrict p2 ) { const union { pgm_tsi_t tsi; uint32_t l[2]; uint64_t ll; } *restrict u1 = p1, *restrict u2 = p2; /* pre-conditions */ pgm_assert (NULL != p1); pgm_assert (NULL != p2); return (u1->l[0] == u2->l[0] && u1->l[1] == u2->l[1]); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/md5.c.c89.patch0000644000175000017500000000222511640407354020075 0ustar locallocal--- md5.c 2011-03-12 10:14:29.000000000 +0800 +++ md5.c89.c 2011-03-12 10:42:39.000000000 +0800 @@ -93,6 +93,7 @@ pgm_assert (len > 0); pgm_assert (NULL != ctx); + { uint32_t correct_words[16]; const uint32_t *words = buffer; const size_t nwords = len / sizeof (uint32_t); @@ -105,7 +106,7 @@ /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ - ctx->total[0] += len; + ctx->total[0] += (uint32_t)len; if (ctx->total[0] < len) ++ctx->total[1]; @@ -244,6 +245,7 @@ ctx->B = B; ctx->C = C; ctx->D = D; + } } PGM_GNUC_INTERNAL @@ -299,7 +301,7 @@ left_over -= 64; memcpy (ctx->buffer, &ctx->buffer[64], left_over); } - ctx->buflen = left_over; + ctx->buflen = (uint32_t)left_over; } } @@ -346,6 +348,7 @@ pgm_assert (NULL != resbuf); /* Take yet unprocessed bytes into account. */ + { const uint32_t bytes = ctx->buflen; size_t pad; @@ -366,6 +369,7 @@ _pgm_md5_process_block (ctx, ctx->buffer, bytes + pad + 8); return _pgm_md5_read_ctx (ctx, resbuf); + } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/histogram.c0000644000175000017500000002602711640407354017713 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Histograms. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include //#define HISTOGRAM_DEBUG pgm_slist_t* pgm_histograms = NULL; static void sample_set_accumulate (pgm_sample_set_t*, pgm_sample_t, pgm_count_t, unsigned); static pgm_count_t sample_set_total_count (const pgm_sample_set_t*) PGM_GNUC_PURE; static void set_bucket_range (pgm_histogram_t*, unsigned, pgm_sample_t); static void initialize_bucket_range (pgm_histogram_t*); static unsigned bucket_index (const pgm_histogram_t*, const pgm_sample_t); static void accumulate (pgm_histogram_t*, pgm_sample_t, pgm_count_t, unsigned); static double get_peak_bucket_size (const pgm_histogram_t*restrict, const pgm_sample_set_t*restrict); static double get_bucket_size (const pgm_histogram_t*, const pgm_count_t, const unsigned); static void pgm_histogram_write_html_graph (pgm_histogram_t*restrict, pgm_string_t*restrict); static void write_ascii (pgm_histogram_t*restrict, const char*restrict, pgm_string_t*restrict); static void write_ascii_header (pgm_histogram_t*restrict, pgm_sample_set_t*restrict, pgm_count_t, pgm_string_t*restrict); static void write_ascii_bucket_graph (double, double, pgm_string_t*); static void write_ascii_bucket_context (int64_t, pgm_count_t, int64_t, unsigned, pgm_string_t*); static void write_ascii_bucket_value (pgm_count_t, double, pgm_string_t*); static pgm_string_t* get_ascii_bucket_range (pgm_histogram_t*, unsigned); void pgm_histogram_add ( pgm_histogram_t* histogram, int value ) { if (value > INT_MAX) value = INT_MAX - 1; if (value < 0) value = 0; const unsigned i = bucket_index (histogram, value); pgm_assert_cmpint (value, >=, histogram->ranges[ i ]); pgm_assert_cmpint (value, <, histogram->ranges[ i + 1 ]); accumulate (histogram, value, 1, i); } void pgm_histogram_write_html_graph_all ( pgm_string_t* string ) { if (!pgm_histograms) return; pgm_slist_t* snapshot = pgm_histograms; while (snapshot) { pgm_histogram_t* histogram = snapshot->data; pgm_histogram_write_html_graph (histogram, string); snapshot = snapshot->next; } } static void pgm_histogram_write_html_graph ( pgm_histogram_t* restrict histogram, pgm_string_t* restrict string ) { pgm_string_append (string, "
");
	write_ascii (histogram, "
", string); pgm_string_append (string, "
"); } static void sample_set_accumulate ( pgm_sample_set_t* sample_set, pgm_sample_t value, pgm_count_t count, unsigned i ) { pgm_assert (1 == count || -1 == count); sample_set->counts[ i ] += count; sample_set->sum += count * value; sample_set->square_sum += (count * value) * (int64_t)value; pgm_assert_cmpint (sample_set->counts[ i ], >=, 0); pgm_assert_cmpint (sample_set->sum, >=, 0); pgm_assert_cmpint (sample_set->square_sum, >=, 0); } static pgm_count_t sample_set_total_count ( const pgm_sample_set_t* sample_set ) { pgm_count_t total = 0; for (unsigned i = 0; i < sample_set->counts_len; i++) total += sample_set->counts[ i ]; return total; } void pgm_histogram_init ( pgm_histogram_t* histogram ) { if (histogram->declared_min <= 0) histogram->declared_min = 1; pgm_assert_cmpint (histogram->declared_min, >, 0); histogram->declared_max = INT_MAX - 1; pgm_assert_cmpint (histogram->declared_min, <=, histogram->declared_max); pgm_assert_cmpuint (1, <, histogram->bucket_count); set_bucket_range (histogram, histogram->bucket_count, INT_MAX); initialize_bucket_range (histogram); /* register with global list */ histogram->histograms_link.data = histogram; histogram->histograms_link.next = pgm_histograms; pgm_histograms = &histogram->histograms_link; histogram->is_registered = TRUE; } static void set_bucket_range ( pgm_histogram_t* histogram, unsigned i, pgm_sample_t value ) { histogram->ranges[ i ] = value; } static void initialize_bucket_range ( pgm_histogram_t* histogram ) { const double log_max = log ((double)histogram->declared_max); double log_ratio; double log_next; unsigned i = 1; pgm_sample_t current = histogram->declared_min; set_bucket_range (histogram, i, current); while (histogram->bucket_count > ++i) { const double log_current = log ((double)current); log_ratio = (log_max - log_current) / (histogram->bucket_count - i); log_next = log_current + log_ratio; #ifdef __GNUC__ const int next = floor (exp (log_next) + 0.5); #else /* bad-function-cast warning in GCC */ const int next = (int)(floor (exp (log_next) + 0.5)); #endif if (next > current) current = next; else current++; set_bucket_range (histogram, i, current); } pgm_assert_cmpuint (histogram->bucket_count, ==, i); } static unsigned bucket_index ( const pgm_histogram_t* histogram, const pgm_sample_t value ) { pgm_assert_cmpint (histogram->ranges[0], <=, value); pgm_assert_cmpint (histogram->ranges[ histogram->bucket_count ], >, value); unsigned under = 0; unsigned over = histogram->bucket_count; unsigned mid; do { pgm_assert_cmpuint (over, >=, under); mid = ((unsigned)under + (unsigned)over) >> 1; if (mid == under) break; if (histogram->ranges[ mid ] <= value) under = mid; else over = mid; } while (TRUE); pgm_assert (histogram->ranges[ mid ] <= value && histogram->ranges[ mid + 1] > value); return mid; } static void accumulate ( pgm_histogram_t* histogram, pgm_sample_t value, pgm_count_t count, unsigned i ) { sample_set_accumulate (&histogram->sample, value, count, i); } static void write_ascii ( pgm_histogram_t* restrict histogram, const char* restrict newline, pgm_string_t* restrict output ) { pgm_count_t snapshot_counts[ histogram->sample.counts_len ]; pgm_sample_set_t snapshot = { .counts = snapshot_counts, .counts_len = histogram->sample.counts_len, .sum = histogram->sample.sum, .square_sum = histogram->sample.square_sum }; memcpy (snapshot_counts, histogram->sample.counts, sizeof(pgm_count_t) * histogram->sample.counts_len); pgm_count_t sample_count = sample_set_total_count (&snapshot); write_ascii_header (histogram, &snapshot, sample_count, output); pgm_string_append (output, newline); double max_size = get_peak_bucket_size (histogram, &snapshot); unsigned largest_non_empty_bucket = histogram->bucket_count - 1; while (0 == snapshot.counts[ largest_non_empty_bucket ]) { if (0 == largest_non_empty_bucket) break; largest_non_empty_bucket--; } int print_width = 1; for (unsigned i = 0; i < histogram->bucket_count; ++i) { if (snapshot.counts[ i ]) { pgm_string_t* bucket_range = get_ascii_bucket_range (histogram, i); const int width = (int)(bucket_range->len + 1); pgm_string_free (bucket_range, TRUE); if (width > print_width) print_width = width; } } int64_t remaining = sample_count; int64_t past = 0; for (unsigned i = 0; i < histogram->bucket_count; ++i) { pgm_count_t current = snapshot.counts[ i ]; remaining -= current; pgm_string_t* bucket_range = get_ascii_bucket_range (histogram, i); pgm_string_append_printf (output, "%*s ", print_width, bucket_range->str); pgm_string_free (bucket_range, TRUE); if (0 == current && i < histogram->bucket_count - 1 && 0 == snapshot.counts[ i + 1 ]) { while (i < histogram->bucket_count - 1 && 0 == snapshot.counts[ i + 1 ]) { i++; } pgm_string_append (output, "... "); pgm_string_append (output, newline); continue; } const double current_size = get_bucket_size (histogram, current, i); write_ascii_bucket_graph (current_size, max_size, output); write_ascii_bucket_context (past, current, remaining, i, output); pgm_string_append (output, newline); past += current; } } static void write_ascii_header ( pgm_histogram_t* restrict histogram, pgm_sample_set_t* restrict sample_set, pgm_count_t sample_count, pgm_string_t* restrict output ) { pgm_string_append_printf (output, "Histogram: %s recorded %d samples", histogram->histogram_name ? histogram->histogram_name : "(null)", sample_count); if (sample_count > 0) { const double average = (float)(sample_set->sum) / sample_count; const double variance = (float)(sample_set->square_sum) / sample_count - average * average; const double standard_deviation = sqrt (variance); pgm_string_append_printf (output, ", average = %.1f, standard deviation = %.1f", average, standard_deviation); } } static void write_ascii_bucket_graph ( double current_size, double max_size, pgm_string_t* output ) { static const int k_line_length = 72; int x_count = (int)(k_line_length * (current_size / max_size) + 0.5); int x_remainder = k_line_length - x_count; while (0 < x_count--) pgm_string_append_c (output, '-'); pgm_string_append_c (output, 'O'); while (0 < x_remainder--) pgm_string_append_c (output, ' '); } static void write_ascii_bucket_context ( int64_t past, pgm_count_t current, int64_t remaining, unsigned i, pgm_string_t* output ) { const double scaled_sum = (past + current + remaining) / 100.0; write_ascii_bucket_value (current, scaled_sum, output); if (0 < i) { const double percentage = past / scaled_sum; pgm_string_append_printf (output, " {%3.1f%%}", percentage); } } static void write_ascii_bucket_value ( pgm_count_t current, double scaled_sum, pgm_string_t* output ) { pgm_string_append_printf (output, " (%d = %3.1f%%)", current, current/scaled_sum); } static double get_peak_bucket_size ( const pgm_histogram_t* restrict histogram, const pgm_sample_set_t* restrict sample_set ) { double max_size = 0; for (unsigned i = 0; i < histogram->bucket_count; i++) { const double current_size = get_bucket_size (histogram, sample_set->counts[ i ], i); if (current_size > max_size) max_size = current_size; } return max_size; } static double get_bucket_size ( const pgm_histogram_t* histogram, const pgm_count_t current, const unsigned i ) { pgm_assert_cmpint (histogram->ranges[ i + 1 ], >, histogram->ranges[ i ]); static const double kTransitionWidth = 5; double denominator = histogram->ranges[ i + 1 ] - histogram->ranges[ i ]; if (denominator > kTransitionWidth) denominator = kTransitionWidth; return current / denominator; } static pgm_string_t* get_ascii_bucket_range ( pgm_histogram_t* histogram, unsigned i ) { pgm_string_t* result = pgm_string_new (NULL); pgm_string_printf (result, "%d", histogram->ranges[ i ]); return result; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/snmp_unittest.c0000644000175000017500000000721411640407354020627 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for SNMP. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "impl/framework.h" /* mock state */ static pgm_rwlock_t mock_pgm_sock_list_lock; static pgm_slist_t* mock_pgm_sock_list; PGM_GNUC_INTERNAL bool mock_pgm_mib_init ( pgm_error_t** error ) { return TRUE; } /* mock functions for external references */ #define pgm_sock_list_lock mock_pgm_sock_list_lock #define pgm_sock_list mock_pgm_sock_list #define pgm_mib_init mock_pgm_mib_init #define SNMP_DEBUG #include "snmp.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * bool * pgm_snmp_init ( * pgm_error_t** error * ) */ START_TEST (test_init_pass_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_snmp_init (&err), "init failed"); fail_unless (NULL == err, "init failed"); } END_TEST /* duplicate servers */ START_TEST (test_init_fail_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_snmp_init (&err), "init failed"); /* reference counting means this now passes */ fail_unless (TRUE == pgm_snmp_init (&err), "init failed"); } END_TEST /* target: * bool * pgm_snmp_shutdown (void) */ START_TEST (test_shutdown_pass_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_snmp_init (&err), "init failed"); fail_unless (NULL == err, "init failed"); fail_unless (TRUE == pgm_snmp_shutdown (), "shutdown failed"); } END_TEST /* repeatability */ START_TEST (test_shutdown_pass_002) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_snmp_init (&err), "init failed"); fail_unless (NULL == err, "init failed"); fail_unless (TRUE == pgm_snmp_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_snmp_init (&err), "init failed"); fail_unless (NULL == err, "init failed"); fail_unless (TRUE == pgm_snmp_shutdown (), "shutdown failed"); } END_TEST /* no running server */ START_TEST (test_shutdown_fail_001) { fail_unless (FALSE == pgm_snmp_shutdown (), "shutdown failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_init = tcase_create ("init"); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_init_pass_001); tcase_add_test (tc_init, test_init_fail_001); TCase* tc_shutdown = tcase_create ("shutdown"); suite_add_tcase (s, tc_shutdown); tcase_add_test (tc_shutdown, test_shutdown_pass_001); tcase_add_test (tc_shutdown, test_shutdown_pass_002); tcase_add_test (tc_shutdown, test_shutdown_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/bootstrap.sh0000755000175000017500000000454611640407354020130 0ustar locallocal#!/bin/sh # ---------------------------------------------------------------------- # Globals # ---------------------------------------------------------------------- DIE=0 ELINES=3 # ---------------------------------------------------------------------- # Color settings # ---------------------------------------------------------------------- B=`tput bold 2>/dev/null` N=`tput sgr0 2>/dev/null` ERROR="${B}** エラー **${N}" WARNING="${B}* 警告 *${N}" # ---------------------------------------------------------------------- # Functions # ---------------------------------------------------------------------- CHECK() { for PROG in $* do VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"` if test \! -z "$VERSION" then echo "${PROG} ${VERSION} を使用する" USE_PROG=$PROG break fi done if test -z "VERSION" then echo echo "${ERROR} : お使いのシステムにインストールされている「${B}${PROG}${N}」を持っている必要があります。" echo DIE=1 fi } CHECK_WARN() { for PROG in $* do VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"` if test \! -z "$VERSION" then echo "${PROG} ${VERSION} を使用する" USE_PROG=$PROG break fi done if test -z "VERSION" then echo echo "${WARNING} : お使いのシステムにインストールされている「${B}${PROG}${N}」が必要な場合があります。" echo fi } RUN() { PROG=$1; shift ARGS=$* echo "${B}${PROG}${N} を実行している..." $PROG $ARGS 2>> bootstrap.log if test $? -ne 0 then echo echo "${ERROR}" tail -$ELINES bootstrap.log echo echo "ブートストラップスクリプト中止(詳細については、bootstrap.log を参照してください)..." exit 1 fi } # # Check availability of build tools # echo echo "${B}ビルド環境をチェックする${N}..." CHECK libtoolize glibtoolize; LIBTOOLIZE=$USE_PROG CHECK aclocal CHECK automake CHECK autoconf if test "$DIE" -eq 1 then echo echo "ブートストラップスクリプト中止..." exit 1 fi # # Generate the build scripts # > bootstrap.log echo echo "${B}ビルドスクリプトを生成する${N}..." RUN $LIBTOOLIZE --force --copy RUN aclocal RUN automake --copy --add-missing RUN autoconf echo echo "ブートストラップスクリプトが正常に完了しました。" exit 0 libpgm-5.1.118-1~dfsg/openpgm/pgm/packet_test.c.c89.patch0000644000175000017500000002032711640407354021721 0ustar locallocal--- packet_test.c 2011-03-12 10:49:51.000000000 +0800 +++ packet_test.c89.c 2011-03-12 10:50:03.000000000 +0800 @@ -62,11 +62,12 @@ if (len < (sizeof(struct pgm_ip) + sizeof(struct pgm_header))) { printf ("Packet size too small: %" PRIzu " bytes, expecting at least %" PRIzu " bytes.\n", - len, sizeof(struct pgm_ip) + sizeof(struct pgm_header)); + (unsigned long)len, (unsigned long)(sizeof(struct pgm_ip) + sizeof(struct pgm_header))); return FALSE; } /* decode IP header */ + { const struct pgm_ip* ip = (const struct pgm_ip*)data; if (ip->ip_v != 4) /* IP version, 4 or 6 */ { @@ -75,6 +76,7 @@ } printf ("IP "); + { const size_t ip_header_length = ip->ip_hl * 4; /* IP header length in 32bit octets */ if (ip_header_length < sizeof(struct pgm_ip)) { @@ -82,6 +84,7 @@ return FALSE; } + { size_t packet_length = ntohs(ip->ip_len); /* total packet length */ /* ip_len can equal packet_length - ip_header_length in FreeBSD/NetBSD @@ -104,6 +107,7 @@ return FALSE; } + { const uint16_t offset = ntohs(ip->ip_off); /* 3 bits routing priority, 4 bits type of service: delay, throughput, reliability, cost */ @@ -130,7 +134,7 @@ (offset & 0x1fff) * 8, ((offset & IP_DF) ? "DF" : ""), ((offset & IP_MF) ? "+" : "")); - printf (", length %" PRIzu "", packet_length); + printf (", length %" PRIzu "", (unsigned long)packet_length); /* IP options */ if ((ip_header_length - sizeof(struct pgm_ip)) > 0) { @@ -141,6 +145,7 @@ /* packets that fail checksum will generally not be passed upstream except with rfc3828 */ + { const uint16_t ip_sum = pgm_inet_checksum(data, (uint16_t)packet_length, 0); if (ip_sum != 0) { const uint16_t encoded_ip_sum = ntohs(ip->ip_sum); @@ -171,6 +176,7 @@ * | Type specific data ... * +-+-+-+-+-+-+-+-+-+- ... */ + { const struct pgm_header* pgm_header = (const struct pgm_header*)((const char*)data + ip_header_length); const size_t pgm_length = packet_length - ip_header_length; @@ -222,6 +228,7 @@ } /* now decode PGM packet types */ + { const void* pgm_data = pgm_header + 1; const size_t pgm_data_length = pgm_length - sizeof(pgm_header); /* can equal zero for SPMR's */ @@ -241,6 +248,13 @@ } return err; + } + } + } + } + } + } + } } /* 8.1. Source Path Messages (SPM) @@ -288,6 +302,7 @@ return FALSE; } + { const struct pgm_spm * spm = (const struct pgm_spm *)data; const struct pgm_spm6* spm6 = (const struct pgm_spm6*)data; const uint16_t spm_nla_afi = ntohs (spm->spm_nla_afi); @@ -298,6 +313,7 @@ ntohl(spm->spm_lead), spm_nla_afi); /* address family indicator */ + { char s[INET6_ADDRSTRLEN]; const void* pgm_opt; size_t pgm_opt_len; @@ -335,6 +351,8 @@ printf ("\n"); return TRUE; + } + } } /* 14.7.1. Poll Request @@ -384,6 +402,7 @@ return FALSE; } + { const struct pgm_poll * poll4 = (const struct pgm_poll *)data; const struct pgm_poll6* poll6 = (const struct pgm_poll6*)data; const uint16_t poll_nla_afi = ntohs (poll4->poll_nla_afi); @@ -394,6 +413,7 @@ ntohs(poll4->poll_s_type), poll_nla_afi); /* address family indicator */ + { char s[INET6_ADDRSTRLEN]; const void* pgm_opt; size_t pgm_opt_len; @@ -458,6 +478,8 @@ printf ("\n"); return TRUE; + } + } } /* 14.7.2. Poll Response @@ -493,12 +515,14 @@ return FALSE; } + { const struct pgm_polr* polr = (const struct pgm_polr*)data; printf("sqn %" PRIu32 " round %u", ntohl(polr->polr_sqn), ntohs(polr->polr_round)); + { const void* pgm_opt = (const uint8_t*)data + sizeof(struct pgm_polr); size_t pgm_opt_len = len - sizeof(struct pgm_polr); @@ -511,6 +535,8 @@ printf ("\n"); return TRUE; + } + } } /* 8.2. Data Packet @@ -548,6 +574,7 @@ return FALSE; } + { const struct pgm_data* odata = (const struct pgm_data*)data; printf ("sqn %" PRIu32 " trail %" PRIu32 " [", @@ -555,6 +582,7 @@ ntohl(odata->data_trail)); /* option extensions */ + { const void* pgm_opt = (const uint8_t*)data + sizeof(struct pgm_data); size_t pgm_opt_len = len - sizeof(struct pgm_data); const char* payload = pgm_opt; @@ -567,6 +595,7 @@ } /* data */ + { const char* end = payload + ntohs (header->pgm_tsdu_length); while (payload < end) { if (isprint (*payload)) @@ -578,6 +607,9 @@ printf ("]\n"); return TRUE; + } + } + } } /* 8.2. Repair Data @@ -603,6 +635,7 @@ return FALSE; } + { const struct pgm_data* rdata = (const struct pgm_data*)data; printf ("sqn %" PRIu32 " trail %" PRIu32 " [", @@ -610,6 +643,7 @@ ntohl (rdata->data_trail)); /* option extensions */ + { const void* pgm_opt = (const uint8_t*)data + sizeof(struct pgm_data); size_t pgm_opt_len = len - sizeof(struct pgm_data); const char* payload = pgm_opt; @@ -622,6 +656,7 @@ } /* data */ + { const char* end = payload + ntohs (header->pgm_tsdu_length); while (payload < end) { if (isprint (*payload)) @@ -633,6 +668,9 @@ printf ("]\n"); return TRUE; + } + } + } } /* 8.3. NAK @@ -681,6 +719,7 @@ return FALSE; } + { const struct pgm_nak * nak = (const struct pgm_nak *)data; const struct pgm_nak6* nak6 = (const struct pgm_nak6*)data; const uint16_t nak_src_nla_afi = ntohs (nak->nak_src_nla_afi); @@ -688,6 +727,7 @@ printf ("sqn %" PRIu32 " src ", ntohl(nak->nak_sqn)); + { char s[INET6_ADDRSTRLEN]; const void* pgm_opt; size_t pgm_opt_len; @@ -717,6 +757,7 @@ return FALSE; } + { const uint16_t nak_grp_nla_afi = ntohs (nak6->nak6_grp_nla_afi); if (nak_src_nla_afi != nak_grp_nla_afi) { puts ("different source & group afi very wibbly wobbly :("); @@ -731,6 +772,7 @@ pgm_inet_ntop (AF_INET6, &nak6->nak6_grp_nla, s, sizeof(s)); printf ("%s", s); break; + } } default: @@ -748,6 +790,8 @@ printf ("\n"); return TRUE; + } + } } /* 8.3. N-NAK @@ -869,11 +913,15 @@ printf ("ACK: "); + { const struct pgm_ack* ack = (const struct pgm_ack*)data; char bitmap[33]; - for (unsigned i = 31; i; i--) + { + unsigned i; + for (i = 31; i; i--) bitmap[i] = (ack->ack_bitmap & (1 << i)) ? '1' : '0'; + } bitmap[32] = '\0'; printf ("rx_max %" PRIu32 " bitmap [%s] ", @@ -888,6 +936,7 @@ printf ("\n"); return TRUE; + } } @@ -913,12 +962,14 @@ return -1; } + { const struct pgm_opt_length* opt_len = (const struct pgm_opt_length*)data; if (opt_len->opt_length != sizeof(struct pgm_opt_length)) { printf (" bad opt_length length %u\n", (unsigned)opt_len->opt_length); return -1; } + { uint16_t opt_total_length = ntohs (opt_len->opt_total_length); printf (" total len %u ", opt_total_length); if (opt_total_length < (sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header)) || @@ -930,6 +981,7 @@ /* total length includes opt_length option */ opt_total_length -= sizeof(struct pgm_opt_length); + { const struct pgm_opt_header* opt_header = (const struct pgm_opt_header*)(opt_len + 1); /* iterate through options (max 16) */ @@ -1033,6 +1085,9 @@ } return ((const uint8_t*)opt_header - (const uint8_t*)data); + } + } + } } PGM_GNUC_INTERNAL @@ -1072,12 +1127,14 @@ services = pgm_hashtable_new (pgm_int_hash, pgm_int_equal); } + { const int hash_key = port; void* service_string = pgm_hashtable_lookup (services, &hash_key); if (service_string != NULL) { return service_string; } + { struct servent* se = getservbyport (port, "udp"); if (se == NULL) { char buf[sizeof("00000")]; @@ -1088,6 +1145,8 @@ } pgm_hashtable_insert (services, &hash_key, service_string); return service_string; + } + } } PGM_GNUC_INTERNAL @@ -1102,12 +1161,14 @@ hosts = pgm_hashtable_new (pgm_str_hash, pgm_int_equal); } + { const int hash_key = (int)ap->s_addr; void* host_string = pgm_hashtable_lookup (hosts, &hash_key); if (host_string != NULL) { return host_string; } + { struct hostent* he = gethostbyaddr((const char*)ap, sizeof(struct in_addr), AF_INET); if (he == NULL) { struct in_addr in; @@ -1118,6 +1179,8 @@ } pgm_hashtable_insert (hosts, &hash_key, host_string); return host_string; + } + } } PGM_GNUC_INTERNAL @@ -1130,6 +1193,7 @@ /* pre-conditions */ pgm_assert (NULL != ipopt); + { const char* op = ipopt; while (length) @@ -1157,6 +1221,7 @@ op += len; length -= len; } + } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/indextoaddr_unittest.c0000644000175000017500000002060311640407354022154 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for portable interface index to socket address function. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* IFF_UP */ #define _BSD_SOURCE 1 #include #include #include #include #include #ifndef _WIN32 # include # include # include # include # include # include #else # include # include #endif #include #include #include #include /* mock state */ struct mock_interface_t { unsigned int index; char* name; unsigned int flags; struct sockaddr_storage addr; struct sockaddr_storage netmask; }; static GList *mock_interfaces = NULL; struct pgm_ifaddrs_t; struct pgm_error_t; static bool mock_pgm_getifaddrs (struct pgm_ifaddrs_t**, struct pgm_error_t**); static void mock_pgm_freeifaddrs (struct pgm_ifaddrs_t*); unsigned mock_pgm_if_nametoindex (const sa_family_t, const char*); #define pgm_getifaddrs mock_pgm_getifaddrs #define pgm_freeifaddrs mock_pgm_freeifaddrs #define pgm_if_nametoindex mock_pgm_if_nametoindex #define INDEXTOADDR_DEBUG #include "indextoaddr.c" static gpointer create_interface ( const unsigned index, const char* name, const char* flags ) { struct mock_interface_t* new_interface; g_assert (name); g_assert (flags); new_interface = g_slice_alloc0 (sizeof(struct mock_interface_t)); new_interface->index = index; new_interface->name = g_strdup (name); struct sockaddr_in* sin = (gpointer)&new_interface->addr; struct sockaddr_in6* sin6 = (gpointer)&new_interface->addr; gchar** tokens = g_strsplit (flags, ",", 0); for (guint i = 0; tokens[i]; i++) { if (strcmp (tokens[i], "up") == 0) new_interface->flags |= IFF_UP; else if (strcmp (tokens[i], "down") == 0) new_interface->flags |= 0; else if (strcmp (tokens[i], "loop") == 0) new_interface->flags |= IFF_LOOPBACK; else if (strcmp (tokens[i], "broadcast") == 0) new_interface->flags |= IFF_BROADCAST; else if (strcmp (tokens[i], "multicast") == 0) new_interface->flags |= IFF_MULTICAST; else if (strncmp (tokens[i], "ip=", strlen("ip=")) == 0) { const char* addr = tokens[i] + strlen("ip="); g_assert (pgm_sockaddr_pton (addr, (struct sockaddr*)&new_interface->addr)); } else if (strncmp (tokens[i], "netmask=", strlen("netmask=")) == 0) { const char* addr = tokens[i] + strlen("netmask="); g_assert (pgm_sockaddr_pton (addr, (struct sockaddr*)&new_interface->netmask)); } else if (strncmp (tokens[i], "scope=", strlen("scope=")) == 0) { const char* scope = tokens[i] + strlen("scope="); g_assert (AF_INET6 == ((struct sockaddr*)&new_interface->addr)->sa_family); ((struct sockaddr_in6*)&new_interface->addr)->sin6_scope_id = atoi (scope); } else g_error ("parsing failed for flag \"%s\"", tokens[i]); } g_strfreev (tokens); return new_interface; } #define APPEND_INTERFACE(a,b,c) \ do { \ gpointer data = create_interface ((a), (b), (c)); \ g_assert (data); \ mock_interfaces = g_list_append (mock_interfaces, data); \ g_assert (mock_interfaces); g_assert (mock_interfaces->data); \ } while (0) static void mock_setup_net (void) { APPEND_INTERFACE( 1, "lo", "up,loop"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast"); APPEND_INTERFACE( 3, "eth1", "down,broadcast,multicast"); APPEND_INTERFACE( 1, "lo", "up,loop,ip=127.0.0.1,netmask=255.0.0.0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=10.6.28.33,netmask=255.255.255.0"); APPEND_INTERFACE( 1, "lo", "up,loop,ip=::1,netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,scope=0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=2002:dce8:d28e::33,netmask=ffff:ffff:ffff:ffff::0,scope=0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=fe80::214:5eff:febd:6dda,netmask=ffff:ffff:ffff:ffff::0,scope=2"); } static void mock_teardown_net (void) { GList* list; list = mock_interfaces; while (list) { struct mock_interface_t* interface_ = list->data; g_free (interface_->name); g_slice_free1 (sizeof(struct mock_interface_t), interface_); list = list->next; } g_list_free (mock_interfaces); } /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } bool mock_pgm_getifaddrs ( struct pgm_ifaddrs_t** ifap, pgm_error_t** err ) { if (NULL == ifap) { return FALSE; } g_debug ("mock_getifaddrs (ifap:%p err:%p)", (gpointer)ifap, (gpointer)err); GList* list = mock_interfaces; int n = g_list_length (list); struct pgm_ifaddrs_t* ifa = calloc (n, sizeof(struct pgm_ifaddrs_t)); struct pgm_ifaddrs_t* ift = ifa; while (list) { struct mock_interface_t* interface_ = list->data; ift->ifa_addr = (gpointer)&interface_->addr; ift->ifa_name = interface_->name; ift->ifa_flags = interface_->flags; ift->ifa_netmask = (gpointer)&interface_->netmask; list = list->next; if (list) { ift->ifa_next = ift + 1; ift = ift->ifa_next; } } *ifap = ifa; return TRUE; } static void mock_pgm_freeifaddrs ( struct pgm_ifaddrs_t* ifa ) { g_debug ("mock_freeifaddrs (ifa:%p)", (gpointer)ifa); free (ifa); } PGM_GNUC_INTERNAL unsigned mock_pgm_if_nametoindex ( const sa_family_t iffamily, const char* ifname ) { GList* list = mock_interfaces; while (list) { const struct mock_interface_t* interface_ = list->data; if (0 == strcmp (ifname, interface_->name)) return interface_->index; list = list->next; } return 0; } /* target: * bool * pgm_if_indextoaddr ( * const unsigned ifindex, * const sa_family_t iffamily, * const uint32_t ifscope, * struct sockaddr* ifsa, * pgm_error_t** error * ) */ START_TEST (test_indextoaddr_pass_001) { char saddr[INET6_ADDRSTRLEN]; struct sockaddr_storage addr; pgm_error_t* err = NULL; const unsigned int ifindex = 2; fail_unless (TRUE == pgm_if_indextoaddr (ifindex, AF_INET, 0, (struct sockaddr*)&addr, &err), "if_indextoaddr failed"); pgm_sockaddr_ntop ((struct sockaddr*)&addr, saddr, sizeof(saddr)); g_message ("index:%d -> %s", ifindex, saddr); fail_unless (TRUE == pgm_if_indextoaddr (ifindex, AF_INET6, 0, (struct sockaddr*)&addr, &err), "if_indextoaddr failed"); pgm_sockaddr_ntop ((struct sockaddr*)&addr, saddr, sizeof(saddr)); g_message ("index:%d -> %s", ifindex, saddr); } END_TEST START_TEST (test_indextoaddr_fail_001) { pgm_error_t* err = NULL; fail_unless (FALSE == pgm_if_indextoaddr (0, 0, 0, NULL, &err), "if_indextoaddr failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_indextoaddr = tcase_create ("init-ctx"); suite_add_tcase (s, tc_indextoaddr); tcase_add_checked_fixture (tc_indextoaddr, mock_setup_net, mock_teardown_net); tcase_add_test (tc_indextoaddr, test_indextoaddr_pass_001); tcase_add_test (tc_indextoaddr, test_indextoaddr_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/config.guess0000755000175000017500000012626011640410455020066 0ustar locallocal#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-07-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[3456]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[3456]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libpgm-5.1.118-1~dfsg/openpgm/pgm/receiver_unittest.c0000644000175000017500000005451711640407354021466 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM receiver transport. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ #define TEST_NETWORK "" #define TEST_PORT 7500 #define TEST_MAX_TPDU 1500 #define TEST_TXW_SQNS 32 #define TEST_RXW_SQNS 32 #define TEST_HOPS 16 #define TEST_SPM_AMBIENT ( pgm_secs(30) ) #define TEST_SPM_HEARTBEAT_INIT { pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(1300), pgm_secs(7), pgm_secs(16), pgm_secs(25), pgm_secs(30) } #define TEST_PEER_EXPIRY ( pgm_secs(300) ) #define TEST_SPMR_EXPIRY ( pgm_msecs(250) ) #define TEST_NAK_BO_IVL ( pgm_msecs(50) ) #define TEST_NAK_RPT_IVL ( pgm_secs(2) ) #define TEST_NAK_RDATA_IVL ( pgm_secs(2) ) #define TEST_NAK_DATA_RETRIES 5 #define TEST_NAK_NCF_RETRIES 2 #define pgm_histogram_add mock_pgm_histogram_add #define pgm_verify_spm mock_pgm_verify_spm #define pgm_verify_nak mock_pgm_verify_nak #define pgm_verify_ncf mock_pgm_verify_ncf #define pgm_verify_poll mock_pgm_verify_poll #define pgm_sendto_hops mock_pgm_sendto_hops #define pgm_time_now mock_pgm_time_now #define pgm_time_update_now mock_pgm_time_update_now #define pgm_rxw_destroy mock_pgm_rxw_destroy #define pgm_rxw_create mock_pgm_rxw_create #define pgm_rxw_update mock_pgm_rxw_update #define pgm_rxw_update_fec mock_pgm_rxw_update_fec #define pgm_rxw_confirm mock_pgm_rxw_confirm #define pgm_rxw_lost mock_pgm_rxw_lost #define pgm_rxw_state mock_pgm_rxw_state #define pgm_rxw_add mock_pgm_rxw_add #define pgm_rxw_remove_commit mock_pgm_rxw_remove_commit #define pgm_rxw_readv mock_pgm_rxw_readv #define pgm_csum_fold mock_pgm_csum_fold #define pgm_compat_csum_partial mock_pgm_compat_csum_partial #define pgm_histogram_init mock_pgm_histogram_init #define pgm_setsockopt mock_pgm_setsockopt #define RECEIVER_DEBUG #include "receiver.c" static void mock_setup (void) { if (!g_thread_supported ()) g_thread_init (NULL); } static struct pgm_sock_t* generate_sock (void) { struct pgm_sock_t* sock = g_malloc0 (sizeof(struct pgm_sock_t)); return sock; } static pgm_peer_t* generate_peer (void) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_peer_t* peer = g_malloc0 (sizeof(pgm_peer_t)); peer->window = g_malloc0 (sizeof(pgm_rxw_t)); pgm_atomic_inc32 (&peer->ref_count); return peer; } /** socket module */ static int mock_pgm_poll_info ( pgm_sock_t* const sock, struct pollfd* fds, int* n_fds, int events ) { } static gboolean mock_pgm_on_nak ( pgm_sock_t* const sock, struct pgm_sk_buff_t* const skb ) { return TRUE; } static gboolean mock_pgm_on_nnak ( pgm_sock_t* const sock, struct pgm_sk_buff_t* const skb ) { return TRUE; } static gboolean mock_pgm_on_spmr ( pgm_sock_t* const sock, pgm_peer_t* const peer, struct pgm_sk_buff_t* const skb ) { return TRUE; } /** net module */ PGM_GNUC_INTERNAL ssize_t mock_pgm_sendto_hops ( pgm_sock_t* sock, bool use_rate_limit, pgm_rate_t* minor_rate_control, bool use_router_alert, int hops, const void* buf, size_t len, const struct sockaddr* to, socklen_t tolen ) { return len; } /** time module */ static pgm_time_t mock_pgm_time_now = 0x1; static pgm_time_t _mock_pgm_time_update_now (void); pgm_time_update_func mock_pgm_time_update_now = _mock_pgm_time_update_now; pgm_time_t _mock_pgm_time_update_now (void) { return mock_pgm_time_now; } /* packet module */ bool mock_pgm_verify_spm ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } bool mock_pgm_verify_nak ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } bool mock_pgm_verify_ncf ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } bool mock_pgm_verify_poll ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } /* receive window module */ pgm_rxw_t* mock_pgm_rxw_create ( const pgm_tsi_t* tsi, const uint16_t tpdu_size, const unsigned sqns, const unsigned secs, const ssize_t max_rte, const uint32_t ack_c_p ) { return g_malloc0 (sizeof(pgm_rxw_t)); } void mock_pgm_rxw_destroy ( pgm_rxw_t* const window ) { g_assert (NULL != window); g_free (window); } int mock_pgm_rxw_confirm ( pgm_rxw_t* const window, const uint32_t sequence, const pgm_time_t now, const pgm_time_t nak_rdata_expiry, const pgm_time_t nak_rb_expiry ) { return PGM_RXW_DUPLICATE; } void mock_pgm_rxw_lost ( pgm_rxw_t* const window, const uint32_t sequence ) { } void mock_pgm_rxw_state ( pgm_rxw_t* const window, struct pgm_sk_buff_t* const skb, const int new_state ) { } unsigned mock_pgm_rxw_update ( pgm_rxw_t* const window, const uint32_t txw_lead, const uint32_t txw_trail, const pgm_time_t now, const pgm_time_t nak_rb_expiry ) { return 0; } void mock_pgm_rxw_update_fec ( pgm_rxw_t* const window, const uint8_t rs_k ) { } int mock_pgm_rxw_add ( pgm_rxw_t* const window, struct pgm_sk_buff_t* const skb, const pgm_time_t now, const pgm_time_t nak_rb_expiry ) { return PGM_RXW_APPENDED; } void mock_pgm_rxw_remove_commit ( pgm_rxw_t* const window ) { } ssize_t mock_pgm_rxw_readv ( pgm_rxw_t* const window, struct pgm_msgv_t** pmsg, const unsigned pmsglen ) { return 0; } /* checksum module */ uint16_t mock_pgm_csum_fold ( uint32_t csum ) { return 0x0; } uint32_t mock_pgm_compat_csum_partial ( const void* addr, uint16_t len, uint32_t csum ) { return 0x0; } void mock_pgm_histogram_init ( pgm_histogram_t* histogram ) { } void mock_pgm_histogram_add ( pgm_histogram_t* histogram, int value ) { } /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } bool mock_pgm_setsockopt ( pgm_sock_t* const sock, const int level, const int optname, const void* optval, const socklen_t optlen ) { if (NULL == sock) return FALSE; return TRUE; } /* target: * void * pgm_peer_unref ( * pgm_peer_t* peer * ) */ /* last ref */ START_TEST (test_peer_unref_pass_001) { pgm_peer_t* peer = generate_peer(); pgm_peer_unref (peer); } END_TEST /* non-last ref */ START_TEST (test_peer_unref_pass_002) { pgm_peer_t* peer = _pgm_peer_ref (generate_peer()); pgm_peer_unref (peer); } END_TEST START_TEST (test_peer_unref_fail_001) { pgm_peer_unref (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_check_peer_state ( * pgm_sock_t* sock, * const pgm_time_t now * ) */ START_TEST (test_check_peer_state_pass_001) { pgm_sock_t* sock = generate_sock(); sock->is_bound = TRUE; pgm_check_peer_state (sock, mock_pgm_time_now); } END_TEST START_TEST (test_check_peer_state_fail_001) { pgm_check_peer_state (NULL, mock_pgm_time_now); fail ("reached"); } END_TEST /* target: * pgm_time_t * pgm_min_receiver_expiry ( * pgm_sock_t* sock, * pgm_time_t expiration * ) */ START_TEST (test_min_receiver_expiry_pass_001) { pgm_sock_t* sock = generate_sock(); sock->is_bound = TRUE; const pgm_time_t expiration = pgm_secs(1); pgm_time_t next_expiration = pgm_min_receiver_expiry (sock, expiration); } END_TEST START_TEST (test_min_receiver_expiry_fail_001) { const pgm_time_t expiration = pgm_secs(1); pgm_min_receiver_expiry (NULL, expiration); fail ("reached"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_RXW_SQNS, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_rxw_sqns_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_RXW_SQNS; const int rxw_sqns = 100; const void* optval = &rxw_sqns; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_rxw_sqns failed"); } END_TEST START_TEST (test_set_rxw_sqns_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_RXW_SQNS; const int rxw_sqns = 100; const void* optval = &rxw_sqns; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_rxw_sqns failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_RXW_SECS, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_rxw_secs_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_RXW_SECS; const int rxw_secs = 10; const void* optval = &rxw_secs; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_rxw_secs failed"); } END_TEST START_TEST (test_set_rxw_secs_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_RXW_SECS; const int rxw_secs = 10; const void* optval = &rxw_secs; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_rxw_secs failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_RXW_MAX_RTE, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_rxw_max_rte_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_RXW_MAX_RTE; const int rxw_max_rte = 100*1000; const void* optval = &rxw_max_rte; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_rxw_max_rte failed"); } END_TEST START_TEST (test_set_rxw_max_rte_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_RXW_MAX_RTE; const int rxw_max_rte = 100*1000; const void* optval = &rxw_max_rte; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_rxw_max_rte failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_PEER_EXPIRY, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_peer_expiry_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_PEER_EXPIRY; const int peer_expiry = pgm_secs(100); const void* optval = &peer_expiry; const socklen_t optlen = sizeof(int); /* pre-checking should verify value to spm ambient interval sock->spm_ambient_interval = pgm_secs(30); */ fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_peer_expiry failed"); } END_TEST START_TEST (test_set_peer_expiry_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_PEER_EXPIRY; const int peer_expiry = pgm_secs(100); const void* optval = &peer_expiry; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_peer_expiry failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_SPMR_EXPIRY, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_spmr_expiry_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_SPMR_EXPIRY; const int spmr_expiry = pgm_secs(10); const void* optval = &spmr_expiry; const socklen_t optlen = sizeof(int); /* pre-checking should verify value to spm ambient interval sock->spm_ambient_interval = pgm_secs(30); */ fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_spmr_expiry failed"); } END_TEST START_TEST (test_set_spmr_expiry_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_SPMR_EXPIRY; const int spmr_expiry = pgm_secs(10); const void* optval = &spmr_expiry; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_spmr_expiry failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_NAK_BO_IVL, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_nak_bo_ivl_pass_001) { const int level = IPPROTO_PGM; pgm_sock_t* sock = generate_sock (); const int optname = PGM_NAK_BO_IVL; const int nak_bo_ivl = pgm_msecs(1000); const void* optval = &nak_bo_ivl; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_nak_bo_ivl failed"); } END_TEST START_TEST (test_set_nak_bo_ivl_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NAK_BO_IVL; const int nak_bo_ivl = pgm_msecs(1000); const void* optval = &nak_bo_ivl; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_nak_bo_ivl failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_NAK_RPT_IVL, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_nak_rpt_ivl_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_NAK_RPT_IVL; const int nak_rpt_ivl = pgm_msecs(1000); const void* optval = &nak_rpt_ivl; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_nak_rpt_ivl failed"); } END_TEST START_TEST (test_set_nak_rpt_ivl_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NAK_RPT_IVL; const int nak_rpt_ivl = pgm_msecs(1000); const void* optval = &nak_rpt_ivl; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_nak_rpt_ivl failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_NAK_RDATA_IVL, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_nak_rdata_ivl_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_NAK_RDATA_IVL; const int nak_rdata_ivl = pgm_msecs(1000); const void* optval = &nak_rdata_ivl; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_nak_rdata_ivl failed"); } END_TEST START_TEST (test_set_nak_rdata_ivl_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NAK_RDATA_IVL; const int nak_rdata_ivl = pgm_msecs(1000); const void* optval = &nak_rdata_ivl; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_nak_rdata_ivl failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_NAK_DATA_RETRIES, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_nak_data_retries_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_NAK_DATA_RETRIES; const int retries = 1000; const void* optval = &retries; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_nak_data_retries failed"); } END_TEST START_TEST (test_set_nak_data_retries_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NAK_DATA_RETRIES; const int retries = 1000; const void* optval = &retries; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_nak_data_retries failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_NAK_NCF_RETRIES, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_nak_ncf_retries_pass_001) { pgm_sock_t* sock = generate_sock (); const int level = IPPROTO_PGM; const int optname = PGM_NAK_NCF_RETRIES; const int retries = 1000; const void* optval = &retries; const socklen_t optlen = sizeof(int); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_ncf_data_retries failed"); } END_TEST START_TEST (test_set_nak_ncf_retries_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_NAK_NCF_RETRIES; const int retries = 1000; const void* optval = &retries; const socklen_t optlen = sizeof(int); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_ncf_data_retries failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_peer_unref = tcase_create ("peer_unref"); suite_add_tcase (s, tc_peer_unref); tcase_add_checked_fixture (tc_peer_unref, mock_setup, NULL); tcase_add_test (tc_peer_unref, test_peer_unref_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_peer_unref, test_peer_unref_fail_001, SIGABRT); #endif /* formally check-peer-nak-state */ TCase* tc_check_peer_state = tcase_create ("check-peer-state"); suite_add_tcase (s, tc_check_peer_state); tcase_add_checked_fixture (tc_check_peer_state, mock_setup, NULL); tcase_add_test (tc_check_peer_state, test_check_peer_state_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_check_peer_state, test_check_peer_state_fail_001, SIGABRT); #endif /* formally min-nak-expiry */ TCase* tc_min_receiver_expiry = tcase_create ("min-receiver-expiry"); suite_add_tcase (s, tc_min_receiver_expiry); tcase_add_checked_fixture (tc_min_receiver_expiry, mock_setup, NULL); tcase_add_test (tc_min_receiver_expiry, test_min_receiver_expiry_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_min_receiver_expiry, test_min_receiver_expiry_fail_001, SIGABRT); #endif TCase* tc_set_rxw_sqns = tcase_create ("set-rxw_sqns"); suite_add_tcase (s, tc_set_rxw_sqns); tcase_add_checked_fixture (tc_set_rxw_sqns, mock_setup, NULL); tcase_add_test (tc_set_rxw_sqns, test_set_rxw_sqns_pass_001); tcase_add_test (tc_set_rxw_sqns, test_set_rxw_sqns_fail_001); TCase* tc_set_rxw_secs = tcase_create ("set-rxw-secs"); suite_add_tcase (s, tc_set_rxw_secs); tcase_add_checked_fixture (tc_set_rxw_secs, mock_setup, NULL); tcase_add_test (tc_set_rxw_secs, test_set_rxw_secs_pass_001); tcase_add_test (tc_set_rxw_secs, test_set_rxw_secs_fail_001); TCase* tc_set_rxw_max_rte = tcase_create ("set-rxw-max-rte"); suite_add_tcase (s, tc_set_rxw_max_rte); tcase_add_checked_fixture (tc_set_rxw_max_rte, mock_setup, NULL); tcase_add_test (tc_set_rxw_max_rte, test_set_rxw_max_rte_pass_001); tcase_add_test (tc_set_rxw_max_rte, test_set_rxw_max_rte_fail_001); TCase* tc_set_peer_expiry = tcase_create ("set-peer-expiry"); suite_add_tcase (s, tc_set_peer_expiry); tcase_add_checked_fixture (tc_set_peer_expiry, mock_setup, NULL); tcase_add_test (tc_set_peer_expiry, test_set_peer_expiry_pass_001); tcase_add_test (tc_set_peer_expiry, test_set_peer_expiry_fail_001); TCase* tc_set_spmr_expiry = tcase_create ("set-spmr-expiry"); suite_add_tcase (s, tc_set_spmr_expiry); tcase_add_checked_fixture (tc_set_spmr_expiry, mock_setup, NULL); tcase_add_test (tc_set_spmr_expiry, test_set_spmr_expiry_pass_001); tcase_add_test (tc_set_spmr_expiry, test_set_spmr_expiry_fail_001); TCase* tc_set_nak_bo_ivl = tcase_create ("set-nak-bo-ivl"); suite_add_tcase (s, tc_set_nak_bo_ivl); tcase_add_checked_fixture (tc_set_nak_bo_ivl, mock_setup, NULL); tcase_add_test (tc_set_nak_bo_ivl, test_set_nak_bo_ivl_pass_001); tcase_add_test (tc_set_nak_bo_ivl, test_set_nak_bo_ivl_fail_001); TCase* tc_set_nak_rpt_ivl = tcase_create ("set-nak-rpt-ivl"); suite_add_tcase (s, tc_set_nak_rpt_ivl); tcase_add_checked_fixture (tc_set_nak_rpt_ivl, mock_setup, NULL); tcase_add_test (tc_set_nak_rpt_ivl, test_set_nak_rpt_ivl_pass_001); tcase_add_test (tc_set_nak_rpt_ivl, test_set_nak_rpt_ivl_fail_001); TCase* tc_set_nak_rdata_ivl = tcase_create ("set-nak-rdata-ivl"); suite_add_tcase (s, tc_set_nak_rdata_ivl); tcase_add_checked_fixture (tc_set_nak_rdata_ivl, mock_setup, NULL); tcase_add_test (tc_set_nak_rdata_ivl, test_set_nak_rdata_ivl_pass_001); tcase_add_test (tc_set_nak_rdata_ivl, test_set_nak_rdata_ivl_fail_001); TCase* tc_set_nak_data_retries = tcase_create ("set-nak-data-retries"); suite_add_tcase (s, tc_set_nak_data_retries); tcase_add_checked_fixture (tc_set_nak_data_retries, mock_setup, NULL); tcase_add_test (tc_set_nak_data_retries, test_set_nak_data_retries_pass_001); tcase_add_test (tc_set_nak_data_retries, test_set_nak_data_retries_fail_001); TCase* tc_set_nak_ncf_retries = tcase_create ("set-nak-ncf-retries"); suite_add_tcase (s, tc_set_nak_ncf_retries); tcase_add_checked_fixture (tc_set_nak_ncf_retries, mock_setup, NULL); tcase_add_test (tc_set_nak_ncf_retries, test_set_nak_ncf_retries_pass_001); tcase_add_test (tc_set_nak_ncf_retries, test_set_nak_ncf_retries_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/openpgm-5.1.pc.in0000644000175000017500000000037211640407354020444 0ustar locallocalprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenPGM Description: PGM Protocol Library. Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lpgm @LIBS@ Cflags: -I${includedir}/pgm-5.1 -I${libdir}/pgm-5.1/include libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.097.sunstudio0000644000175000017500000002421711640407354022155 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 0, 97 ) SConsignFile('scons.signatures'+ '-' + platform.system() + '-' + platform.machine() + '-sunstudio'); opt = Options(None, ARGUMENTS) opt.AddOptions ( (EnumOption ('BUILD', 'build environment', 'debug', ('release', 'debug', 'profile'))), (EnumOption ('BRANCH', 'branch prediction', 'none', ('none', 'profile', 'seed'))), (EnumOption ('WITH_GETTEXT', 'l10n support via libintl', 'false', ('true', 'false'))), (EnumOption ('WITH_GLIB', 'Build GLib dependent modules', 'false', ('true', 'false'))), (EnumOption ('COVERAGE', 'test coverage', 'none', ('none', 'full'))), (EnumOption ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', ('true', 'false'))), (EnumOption ('WITH_HTTP', 'HTTP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_SNMP', 'SNMP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_CHECK', 'Check test system', 'false', ('true', 'false'))), (EnumOption ('WITH_TEST', 'Network test system', 'false', ('true', 'false'))), (EnumOption ('WITH_CC', 'C++ Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_EXAMPLES', 'Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_NCURSES', 'NCURSES examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', ('true', 'false'))), ) #----------------------------------------------------------------------------- # Dependencies def force_sunstudio(env): env.PrependENVPath('PATH', '/opt/sun/sunstudio12.1/bin'); env.Tool('sunc++'); env.Tool('suncc'); env.Tool('sunlink'); env.Tool('sunar'); env = Environment(); force_sunstudio(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment(ENV = os.environ, CCFLAGS = [ # strict C '-v', # enable warnings '+w', # strict ISO C '-Xc', # C99 '-xc99=all', '-D_XOPEN_SOURCE=600', '-D__EXTENSIONS__', '-DBSD_COMP', '-D_BSD_SOURCE', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system '-DCONFIG_HAVE_PROC', # example: crash handling '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # event handling '-DCONFIG_HAVE_POLL', '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt' ], PROTOBUF_CCFLAGS = '-I/miru/projects/protobuf/protobuf-2.1.0/src', PROTOBUF_LIBS = '/miru/projects/protobuf/protobuf-2.1.0/src/.libs/libprotobuf.a', PROTOBUF_PROTOC = '/miru/projects/protobuf/protobuf-2.1.0/src/protoc' ) opt.Update (env) force_sunstudio(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-g'], LINKFLAGS = '-g') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O0','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); def list_remove(list, target): newlist = []; for item in str(list).split(' '): if item != target: newlist.append(item); return newlist; # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --cflags --agent-libs'); # strip out GCC only flags ccflags = env['SNMP_FLAGS'].get('CCFLAGS', ''); env['SNMP_FLAGS']['CCFLAGS'] = list_remove(ccflags, '-Wall'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '-sunstudio/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/LICENSE0000644000175000017500000000151411640407354016551 0ustar locallocal OpenPGM, an implementation of the PGM protocol. Copyright (C) 2006-2011 Miru Limited. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA libpgm-5.1.118-1~dfsg/openpgm/pgm/getprotobyname.c0000644000175000017500000000424511640407354020753 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable implementation of getprotobyname * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include //#define GETPROTOBYNAME_DEBUG /* locals */ #define MAXALIASES 35 static char line[BUFSIZ+1]; static char *proto_aliases[MAXALIASES]; static struct pgm_protoent_t proto; static struct pgm_protoent_t* _pgm_native_getprotobyname ( const char* name ) { struct protoent* pe; char **q, **r; size_t len; if (NULL == name) return NULL; #ifdef CONFIG_HAVE_GETPROTOBYNAME_R char buf[BUFSIZ]; struct protoent protobuf; if (NULL == (pe = getprotobyname_r (name, &protobuf, buf, BUFSIZ))) return NULL; #elif defined(CONFIG_HAVE_GETPROTOBYNAME_R2) char buf[BUFSIZ]; struct protoent protobuf; if (0 != getprotobyname_r (name, &protobuf, buf, BUFSIZ, &pe) || NULL == pe) return NULL; #else if (NULL == (pe = getprotobyname (name))) return NULL; #endif len = strlen (pe->p_name) + 1; if (len > BUFSIZ) return NULL; proto.p_name = memcpy (line, pe->p_name, len); q = proto.p_aliases = proto_aliases; r = pe->p_aliases; while (*r) { const size_t alias_len = strlen (*r) + 1; if ((len + alias_len) > BUFSIZ) break; *q++ = memcpy (line + len, *r++, alias_len); len += alias_len; } *q = NULL; proto.p_proto = pe->p_proto; return &proto; } struct pgm_protoent_t* pgm_getprotobyname ( const char* name ) { return _pgm_native_getprotobyname (name); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/skbuff.c0000644000175000017500000001011311640407354017163 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM socket buffers * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "pgm/skbuff.h" void pgm_skb_over_panic ( const struct pgm_sk_buff_t*const skb, const uint16_t len ) { pgm_fatal ("skput:over: %u put:%u", skb->len, len); pgm_assert_not_reached(); } void pgm_skb_under_panic ( const struct pgm_sk_buff_t*const skb, const uint16_t len ) { pgm_fatal ("skput:under: %u put:%u", skb->len, len); pgm_assert_not_reached(); } #ifndef SKB_DEBUG bool pgm_skb_is_valid ( PGM_GNUC_UNUSED const struct pgm_sk_buff_t*const skb ) { return TRUE; } #else bool pgm_skb_is_valid ( const struct pgm_sk_buff_t*const skb ) { pgm_return_val_if_fail (NULL != skb, FALSE); /* link_ */ /* socket */ pgm_return_val_if_fail (NULL != skb->sock, FALSE); /* tstamp */ pgm_return_val_if_fail (skb->tstamp > 0, FALSE); /* tsi */ /* sequence can be any value */ /* cb can be any value */ /* len can be any value */ /* zero_padded can be any value */ /* gpointers */ pgm_return_val_if_fail (NULL != skb->head, FALSE); pgm_return_val_if_fail ((const char*)skb->head > (const char*)&skb->users, FALSE); pgm_return_val_if_fail (NULL != skb->data, FALSE); pgm_return_val_if_fail ((const char*)skb->data >= (const char*)skb->head, FALSE); pgm_return_val_if_fail (NULL != skb->tail, FALSE); pgm_return_val_if_fail ((const char*)skb->tail >= (const char*)skb->data, FALSE); pgm_return_val_if_fail (skb->len == (char*)skb->tail - (const char*)skb->data, FALSE); pgm_return_val_if_fail (NULL != skb->end, FALSE); pgm_return_val_if_fail ((const char*)skb->end >= (const char*)skb->tail, FALSE); /* pgm_header */ if (skb->pgm_header) { pgm_return_val_if_fail ((const char*)skb->pgm_header >= (const char*)skb->head, FALSE); pgm_return_val_if_fail ((const char*)skb->pgm_header + sizeof(struct pgm_header) <= (const char*)skb->tail, FALSE); pgm_return_val_if_fail (NULL != skb->pgm_data, FALSE); pgm_return_val_if_fail ((const char*)skb->pgm_data >= (const char*)skb->pgm_header + sizeof(struct pgm_header), FALSE); pgm_return_val_if_fail ((const char*)skb->pgm_data <= (const char*)skb->tail, FALSE); if (skb->pgm_opt_fragment) { pgm_return_val_if_fail ((const char*)skb->pgm_opt_fragment > (const char*)skb->pgm_data, FALSE); pgm_return_val_if_fail ((const char*)skb->pgm_opt_fragment + sizeof(struct pgm_opt_fragment) < (const char*)skb->tail, FALSE); /* of_apdu_first_sqn can be any value */ /* of_frag_offset */ pgm_return_val_if_fail (ntohl (skb->of_frag_offset) < ntohl (skb->of_apdu_len), FALSE); /* of_apdu_len can be any value */ } pgm_return_val_if_fail (PGM_ODATA == skb->pgm_header->pgm_type || PGM_RDATA == skb->pgm_header->pgm_type, FALSE); /* FEC broken */ pgm_return_val_if_fail (0 == (skb->pgm_header->pgm_options & PGM_OPT_PARITY), FALSE); pgm_return_val_if_fail (0 == (skb->pgm_header->pgm_options & PGM_OPT_VAR_PKTLEN), FALSE); } else { pgm_return_val_if_fail (NULL == skb->pgm_data, FALSE); pgm_return_val_if_fail (NULL == skb->pgm_opt_fragment, FALSE); } /* truesize */ pgm_return_val_if_fail (skb->truesize >= sizeof(struct pgm_sk_buff_t*) + skb->len, FALSE); pgm_return_val_if_fail (skb->truesize == ((const char*)skb->end - (const char*)skb), FALSE); /* users */ pgm_return_val_if_fail (pgm_atomic_read32 (&skb->users) > 0, FALSE); return TRUE; } #endif /* SKB_DEBUG */ /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/math.c0000644000175000017500000000257711640407354016653 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable math. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include //#define MATH_DEBUG static const unsigned primes[] = { 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627, 47431, 71143, 106721, 160073, 240101, 360163, 540217, 810343, 1215497, 1823231, 2734867, 4102283, 6153409, 9230113, 13845163, }; unsigned pgm_spaced_primes_closest (unsigned num) { for (unsigned i = 0; i < PGM_N_ELEMENTS(primes); i++) if (primes[i] > num) return primes[i]; return primes[PGM_N_ELEMENTS(primes) - 1]; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/packet_test.c0000644000175000017500000007660211640407354020230 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM packet formats, RFC 3208. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #ifndef _WIN32 # include # include # include # include #endif #include #include #include //#define PACKET_DEBUG static bool pgm_print_spm (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_poll (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_polr (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_odata (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_rdata (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_nak (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_nnak (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_ncf (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_spmr (const struct pgm_header* const, const void*, const size_t); static bool pgm_print_ack (const struct pgm_header* const, const void*, const size_t); static ssize_t pgm_print_options (const void*, size_t); PGM_GNUC_INTERNAL bool pgm_print_packet ( const void* data, size_t len ) { /* pre-conditions */ pgm_assert (NULL != data); pgm_assert (len > 0); /* minimum size should be IP header plus PGM header */ if (len < (sizeof(struct pgm_ip) + sizeof(struct pgm_header))) { printf ("Packet size too small: %" PRIzu " bytes, expecting at least %" PRIzu " bytes.\n", len, sizeof(struct pgm_ip) + sizeof(struct pgm_header)); return FALSE; } /* decode IP header */ const struct pgm_ip* ip = (const struct pgm_ip*)data; if (ip->ip_v != 4) /* IP version, 4 or 6 */ { puts ("not IP4 packet :/"); /* v6 not currently handled */ return FALSE; } printf ("IP "); const size_t ip_header_length = ip->ip_hl * 4; /* IP header length in 32bit octets */ if (ip_header_length < sizeof(struct pgm_ip)) { puts ("bad IP header length :("); return FALSE; } size_t packet_length = ntohs(ip->ip_len); /* total packet length */ /* ip_len can equal packet_length - ip_header_length in FreeBSD/NetBSD * Stevens/Fenner/Rudolph, Unix Network Programming Vol.1, p.739 * * RFC3828 allows partial packets such that len < packet_length with UDP lite */ if (len == packet_length + ip_header_length) { packet_length += ip_header_length; } if (len < packet_length) { /* redundant: often handled in kernel */ puts ("truncated IP packet"); return FALSE; } /* TCP Segmentation Offload (TSO) might have zero length here */ if (packet_length < ip_header_length) { puts ("bad length :("); return FALSE; } const uint16_t offset = ntohs(ip->ip_off); /* 3 bits routing priority, 4 bits type of service: delay, throughput, reliability, cost */ printf ("(tos 0x%x", (int)ip->ip_tos); switch (ip->ip_tos & 0x3) { case 1: printf (",ECT(1)"); break; case 2: printf (",ECT(0)"); break; case 3: printf (",CE"); break; default: break; } /* time to live */ if (ip->ip_ttl >= 1) printf (", ttl %u", ip->ip_ttl); /* fragmentation */ #define IP_RDF 0x8000 #define IP_DF 0x4000 #define IP_MF 0x2000 #define IP_OFFMASK 0x1fff printf (", id %u, offset %u, flags [%s%s]", ntohs(ip->ip_id), (offset & 0x1fff) * 8, ((offset & IP_DF) ? "DF" : ""), ((offset & IP_MF) ? "+" : "")); printf (", length %" PRIzu "", packet_length); /* IP options */ if ((ip_header_length - sizeof(struct pgm_ip)) > 0) { printf (", options ("); pgm_ipopt_print((const void*)(ip + 1), ip_header_length - sizeof(struct pgm_ip)); printf (" )"); } /* packets that fail checksum will generally not be passed upstream except with rfc3828 */ const uint16_t ip_sum = pgm_inet_checksum(data, (uint16_t)packet_length, 0); if (ip_sum != 0) { const uint16_t encoded_ip_sum = ntohs(ip->ip_sum); printf (", bad cksum! %i", encoded_ip_sum); } printf (") "); /* fragmentation offset, bit 0: 0, bit 1: do-not-fragment, bit 2: more-fragments */ if ((offset & 0x1fff) != 0) { puts ("fragmented packet :/"); return FALSE; } /* PGM payload, header looks as follows: * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source Port | Destination Port | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Type | Options | Checksum | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Global Source ID ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | ... Global Source ID | TSDU Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Type specific data ... * +-+-+-+-+-+-+-+-+-+- ... */ const struct pgm_header* pgm_header = (const struct pgm_header*)((const char*)data + ip_header_length); const size_t pgm_length = packet_length - ip_header_length; if (pgm_length < sizeof(pgm_header)) { puts ("bad packet size :("); return FALSE; } printf ("%s.%s > ", pgm_gethostbyaddr((const struct in_addr*)&ip->ip_src), pgm_udpport_string(pgm_header->pgm_sport)); printf ("%s.%s: PGM\n", pgm_gethostbyaddr((const struct in_addr*)&ip->ip_dst), pgm_udpport_string(pgm_header->pgm_dport)); printf ("type: %s [%i] (version=%i, reserved=%i)\n" "options: extensions=%s, network-significant=%s, parity packet=%s (variable size=%s)\n" "global source id: %i.%i.%i.%i.%i.%i\n" "tsdu length: %i\n", /* packet type */ /* packet version */ /* reserved = 0x0 */ pgm_type_string(pgm_header->pgm_type & 0xf), (pgm_header->pgm_type & 0xf), ((pgm_header->pgm_type & 0xc0) >> 6), ((pgm_header->pgm_type & 0x30) >> 4), /* bit 0 set => one or more option extensions are present */ ((pgm_header->pgm_options & (0x1 << 7)) ? "true" : "false"), /* bit 1 set => one or more options are network-significant */ ((pgm_header->pgm_options & (0x1 << 6)) ? "true" : "false"), /* bit 7 set => parity packet (OPT_PARITY) */ ((pgm_header->pgm_options & (0x1 << 0)) ? "true" : "false"), /* bit 6 set => parity packet for variable packet sizes (OPT_VAR_PKTLEN) */ ((pgm_header->pgm_options & (0x1 << 1)) ? "true" : "false"), pgm_header->pgm_gsi[0], pgm_header->pgm_gsi[1], pgm_header->pgm_gsi[2], pgm_header->pgm_gsi[3], pgm_header->pgm_gsi[4], pgm_header->pgm_gsi[5], ntohs(pgm_header->pgm_tsdu_length)); if (pgm_header->pgm_checksum) { #if 0 const uint16_t encoded_pgm_sum = pgm_header->pgm_checksum; /* requires modification of data buffer */ pgm_header->pgm_checksum = 0; const uint16_t pgm_sum = pgm_csum_fold (pgm_csum_partial((const char*)pgm_header, pgm_length, 0)); if (pgm_sum != encoded_pgm_sum) { printf ("PGM checksum incorrect, packet %x calculated %x :(\n", encoded_pgm_sum, pgm_sum); return FALSE; } #endif } else { puts ("No PGM checksum :O"); } /* now decode PGM packet types */ const void* pgm_data = pgm_header + 1; const size_t pgm_data_length = pgm_length - sizeof(pgm_header); /* can equal zero for SPMR's */ bool err = FALSE; switch (pgm_header->pgm_type) { case PGM_SPM: err = pgm_print_spm (pgm_header, pgm_data, pgm_data_length); break; case PGM_POLL: err = pgm_print_poll (pgm_header, pgm_data, pgm_data_length); break; case PGM_POLR: err = pgm_print_polr (pgm_header, pgm_data, pgm_data_length); break; case PGM_ODATA: err = pgm_print_odata (pgm_header, pgm_data, pgm_data_length); break; case PGM_RDATA: err = pgm_print_rdata (pgm_header, pgm_data, pgm_data_length); break; case PGM_NAK: err = pgm_print_nak (pgm_header, pgm_data, pgm_data_length); break; case PGM_NNAK: err = pgm_print_nnak (pgm_header, pgm_data, pgm_data_length); break; case PGM_NCF: err = pgm_print_ncf (pgm_header, pgm_data, pgm_data_length); break; case PGM_SPMR: err = pgm_print_spmr (pgm_header, pgm_data, pgm_data_length); break; case PGM_ACK: err = pgm_print_ack (pgm_header, pgm_data, pgm_data_length); break; default: puts ("unknown packet type :("); break; } return err; } /* 8.1. Source Path Messages (SPM) * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | SPM's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Trailing Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Leading Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Path NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * NLA = Network Layer Address * NLA AFI = NLA Address Family Indicator: rfc 1700 (ADDRESS FAMILY NUMBERS) * => Path NLA = IP address of last network element */ #define PGM_MIN_SPM_SIZE ( sizeof(struct pgm_spm) ) static bool pgm_print_spm ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("SPM: "); if (len < PGM_MIN_SPM_SIZE) { puts ("packet truncated :("); return FALSE; } const struct pgm_spm * spm = (const struct pgm_spm *)data; const struct pgm_spm6* spm6 = (const struct pgm_spm6*)data; const uint16_t spm_nla_afi = ntohs (spm->spm_nla_afi); printf ("sqn %" PRIu32 " trail %" PRIu32 "lu lead %" PRIu32 "lu nla-afi %u ", ntohl(spm->spm_sqn), ntohl(spm->spm_trail), ntohl(spm->spm_lead), spm_nla_afi); /* address family indicator */ char s[INET6_ADDRSTRLEN]; const void* pgm_opt; size_t pgm_opt_len; switch (spm_nla_afi) { case AFI_IP: pgm_inet_ntop (AF_INET, &spm->spm_nla, s, sizeof(s)); pgm_opt = (const uint8_t*)data + sizeof(struct pgm_spm); pgm_opt_len = len - sizeof(struct pgm_spm); break; case AFI_IP6: if (len < sizeof (struct pgm_spm6)) { puts ("packet truncated :("); return FALSE; } pgm_inet_ntop (AF_INET6, &spm6->spm6_nla, s, sizeof(s)); pgm_opt = (const uint8_t*)data + sizeof(struct pgm_spm6); pgm_opt_len = len - sizeof(struct pgm_spm6); break; default: printf ("unsupported afi"); return FALSE; } printf ("%s", s); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT && pgm_print_options (pgm_opt, pgm_opt_len) < 0 ) { return FALSE; } printf ("\n"); return TRUE; } /* 14.7.1. Poll Request * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLL's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLL's Round | POLL's Sub-type | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Path NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | POLL's Back-off Interval | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Random String | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Matching Bit-Mask | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Sent to ODATA multicast group with IP Router Alert option. */ #define PGM_MIN_POLL_SIZE ( sizeof(struct pgm_poll) ) static bool pgm_print_poll ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("POLL: "); if (len < PGM_MIN_POLL_SIZE) { puts ("packet truncated :("); return FALSE; } const struct pgm_poll * poll4 = (const struct pgm_poll *)data; const struct pgm_poll6* poll6 = (const struct pgm_poll6*)data; const uint16_t poll_nla_afi = ntohs (poll4->poll_nla_afi); printf ("sqn %" PRIu32 " round %u sub-type %u nla-afi %u ", ntohl(poll4->poll_sqn), ntohs(poll4->poll_round), ntohs(poll4->poll_s_type), poll_nla_afi); /* address family indicator */ char s[INET6_ADDRSTRLEN]; const void* pgm_opt; size_t pgm_opt_len; switch (poll_nla_afi) { case AFI_IP: pgm_inet_ntop (AF_INET, &poll4->poll_nla, s, sizeof(s)); pgm_opt = (const uint8_t*)data + sizeof(struct pgm_poll); pgm_opt_len = len - sizeof(struct pgm_poll); printf ("%s", s); /* back-off interval in microseconds */ printf (" bo_ivl %u", poll4->poll_bo_ivl); /* random string */ printf (" rand [%c%c%c%c]", isprint (poll4->poll_rand[0]) ? poll4->poll_rand[0] : '.', isprint (poll4->poll_rand[1]) ? poll4->poll_rand[1] : '.', isprint (poll4->poll_rand[2]) ? poll4->poll_rand[2] : '.', isprint (poll4->poll_rand[3]) ? poll4->poll_rand[3] : '.' ); /* matching bit-mask */ printf (" mask 0x%x", poll4->poll_mask); break; case AFI_IP6: if (len < sizeof (struct pgm_poll6)) { puts ("packet truncated :("); return FALSE; } pgm_inet_ntop (AF_INET6, &poll6->poll6_nla, s, sizeof (s)); pgm_opt = (const uint8_t*)data + sizeof(struct pgm_poll6); pgm_opt_len = len - sizeof(struct pgm_poll6); printf ("%s", s); /* back-off interval in microseconds */ printf (" bo_ivl %u", poll6->poll6_bo_ivl); /* random string */ printf (" rand [%c%c%c%c]", isprint (poll6->poll6_rand[0]) ? poll6->poll6_rand[0] : '.', isprint (poll6->poll6_rand[1]) ? poll6->poll6_rand[1] : '.', isprint (poll6->poll6_rand[2]) ? poll6->poll6_rand[2] : '.', isprint (poll6->poll6_rand[3]) ? poll6->poll6_rand[3] : '.' ); /* matching bit-mask */ printf (" mask 0x%x", poll6->poll6_mask); break; default: printf ("unsupported afi"); return FALSE; } /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT && pgm_print_options (pgm_opt, pgm_opt_len) < 0 ) { return FALSE; } printf ("\n"); return TRUE; } /* 14.7.2. Poll Response * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLR's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLR's Round | reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ static bool pgm_print_polr ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("POLR: "); if (len < sizeof(struct pgm_polr)) { puts ("packet truncated :("); return FALSE; } const struct pgm_polr* polr = (const struct pgm_polr*)data; printf("sqn %" PRIu32 " round %u", ntohl(polr->polr_sqn), ntohs(polr->polr_round)); const void* pgm_opt = (const uint8_t*)data + sizeof(struct pgm_polr); size_t pgm_opt_len = len - sizeof(struct pgm_polr); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT && pgm_print_options (pgm_opt, pgm_opt_len) < 0 ) { return FALSE; } printf ("\n"); return TRUE; } /* 8.2. Data Packet * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Data Packet Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Trailing Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Data ... * +-+-+- ... */ static bool pgm_print_odata ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("ODATA: "); if (len < sizeof(struct pgm_data)) { puts ("packet truncated :("); return FALSE; } const struct pgm_data* odata = (const struct pgm_data*)data; printf ("sqn %" PRIu32 " trail %" PRIu32 " [", ntohl(odata->data_sqn), ntohl(odata->data_trail)); /* option extensions */ const void* pgm_opt = (const uint8_t*)data + sizeof(struct pgm_data); size_t pgm_opt_len = len - sizeof(struct pgm_data); const char* payload = pgm_opt; if (header->pgm_options & PGM_OPT_PRESENT) { const ssize_t opt_len = pgm_print_options (pgm_opt, pgm_opt_len); if (opt_len < 0) return FALSE; payload += opt_len; } /* data */ const char* end = payload + ntohs (header->pgm_tsdu_length); while (payload < end) { if (isprint (*payload)) putchar (*payload); else putchar ('.'); payload++; } printf ("]\n"); return TRUE; } /* 8.2. Repair Data */ static bool pgm_print_rdata ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("RDATA: "); if (len < sizeof(struct pgm_data)) { puts ("packet truncated :("); return FALSE; } const struct pgm_data* rdata = (const struct pgm_data*)data; printf ("sqn %" PRIu32 " trail %" PRIu32 " [", ntohl (rdata->data_sqn), ntohl (rdata->data_trail)); /* option extensions */ const void* pgm_opt = (const uint8_t*)data + sizeof(struct pgm_data); size_t pgm_opt_len = len - sizeof(struct pgm_data); const char* payload = pgm_opt; if (header->pgm_options & PGM_OPT_PRESENT) { const ssize_t opt_len = pgm_print_options (pgm_opt, pgm_opt_len); if (opt_len < 0) return FALSE; payload += opt_len; } /* data */ const char* end = payload + ntohs (header->pgm_tsdu_length); while (payload < end) { if (isprint (*payload)) putchar (*payload); else putchar ('.'); payload++; } printf ("]\n"); return TRUE; } /* 8.3. NAK * * Technically the AFI of the source and multicast group can be different * but that would be very wibbly wobbly. One example is using a local DLR * with a IPv4 address to reduce NAK cost for recovery on wide IPv6 * distribution. * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Requested Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Multicast Group NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ #define PGM_MIN_NAK_SIZE ( sizeof(struct pgm_nak) ) static bool pgm_print_nak ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("NAK: "); if (len < PGM_MIN_NAK_SIZE) { puts ("packet truncated :("); return FALSE; } const struct pgm_nak * nak = (const struct pgm_nak *)data; const struct pgm_nak6* nak6 = (const struct pgm_nak6*)data; const uint16_t nak_src_nla_afi = ntohs (nak->nak_src_nla_afi); printf ("sqn %" PRIu32 " src ", ntohl(nak->nak_sqn)); char s[INET6_ADDRSTRLEN]; const void* pgm_opt; size_t pgm_opt_len; /* source nla */ switch (nak_src_nla_afi) { case AFI_IP: { const uint16_t nak_grp_nla_afi = ntohs (nak->nak_grp_nla_afi); if (nak_src_nla_afi != nak_grp_nla_afi) { puts ("different source & group afi very wibbly wobbly :("); return FALSE; } pgm_inet_ntop (AF_INET, &nak->nak_src_nla, s, sizeof(s)); pgm_opt = (const uint8_t*)data + sizeof(struct pgm_nak); pgm_opt_len = len - sizeof(struct pgm_nak); printf ("%s grp ", s); pgm_inet_ntop (AF_INET, &nak->nak_grp_nla, s, sizeof(s)); printf ("%s", s); break; } case AFI_IP6: { if (len < sizeof (struct pgm_nak6)) { puts ("packet truncated :("); return FALSE; } const uint16_t nak_grp_nla_afi = ntohs (nak6->nak6_grp_nla_afi); if (nak_src_nla_afi != nak_grp_nla_afi) { puts ("different source & group afi very wibbly wobbly :("); return FALSE; } pgm_inet_ntop (AF_INET6, &nak6->nak6_src_nla, s, sizeof(s)); pgm_opt = (const uint8_t*)data + sizeof(struct pgm_nak6); pgm_opt_len = len - sizeof(struct pgm_nak6); printf ("%s grp ", s); pgm_inet_ntop (AF_INET6, &nak6->nak6_grp_nla, s, sizeof(s)); printf ("%s", s); break; } default: puts ("unsupported afi"); return FALSE; } /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT && pgm_print_options (pgm_opt, pgm_opt_len) < 0 ) { return FALSE; } printf ("\n"); return TRUE; } /* 8.3. N-NAK */ static bool pgm_print_nnak ( PGM_GNUC_UNUSED const struct pgm_header* const header, PGM_GNUC_UNUSED const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("N-NAK: "); if (len < sizeof(struct pgm_nak)) { puts ("packet truncated :("); return FALSE; } // struct pgm_nak* nnak = (struct pgm_nak*)data; return TRUE; } /* 8.3. NCF */ static bool pgm_print_ncf ( PGM_GNUC_UNUSED const struct pgm_header* const header, PGM_GNUC_UNUSED const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("NCF: "); if (len < sizeof(struct pgm_nak)) { puts ("packet truncated :("); return FALSE; } // struct pgm_nak* ncf = (struct pgm_nak*)data; return TRUE; } /* 13.6. SPM Request * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ static bool pgm_print_spmr ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("SPMR: "); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT && pgm_print_options (data, len) < 0 ) { return FALSE; } printf ("\n"); return TRUE; } /* PGMCC: ACK * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | RX_MAX | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Received Packet Bitmap | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ static bool pgm_print_ack ( const struct pgm_header* const header, const void* data, const size_t len ) { /* pre-conditions */ pgm_assert (NULL != header); pgm_assert (NULL != data); pgm_assert (len > 0); printf ("ACK: "); const struct pgm_ack* ack = (const struct pgm_ack*)data; char bitmap[33]; for (unsigned i = 31; i; i--) bitmap[i] = (ack->ack_bitmap & (1 << i)) ? '1' : '0'; bitmap[32] = '\0'; printf ("rx_max %" PRIu32 " bitmap [%s] ", ntohl(ack->ack_rx_max), bitmap); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT && pgm_print_options (data, len) < 0 ) { return FALSE; } printf ("\n"); return TRUE; } /* Parse PGM options fields, alters contents of packet. * * returns -1 on failure, or total length in octets of the option fields */ static ssize_t pgm_print_options ( const void* data, size_t len ) { /* pre-conditions */ pgm_assert (NULL != data); pgm_assert (len > 0); printf (" OPTIONS:"); if (len < sizeof(struct pgm_opt_length)) { puts (" packet truncated :("); return -1; } const struct pgm_opt_length* opt_len = (const struct pgm_opt_length*)data; if (opt_len->opt_length != sizeof(struct pgm_opt_length)) { printf (" bad opt_length length %u\n", (unsigned)opt_len->opt_length); return -1; } uint16_t opt_total_length = ntohs (opt_len->opt_total_length); printf (" total len %u ", opt_total_length); if (opt_total_length < (sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header)) || opt_total_length > len) { puts ("bad total length"); return -1; } /* total length includes opt_length option */ opt_total_length -= sizeof(struct pgm_opt_length); const struct pgm_opt_header* opt_header = (const struct pgm_opt_header*)(opt_len + 1); /* iterate through options (max 16) */ unsigned count = 16; while (opt_total_length && count) { if (opt_total_length < sizeof(struct pgm_opt_header) || opt_header->opt_length > opt_total_length) { puts ("short on option data :o"); return -1; } if (opt_header->opt_type & PGM_OPT_END) { printf ("OPT_END+"); } switch (opt_header->opt_type & PGM_OPT_MASK) { case PGM_OPT_FRAGMENT: printf ("OPT_FRAGMENT "); break; case PGM_OPT_NAK_LIST: printf ("OPT_NAK_LIST "); break; case PGM_OPT_JOIN: printf ("OPT_JOIN "); break; case PGM_OPT_REDIRECT: printf ("OPT_REDIRECT "); break; case PGM_OPT_SYN: printf ("OPT_SYN "); break; case PGM_OPT_FIN: printf ("OPT_FIN "); break; case PGM_OPT_RST: printf ("OPT_RST "); break; case PGM_OPT_PARITY_PRM: printf ("OPT_PARITY_PRM "); break; case PGM_OPT_CURR_TGSIZE: printf ("OPT_CURR_TGSIZE "); break; case PGM_OPT_CR: printf ("OPT_CR "); break; case PGM_OPT_CRQST: printf ("OPT_CRQST "); break; case PGM_OPT_PGMCC_DATA: printf ("OPT_PGMCC_DATA "); break; case PGM_OPT_PGMCC_FEEDBACK: printf ("OPT_PGMCC_FEEDBACK "); break; case PGM_OPT_NAK_BO_IVL: printf ("OPT_NAK_BO_IVL "); break; case PGM_OPT_NAK_BO_RNG: printf ("OPT_NAK_BO_RNG "); break; case PGM_OPT_NBR_UNREACH: printf ("OPT_NBR_UNREACH "); break; case PGM_OPT_PATH_NLA: printf ("OPT_PATH_NLA "); break; default: printf ("OPT-%u{%u} ", opt_header->opt_type & PGM_OPT_MASK, opt_header->opt_length); break; } opt_total_length -= opt_header->opt_length; opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); count--; } if (!count) { puts ("too many options found"); return -1; } return ((const uint8_t*)opt_header - (const uint8_t*)data); } PGM_GNUC_INTERNAL const char* pgm_type_string ( uint8_t type ) { const char* c; switch (type) { case PGM_SPM: c = "PGM_SPM"; break; case PGM_POLL: c = "PGM_POLL"; break; case PGM_POLR: c = "PGM_POLR"; break; case PGM_ODATA: c = "PGM_ODATA"; break; case PGM_RDATA: c = "PGM_RDATA"; break; case PGM_NAK: c = "PGM_NAK"; break; case PGM_NNAK: c = "PGM_NNAK"; break; case PGM_NCF: c = "PGM_NCF"; break; case PGM_SPMR: c = "PGM_SPMR"; break; case PGM_ACK: c = "PGM_ACK"; break; default: c = "(unknown)"; break; } return c; } PGM_GNUC_INTERNAL const char* pgm_udpport_string ( in_port_t port ) { static pgm_hashtable_t *services = NULL; if (!services) { services = pgm_hashtable_new (pgm_int_hash, pgm_int_equal); } const int hash_key = port; void* service_string = pgm_hashtable_lookup (services, &hash_key); if (service_string != NULL) { return service_string; } struct servent* se = getservbyport (port, "udp"); if (se == NULL) { char buf[sizeof("00000")]; pgm_snprintf_s (buf, sizeof (buf), sizeof (buf), "%u", ntohs (port)); service_string = pgm_strdup(buf); } else { service_string = pgm_strdup(se->s_name); } pgm_hashtable_insert (services, &hash_key, service_string); return service_string; } PGM_GNUC_INTERNAL const char* pgm_gethostbyaddr ( const struct in_addr* ap ) { static pgm_hashtable_t *hosts = NULL; if (!hosts) { hosts = pgm_hashtable_new (pgm_str_hash, pgm_int_equal); } const int hash_key = (int)ap->s_addr; void* host_string = pgm_hashtable_lookup (hosts, &hash_key); if (host_string != NULL) { return host_string; } struct hostent* he = gethostbyaddr((const char*)ap, sizeof(struct in_addr), AF_INET); if (he == NULL) { struct in_addr in; memcpy (&in, ap, sizeof(in)); host_string = pgm_strdup(inet_ntoa(in)); } else { host_string = pgm_strdup(he->h_name); } pgm_hashtable_insert (hosts, &hash_key, host_string); return host_string; } PGM_GNUC_INTERNAL void pgm_ipopt_print ( const void* ipopt, size_t length ) { /* pre-conditions */ pgm_assert (NULL != ipopt); const char* op = ipopt; while (length) { char len = (*op == PGM_IPOPT_NOP || *op == PGM_IPOPT_EOL) ? 1 : op[1]; switch (*op) { case PGM_IPOPT_EOL: printf(" eol"); break; case PGM_IPOPT_NOP: printf(" nop"); break; case PGM_IPOPT_RR: printf(" rr"); break; /* 1 route */ case PGM_IPOPT_TS: printf(" ts"); break; /* 1 TS */ #if 0 case PGM_IPOPT_SECURITY: printf(" sec-level"); break; case PGM_IPOPT_LSRR: printf(" lsrr"); break; /* 1 route */ case PGM_IPOPT_SATID: printf(" satid"); break; case PGM_IPOPT_SSRR: printf(" ssrr"); break; /* 1 route */ #endif default: printf(" %x{%d}", (int)*op, (int)len); break; } if (!len) { puts ("invalid IP opt length"); return; } op += len; length -= len; } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.FreeBSD800000644000175000017500000002465411640407354021171 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine()); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('COVERAGE', 'test coverage', 'none', allowed_values=('none', 'full')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header # '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast # '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD '-DCONFIG_HOST_ORDER_IP_LEN', '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt', # ftime() 'compat', # POSIX threads 'pthread' ], PROTOBUF_CCFLAGS = '-I/usr/local/include/google/protobuf', PROTOBUF_LIBS = '/usr/local/lib/libprotobuf.a', PROTOBUF_PROTOC = 'protoc' ) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': # You may need to add -I${includedir} to Cflags in glib-2.0.pc for gi18n-lib env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --cflags --agent-libs'); def restore_env(env, backup): for var in backup.keys(): env[var] = backup[var]; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/install-sh0000755000175000017500000003160011640410446017543 0ustar locallocal#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) mode=$2 shift shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac done if test $# -ne 0 && test -z "$dir_arg$dstarg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix=/ ;; -*) prefix=./ ;; *) prefix= ;; esac case $posix_glob in '') if (set -f) 2>/dev/null; then posix_glob=true else posix_glob=false fi ;; esac oIFS=$IFS IFS=/ $posix_glob && set -f set fnord $dstdir shift $posix_glob && set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dst"; then $doit $rmcmd -f "$dst" 2>/dev/null \ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } } || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.OpenSolaris0000644000175000017500000002174111640407354022037 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures'+ '-OpenSolaris-' + platform.machine() + '-gcc'); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', # '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_XOPEN_SOURCE=600', '-D__EXTENSIONS__', '-DBSD_COMP', '-D_BSD_SOURCE', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only # '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration # '-DCONFIG_HAVE_GETIFADDRS', # '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', # '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt', # Solaris sockets 'resolv', 'socket', 'nsl' ] ) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = ['-O2'], LINKFLAGS = []) debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG', '-ggdb'], LINKFLAGS = ['-gdb']) profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = ['-pg']) thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp env['SNMP_FLAGS'] = { 'CCFLAGS' : [], 'LIBS' : [ 'netsnmpagent', 'netsnmpmibs', 'netsnmphelpers', 'netsnmp', 'ssl', 'kstat', 'wrap', 'adm' ], 'CPPPATH' : ['/opt/cws/include'], 'LIBPATH' : ['/opt/csw/lib'], }; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); lastLIBS = context.env['LIBS']; lastCCFLAGS= context.env['CCFLAGS']; context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); context.env.Replace(LIBS = lastLIBS, CCFLAGS=lastCCFLAGS); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; tests = { 'CheckCheck': CheckCheck } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-OpenSolaris-' + platform.machine() + '-gcc/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/missing0000755000175000017500000002557711640410437017156 0ustar locallocal#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: libpgm-5.1.118-1~dfsg/openpgm/pgm/reed_solomon_unittest.c0000644000175000017500000002016611640407354022340 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for Reed-Solomon forward error correction based on Vandermonde matrices. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } #define REED_SOLOMON_DEBUG #include "reed_solomon.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * void * pgm_rs_create ( * pgm_rs_t* rs, * const uint8_t n, * const uint8_t k * ) */ START_TEST (test_create_pass_001) { pgm_rs_t rs; pgm_rs_create (&rs, 255, 16); } END_TEST START_TEST (test_create_fail_001) { pgm_rs_create (NULL, 255, 16); fail ("reached"); } END_TEST /* target: * void * pgm_rs_destroy ( * pgm_rs_t* rs, * ) */ START_TEST (test_destroy_pass_001) { pgm_rs_t rs; pgm_rs_create (&rs, 255, 16); pgm_rs_destroy (&rs); } END_TEST START_TEST (test_destroy_fail_001) { pgm_rs_destroy (NULL); fail ("reached"); } END_TEST /* target: * void * pgm_rs_encode ( * pgm_rs_t* rs, * const pgm_gf8_t** src, * const uint8_t offset, * pgm_gf8_t* dst, * const uint16_t len * ) */ START_TEST (test_encode_pass_001) { const gchar source[] = "i am not a string"; const guint16 source_len = strlen (source); pgm_rs_t rs; const guint8 k = source_len; const guint8 parity_index = k; const guint16 packet_len = 100; pgm_gf8_t* source_packets[k]; pgm_gf8_t* parity_packet = g_malloc0 (packet_len); pgm_rs_create (&rs, 255, k); for (unsigned i = 0; i < k; i++) { source_packets[i] = g_malloc0 (packet_len); source_packets[i][0] = source[i]; g_message ("packet#%2.2d: 0x%2.2x '%c'", i, source[i], source[i]); } pgm_rs_encode (&rs, (const pgm_gf8_t**)source_packets, parity_index, parity_packet, packet_len); g_message ("parity-packet: %2.2x", parity_packet[0]); pgm_rs_destroy (&rs); } END_TEST START_TEST (test_encode_fail_001) { pgm_rs_encode (NULL, NULL, 0, NULL, 0); fail ("reached"); } END_TEST /* target: * void * pgm_rs_decode_parity_inline ( * pgm_rs_t* rs, * pgm_gf8_t** block, * const uint8_t* offsets, * const uint16_t len * ) */ START_TEST (test_decode_parity_inline_pass_001) { const gchar source[] = "i am not a string"; const guint16 source_len = strlen (source); pgm_rs_t rs; const guint8 k = source_len; const guint8 parity_index = k; const guint16 packet_len = 100; pgm_gf8_t* source_packets[k]; pgm_gf8_t* parity_packet = g_malloc0 (packet_len); pgm_rs_create (&rs, 255, k); for (unsigned i = 0; i < k; i++) { source_packets[i] = g_malloc0 (packet_len); source_packets[i][0] = source[i]; } pgm_rs_encode (&rs, (const pgm_gf8_t**)source_packets, parity_index, parity_packet, packet_len); /* simulate error occuring at index #3 */ const guint erased_index = 3; source_packets[erased_index][0] = 'X'; for (unsigned i = 0; i < k; i++) { g_message ("damaged-packet#%2.2d: 0x%2.2x '%c'", i, source_packets[i][0], source_packets[i][0]); } guint8 offsets[k]; for (unsigned i = 0; i < k; i++) offsets[i] = i; /* erased offset now points to parity packet at k */ offsets[erased_index] = parity_index; /* move parity inline */ g_free (source_packets[erased_index]); source_packets[erased_index] = parity_packet; pgm_rs_decode_parity_inline (&rs, source_packets, offsets, packet_len); pgm_rs_destroy (&rs); for (unsigned i = 0; i < k; i++) { g_message ("repaired-packet#%2.2d: 0x%2.2x '%c'", i, source_packets[i][0], source_packets[i][0]); } } END_TEST START_TEST (test_decode_parity_inline_fail_001) { pgm_rs_decode_parity_inline (NULL, NULL, NULL, 0); fail ("reached"); } END_TEST /* target: * void * pgm_rs_decode_parity_appended ( * pgm_rs_t* rs, * pgm_gf8_t* block, * const uint8_t* offsets, * const uint16_t len * ) */ START_TEST (test_decode_parity_appended_pass_001) { const gchar source[] = "i am not a string"; const guint16 source_len = strlen (source); pgm_rs_t rs; const guint8 k = source_len; const guint8 parity_index = k; const guint16 packet_len = 100; pgm_gf8_t* source_packets[k+1]; /* include 1 appended parity packet */ pgm_gf8_t* parity_packet = g_malloc0 (packet_len); pgm_rs_create (&rs, 255, k); for (unsigned i = 0; i < k; i++) { source_packets[i] = g_malloc0 (packet_len); source_packets[i][0] = source[i]; } pgm_rs_encode (&rs, (const pgm_gf8_t**)source_packets, parity_index, parity_packet, packet_len); /* simulate error occuring at index #3 */ const guint erased_index = 3; source_packets[erased_index][0] = 'X'; for (unsigned i = 0; i < k; i++) { g_message ("damaged-packet#%2.2d: 0x%2.2x '%c'", i, source_packets[i][0], source_packets[i][0]); } guint8 offsets[k]; for (unsigned i = 0; i < k; i++) offsets[i] = i; /* erased offset now points to parity packet at k */ offsets[erased_index] = parity_index; /* erase damaged packet */ memset (source_packets[erased_index], 0, packet_len); /* append parity to source packet block */ source_packets[parity_index] = parity_packet; pgm_rs_decode_parity_appended (&rs, source_packets, offsets, packet_len); pgm_rs_destroy (&rs); for (unsigned i = 0; i < k; i++) { g_message ("repaired-packet#%2.2d: 0x%2.2x '%c'", i, source_packets[i][0], source_packets[i][0]); } } END_TEST START_TEST (test_decode_parity_appended_fail_001) { pgm_rs_decode_parity_appended (NULL, NULL, NULL, 0); fail ("reached"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_create = tcase_create ("create"); suite_add_tcase (s, tc_create); tcase_add_test (tc_create, test_create_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_create, test_create_fail_001, SIGABRT); #endif TCase* tc_destroy = tcase_create ("destroy"); suite_add_tcase (s, tc_destroy); tcase_add_test (tc_destroy, test_destroy_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_destroy, test_destroy_fail_001, SIGABRT); #endif TCase* tc_encode = tcase_create ("encode"); suite_add_tcase (s, tc_encode); tcase_add_test (tc_encode, test_encode_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_encode, test_encode_fail_001, SIGABRT); #endif TCase* tc_decode_parity_inline = tcase_create ("decode-parity-inline"); suite_add_tcase (s, tc_decode_parity_inline); tcase_add_test (tc_decode_parity_inline, test_decode_parity_inline_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_decode_parity_inline, test_decode_parity_inline_fail_001, SIGABRT); #endif TCase* tc_decode_parity_appended = tcase_create ("decode-parity-appended"); suite_add_tcase (s, tc_decode_parity_appended); tcase_add_test (tc_decode_parity_appended, test_decode_parity_appended_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_decode_parity_appended, test_decode_parity_appended_fail_001, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/crossmingw.py0000644000175000017500000001142411640407354020312 0ustar locallocalimport os import os.path import string import SCons.Action import SCons.Builder import SCons.Tool import SCons.Util # This is what we search for to find mingw: prefixes = SCons.Util.Split(""" mingw32- i386-mingw32msvc- i486-mingw32msvc- i586-mingw32msvc- i686-mingw32msvc- """) def find(env): for prefix in prefixes: # First search in the SCons path and then the OS path: if env.WhereIs(prefix + 'gcc') or SCons.Util.WhereIs(prefix + 'gcc'): return prefix return '' def shlib_generator(target, source, env, for_signature): cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) def_target = env.FindIxes(target, 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX') if def_target: cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) return [cmd] def shlib_emitter(target, source, env): dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') no_import_lib = env.get('no_import_lib', 0) if not dll: raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") if not no_import_lib and \ not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): # Append an import library to the list of targets. target.append(env.ReplaceIxes(dll, 'SHLIBPREFIX', 'SHLIBSUFFIX', 'LIBPREFIX', 'LIBSUFFIX')) # Append a def file target if there isn't already a def file target # or a def file source. There is no option to disable def file # target emitting, because I can't figure out why someone would ever # want to turn it off. def_source = env.FindIxes(source, 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX') def_target = env.FindIxes(target, 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX') if not def_source and not def_target: target.append(env.ReplaceIxes(dll, 'SHLIBPREFIX', 'SHLIBSUFFIX', 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX')) return (target, source) # TODO: Backported to old scons version #shlib_action = SCons.Action.CommandGenerator(shlib_generator) shlib_action = SCons.Action.Action(shlib_generator,generator=1) res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', source_scanner=SCons.Tool.SourceFileScanner) SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) def generate(env): mingw_prefix = find(env) if mingw_prefix: dir = os.path.dirname(env.WhereIs(mingw_prefix + 'gcc') or SCons.Util.WhereIs(mingw_prefix + 'gcc')) # The mingw bin directory must be added to the path: path = env['ENV'].get('PATH', []) if not path: path = [] if SCons.Util.is_String(path): path = string.split(path, os.pathsep) env['ENV']['PATH'] = string.join([dir] + path, os.pathsep) # Most of mingw is the same as gcc and friends... gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas'] for tool in gnu_tools: SCons.Tool.Tool(tool)(env) #... but a few things differ: env['CC'] = mingw_prefix + 'gcc' env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['CXX'] = mingw_prefix + 'g++' env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = shlib_action env.Append(SHLIBEMITTER = [shlib_emitter]) # This line isn't required and breaks C++ linking #env['LINK'] = mingw_prefix + 'g++' env['AS'] = mingw_prefix + 'as' env['AR'] = mingw_prefix + 'ar' env['RANLIB'] = mingw_prefix + 'ranlib' env['WIN32DEFPREFIX'] = '' env['WIN32DEFSUFFIX'] = '.def' env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['RC'] = mingw_prefix + 'windres' env['RCFLAGS'] = SCons.Util.CLVar('') env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET)} $)' env['RCINCPREFIX'] = '--include-dir ' env['RCINCSUFFIX'] = '' env['RCCOM'] = '$RC $RCINCFLAGS $RCINCPREFIX $SOURCE.dir $RCFLAGS -i $SOURCE -o $TARGET' env['BUILDERS']['RES'] = res_builder # Some setting from the platform also have to be overridden: env['OBJPREFIX'] = '' env['OBJSUFFIX'] = '.o' env['LIBPREFIX'] = 'lib' env['LIBSUFFIX'] = '.a' env['SHOBJPREFIX'] = '$OBJPREFIX' env['SHOBJSUFFIX'] = '$OBJSUFFIX' env['PROGPREFIX'] = '' env['PROGSUFFIX'] = '.exe' env['LIBPREFIX'] = '' env['LIBSUFFIX'] = '.lib' env['SHLIBPREFIX'] = '' env['SHLIBSUFFIX'] = '.dll' env['LIBPREFIXES'] = [ '$LIBPREFIX' ] env['LIBSUFFIXES'] = [ '$LIBSUFFIX' ] def exists(env): return find(env) libpgm-5.1.118-1~dfsg/openpgm/pgm/md5.c0000644000175000017500000002464611640407354016410 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * MD5 hashing algorithm. * * MD5 original source GNU C Library: * Includes functions to compute MD5 message digest of files or memory blocks * according to the definition of MD5 in RFC 1321 from April 1992. * * Copyright (C) 1995, 1996, 2001, 2003 Free Software Foundation, Inc. * * This file is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this file; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include //#define MD5_DEBUG /* locals */ static void _pgm_md5_process_block (struct pgm_md5_t*restrict, const void*restrict, size_t); static void* _pgm_md5_read_ctx (const struct pgm_md5_t*restrict, void*restrict); /* This array contains the bytes used to pad the buffer to the next * 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; #if (defined( __sun ) && defined( _BIT_FIELDS_LTOH )) || \ (!defined( __sun ) && __BYTE_ORDER == __LITTLE_ENDIAN) # define SWAP(n) (n) #else # define SWAP(n) (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #endif /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ PGM_GNUC_INTERNAL void pgm_md5_init_ctx ( struct pgm_md5_t* ctx ) { /* pre-conditions */ pgm_assert (NULL != ctx); ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ static void _pgm_md5_process_block ( struct pgm_md5_t* restrict ctx, const void* restrict buffer, size_t len ) { /* pre-conditions */ pgm_assert (NULL != buffer); pgm_assert (len > 0); pgm_assert (NULL != ctx); uint32_t correct_words[16]; const uint32_t *words = buffer; const size_t nwords = len / sizeof (uint32_t); const uint32_t *endp = words + nwords; uint32_t A = ctx->A; uint32_t B = ctx->B; uint32_t C = ctx->C; uint32_t D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { uint32_t *cwp = correct_words; uint32_t A_save = A; uint32_t B_save = B; uint32_t C_save = C; uint32_t D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for * cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } PGM_GNUC_INTERNAL void pgm_md5_process_bytes ( struct pgm_md5_t* restrict ctx, const void* restrict buffer, size_t len ) { /* pre-conditions */ if (len > 0) { pgm_assert (NULL != buffer); } pgm_assert (NULL != ctx); if (len >= 64) { #ifndef _STRING_ARCH_unaligned /* To check alignment gcc has an appropriate operator. Other compilers don't. */ # if __GNUC__ >= 2 # define UNALIGNED_P(p) (((uintptr_t)p) % __alignof__ (uint32_t) != 0) # else # define UNALIGNED_P(p) (((uintptr_t)p) % sizeof(uint32_t) != 0) # endif if (UNALIGNED_P (buffer)) while (len > 64) { _pgm_md5_process_block (ctx, memcpy (ctx->buffer, buffer, 64), 64); buffer = (const char*)buffer + 64; len -= 64; } else #endif { _pgm_md5_process_block (ctx, buffer, len & ~63); buffer = (const char*)buffer + (len & ~63); len &= 63; } } /* Move remaining bytes in internal buffer. */ if (len > 0) { size_t left_over = ctx->buflen; memcpy (&ctx->buffer[left_over], buffer, len); left_over += len; if (left_over >= 64) { _pgm_md5_process_block (ctx, ctx->buffer, 64); left_over -= 64; memcpy (ctx->buffer, &ctx->buffer[64], left_over); } ctx->buflen = left_over; } } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ static void* _pgm_md5_read_ctx ( const struct pgm_md5_t* restrict ctx, void* restrict resbuf ) { /* pre-conditions */ pgm_assert (NULL != ctx); pgm_assert (NULL != resbuf); ((uint32_t*)resbuf)[0] = SWAP (ctx->A); ((uint32_t*)resbuf)[1] = SWAP (ctx->B); ((uint32_t*)resbuf)[2] = SWAP (ctx->C); ((uint32_t*)resbuf)[3] = SWAP (ctx->D); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ PGM_GNUC_INTERNAL void* pgm_md5_finish_ctx ( struct pgm_md5_t* restrict ctx, void* restrict resbuf ) { /* pre-conditions */ pgm_assert (NULL != ctx); pgm_assert (NULL != resbuf); /* Take yet unprocessed bytes into account. */ const uint32_t bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(uint32_t*) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(uint32_t*) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ _pgm_md5_process_block (ctx, ctx->buffer, bytes + pad + 8); return _pgm_md5_read_ctx (ctx, resbuf); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/win64/0000755000175000017500000000000011640407424016510 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/win64/mingw-w64-bin_x86-64-linux_4.4.1-1openpgm1.diff0000644000175000017500000000251111640407354026272 0ustar locallocaldiff -urN include-original/./ws2tcpip.h x86_64-w64-mingw32/include/./ws2tcpip.h --- include-original/./ws2tcpip.h 2009-09-10 13:36:49.000000000 +0800 +++ x86_64-w64-mingw32/include/./ws2tcpip.h 2010-01-21 14:59:13.000000000 +0800 @@ -12,6 +12,25 @@ #include +struct group_req { + u_long gr_interface; + struct sockaddr_storage gr_group; +}; + +struct group_source_req { + u_long gsr_interface; + struct sockaddr_storage gsr_group; + struct sockaddr_storage gsr_source; +}; + +struct group_filter { + u_long gf_interface; + struct sockaddr_storage gf_group; + u_long gf_fmode; + u_long gf_numsrc; + struct sockaddr_storage gf_slist[1]; +}; + struct ip_msfilter { struct in_addr imsf_multiaddr; struct in_addr imsf_interface; @@ -22,6 +41,15 @@ #define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter)-sizeof(struct in_addr) + (numsrc)*sizeof(struct in_addr)) +/* RFC 3768 */ +#define MCAST_JOIN_GROUP 41 +#define MCAST_LEAVE_GROUP 42 +#define MCAST_BLOCK_SOURCE 43 +#define MCAST_UNBLOCK_SOURCE 44 +#define MCAST_JOIN_SOURCE_GROUP 45 +#define MCAST_LEAVE_SOURCE_GROUP 46 +#define MCAST_MSFILTER 47 + #define MCAST_INCLUDE 0 #define MCAST_EXCLUDE 1 @@ -277,6 +305,7 @@ #define AI_PASSIVE 0x1 #define AI_CANONNAME 0x2 #define AI_NUMERICHOST 0x4 +#define AI_ADDRCONFIG 0x20 #ifdef __cplusplus extern "C" { libpgm-5.1.118-1~dfsg/openpgm/pgm/txw.c.c89.patch0000644000175000017500000001103511640407354020231 0ustar locallocal--- txw.c 2011-03-12 10:37:12.000000000 +0800 +++ txw.c89.c 2011-03-12 11:15:05.000000000 +0800 @@ -193,12 +193,13 @@ pgm_debug ("create (tsi:%s max-tpdu:%" PRIu16 " sqns:%" PRIu32 " secs %u max-rte %" PRIzd " use-fec:%s rs(n):%u rs(k):%u)", pgm_tsi_print (tsi), - tpdu_size, sqns, secs, max_rte, + tpdu_size, sqns, secs, (long)max_rte, use_fec ? "YES" : "NO", rs_n, rs_k); /* calculate transmit window parameters */ pgm_assert (sqns || (tpdu_size && secs && max_rte)); + { const unsigned alloc_sqns = sqns ? sqns : (unsigned)( (secs * max_rte) / tpdu_size ); window = pgm_malloc0 (sizeof(pgm_txw_t) + ( alloc_sqns * sizeof(struct pgm_sk_buff_t*) )); window->tsi = tsi; @@ -230,6 +231,7 @@ pgm_assert (!pgm_txw_retransmit_can_peek (window)); return window; + } } /* destructor for transmit window. must not be called more than once for same window. @@ -317,8 +319,10 @@ skb->sequence = window->lead; /* add skb to window */ + { const uint_fast32_t index_ = skb->sequence % pgm_txw_max_length (window); window->pdata[index_] = skb; + } /* statistics */ window->size += skb->len; @@ -455,6 +459,7 @@ pgm_assert (NULL != window); pgm_assert_cmpuint (tg_sqn_shift, <, 8 * sizeof(uint32_t)); + { const uint32_t tg_sqn_mask = 0xffffffff << tg_sqn_shift; const uint32_t nak_tg_sqn = sequence & tg_sqn_mask; /* left unshifted */ const uint32_t nak_pkt_cnt = sequence & ~tg_sqn_mask; @@ -493,6 +498,7 @@ pgm_assert (!pgm_queue_is_empty (&window->retransmit_queue)); state->waiting_retransmit = 1; return TRUE; + } } static @@ -585,10 +591,13 @@ } /* generate parity packet to satisify request */ + { const uint8_t rs_h = state->pkt_cnt_sent % (window->rs.n - window->rs.k); const uint32_t tg_sqn_mask = 0xffffffff << window->tg_sqn_shift; const uint32_t tg_sqn = skb->sequence & tg_sqn_mask; - for (uint_fast8_t i = 0; i < window->rs.k; i++) + { + uint_fast8_t i; + for (i = 0; i < window->rs.k; i++) { const struct pgm_sk_buff_t* odata_skb = pgm_txw_peek (window, tg_sqn + i); const uint16_t odata_tsdu_length = ntohs (odata_skb->pgm_header->pgm_tsdu_length); @@ -608,6 +617,7 @@ is_op_encoded = TRUE; } } + } /* construct basic PGM header to be completed by send_rdata() */ skb = window->parity_buffer; @@ -627,7 +637,9 @@ { skb->pgm_header->pgm_options |= PGM_OPT_VAR_PKTLEN; - for (uint_fast8_t i = 0; i < window->rs.k; i++) + { + uint_fast8_t i; + for (i = 0; i < window->rs.k; i++) { struct pgm_sk_buff_t* odata_skb = pgm_txw_peek (window, tg_sqn + i); const uint16_t odata_tsdu_length = ntohs (odata_skb->pgm_header->pgm_tsdu_length); @@ -641,6 +653,7 @@ odata_skb->zero_padded = 1; } } + } parity_length += 2; } @@ -657,17 +670,21 @@ */ if (is_op_encoded) { - struct pgm_opt_header *opt_header; - struct pgm_opt_length *opt_len; - struct pgm_opt_fragment *opt_fragment, null_opt_fragment; - const pgm_gf8_t *opt_src[ window->rs.k ]; + struct pgm_opt_header *opt_header; + struct pgm_opt_length *opt_len; + struct pgm_opt_fragment *opt_fragment, null_opt_fragment; + const pgm_gf8_t **opt_src; skb->pgm_header->pgm_options |= PGM_OPT_PRESENT; memset (&null_opt_fragment, 0, sizeof(null_opt_fragment)); *(uint8_t*)&null_opt_fragment |= PGM_OP_ENCODED_NULL; - for (uint_fast8_t i = 0; i < window->rs.k; i++) + opt_src = pgm_newa (pgm_gf8_t*, window->rs.k); + + { + uint_fast8_t i; + for (i = 0; i < window->rs.k; i++) { const struct pgm_sk_buff_t* odata_skb = pgm_txw_peek (window, tg_sqn + i); @@ -682,8 +699,10 @@ opt_src[i] = (pgm_gf8_t*)&null_opt_fragment; } } + } /* add options to this rdata packet */ + { const uint16_t opt_total_length = sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); @@ -695,6 +714,7 @@ opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ( opt_total_length ); + } opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_FRAGMENT | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); @@ -723,9 +743,12 @@ parity_length); /* calculate partial checksum */ + { const uint16_t tsdu_length = ntohs (skb->pgm_header->pgm_tsdu_length); state->unfolded_checksum = pgm_csum_partial ((char*)skb->tail - tsdu_length, tsdu_length, 0); + } return skb; + } } /* remove head entry from retransmit queue, will fail on assertion if queue is empty. libpgm-5.1.118-1~dfsg/openpgm/pgm/snmp.c0000644000175000017500000001265211640407354016672 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * SNMP agent, single session. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include "pgm/snmp.h" #include "impl/pgmMIB.h" /* globals */ bool pgm_agentx_subagent = TRUE; char* pgm_agentx_socket = NULL; const char* pgm_snmp_appname = "PGM"; /* locals */ #ifndef _WIN32 static pthread_t snmp_thread; static void* snmp_routine (void*); #else static HANDLE snmp_thread; static unsigned __stdcall snmp_routine (void*); #endif static pgm_notify_t snmp_notify = PGM_NOTIFY_INIT; static volatile uint32_t snmp_ref_count = 0; /* Calling application needs to redirect SNMP logging before prior to this * function. */ bool pgm_snmp_init ( pgm_error_t** error ) { if (pgm_atomic_exchange_and_add32 (&snmp_ref_count, 1) > 0) return TRUE; if (pgm_agentx_subagent) { pgm_minor (_("Configuring as SNMP AgentX sub-agent.")); if (pgm_agentx_socket) { pgm_minor (_("Using AgentX socket %s."), pgm_agentx_socket); netsnmp_ds_set_string (NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, pgm_agentx_socket); } netsnmp_ds_set_boolean (NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, TRUE); } pgm_minor (_("Initialising SNMP agent.")); if (0 != init_agent (pgm_snmp_appname)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SNMP, PGM_ERROR_FAILED, _("Initialise SNMP agent: see SNMP log for further details.")); goto err_cleanup; } if (!pgm_mib_init (error)) { goto err_cleanup; } /* read config and parse mib */ pgm_minor (_("Initialising SNMP.")); init_snmp (pgm_snmp_appname); if (!pgm_agentx_subagent) { pgm_minor (_("Connecting to SNMP master agent.")); if (0 != init_master_agent ()) { pgm_set_error (error, PGM_ERROR_DOMAIN_SNMP, PGM_ERROR_FAILED, _("Initialise SNMP master agent: see SNMP log for further details.")); snmp_shutdown (pgm_snmp_appname); goto err_cleanup; } } /* create notification channel */ if (0 != pgm_notify_init (&snmp_notify)) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SNMP, pgm_error_from_errno (errno), _("Creating SNMP notification channel: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); snmp_shutdown (pgm_snmp_appname); goto err_cleanup; } /* spawn thread to handle SNMP requests */ #ifndef _WIN32 const int status = pthread_create (&snmp_thread, NULL, &snmp_routine, NULL); if (0 != status) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SNMP, pgm_error_from_errno (errno), _("Creating SNMP thread: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); snmp_shutdown (pgm_snmp_appname); goto err_cleanup; } #else snmp_thread = (HANDLE)_beginthreadex (NULL, 0, &snmp_routine, NULL, 0, NULL); const int save_errno = errno; if (0 == snmp_thread) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SNMP, pgm_error_from_errno (save_errno), _("Creating SNMP thread: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), save_errno)); snmp_shutdown (pgm_snmp_appname); goto err_cleanup; } #endif /* _WIN32 */ return TRUE; err_cleanup: if (pgm_notify_is_valid (&snmp_notify)) { pgm_notify_destroy (&snmp_notify); } pgm_atomic_dec32 (&snmp_ref_count); return FALSE; } /* Terminate SNMP thread and free resources. */ bool pgm_snmp_shutdown (void) { pgm_return_val_if_fail (pgm_atomic_read32 (&snmp_ref_count) > 0, FALSE); if (pgm_atomic_exchange_and_add32 (&snmp_ref_count, (uint32_t)-1) != 1) return TRUE; pgm_notify_send (&snmp_notify); #ifndef _WIN32 pthread_join (snmp_thread, NULL); #else WaitForSingleObject (snmp_thread, INFINITE); CloseHandle (snmp_thread); #endif pgm_notify_destroy (&snmp_notify); snmp_shutdown (pgm_snmp_appname); return TRUE; } /* Thread routine for processing SNMP requests */ static #ifndef _WIN32 void* #else unsigned __stdcall #endif snmp_routine ( PGM_GNUC_UNUSED void* arg ) { const SOCKET notify_fd = pgm_notify_get_socket (&snmp_notify); for (;;) { int fds = 0, block = 1; fd_set fdset; struct timeval timeout; FD_ZERO(&fdset); snmp_select_info (&fds, &fdset, &timeout, &block); FD_SET(notify_fd, &fdset); if ((notify_fd + 1) > fds) fds = notify_fd + 1; fds = select (fds, &fdset, NULL, NULL, block ? NULL : &timeout); if (FD_ISSET(notify_fd, &fdset)) break; if (fds) snmp_read (&fdset); else snmp_timeout(); } /* cleanup */ #ifndef _WIN32 return NULL; #else _endthread(); return 0; #endif /* WIN32 */ } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/fec.txt0000644000175000017500000000174711640407354017052 0ustar locallocalpkt:k=1 non-parity rs eqn: n = 255 k = 2t 255 = 2k k = 128 => 2t = 128 -------------------------------------------------------------------------------- 1456, 1442 pkt:k=2 ( 2 data packets ) 1 packet loss: pkt:h=1 pkt:n=3 rs eqn: n = 255 # reed-solomon codes = tsdu / n k = 2 4 6 ... 254 => 2t = 1 2 3 127 (k/2) 255 = k + (k/2) 510 = 2k + k 510 = 3k 170 = k => 2t = 85 2 packet loss: pkt:h=2 pkts pkt:n=4 pkts -------------------------------------------------------------------------------- pkt:k=4 ( 4 data packets ) 1 packet loss: 255 = k + (k/4) k = 51 2t = 13 (rounded up) -------------------------------------------------------------------------------- pkt:k=8 ( 8 data packets ) 1 packet loss: 255 = k + (k/8) k = 29 2t = 4 (rounded up) -------------------------------------------------------------------------------- pkt:k=16 ( 16 data packets ) 1 packet loss: 255 = k + (k/16) k = 15 2t = 1 (invalid?) 2 packet loss: 255 = k + (2k/16) k = 29 2t = 4 libpgm-5.1.118-1~dfsg/openpgm/pgm/inet_network_unittest.c0000644000175000017500000001540311640407354022361 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for portable implementations of inet_network and inet_network6. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #ifndef _WIN32 # include # include # include # include #else # include # include #endif #include #include /* mock state */ /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } #define INET_NETWORK_DEBUG #include "inet_network.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * int * pgm_inet_network ( * const char* s, * struct in_addr* in -- in host byte order * ) */ struct test_case_t { const char* network; const char* answer; }; static const struct test_case_t cases_001[] = { { "127", "127.0.0.0" }, /* different to inet_addr/inet_network */ { "127/8", "127.0.0.0" }, { "127.1/8", "127.0.0.0" }, { "127.1", "127.1.0.0" }, /* different to inet_addr/inet_network */ { "127.x.x.x", "127.0.0.0" }, { "127.X.X.X", "127.0.0.0" }, { "127.0.0.0", "127.0.0.0" }, { "127.0.0.1/8", "127.0.0.0" }, { "127.0.0.1/32", "127.0.0.1" }, { "10.0.0.0/8", "10.0.0.0" }, /* RFC1918 class A */ { "10.255.255.255/8", "10.0.0.0" }, { "172.16.0.0/12", "172.16.0.0" }, /* RFC1918 class B */ { "172.31.255.255/12", "172.16.0.0" }, { "192.168.0.0/16", "192.168.0.0" }, /* RFC1918 class C */ { "192.168.255.255/16", "192.168.0.0" }, { "169.254.0.0/16", "169.254.0.0" }, /* RFC3927 link-local */ { "192.88.99.0/24", "192.88.99.0" }, /* RFC3068 6to4 relay anycast */ { "224.0.0.0/4", "224.0.0.0" }, /* RFC3171 multicast */ { "0.0.0.0", "0.0.0.0" }, { "255.255.255.255", "255.255.255.255" }, }; START_TEST (test_inet_network_pass_001) { const char* network = cases_001[_i].network; const char* answer = cases_001[_i].answer; struct in_addr host_order, network_order; fail_unless (0 == pgm_inet_network (network, &host_order), "inet_network failed"); network_order.s_addr = g_htonl (host_order.s_addr); g_message ("Resolved \"%s\" to \"%s\"", network, inet_ntoa (network_order)); #ifdef DEBUG_INET_NETWORK { struct in_addr t = { .s_addr = g_htonl (inet_network (network)) }; g_message ("inet_network (%s) = %s", network, inet_ntoa (t)); } #endif fail_unless (0 == strcmp (answer, inet_ntoa (network_order)), "unexpected answer"); } END_TEST START_TEST (test_inet_network_fail_001) { fail_unless (-1 == pgm_inet_network (NULL, NULL), "inet_network failed"); } END_TEST START_TEST (test_inet_network_fail_002) { const char* network = "192.168.0.1/0"; struct in_addr host_order; fail_unless (-1 == pgm_inet_network (network, &host_order), "inet_network failed"); } END_TEST /* target: * int * pgm_inet6_network ( * const char* s, * struct in6_addr* in6 * ) */ static const struct test_case_t cases6_001[] = { { "::1/128", "::1" }, { "2002:dec8:d28e::36/64", "2002:dec8:d28e::" }, /* 6to4 */ { "fe80::203:baff:fe4e:6cc8/10", "fe80::" }, /* link-local */ { "ff02::1/8", "ff00::" }, /* multicast */ { "fc00:6::61/7", "fc00::" }, /* ULA */ }; START_TEST (test_inet6_network_pass_001) { const char* network = cases6_001[_i].network; const char* answer = cases6_001[_i].answer; char snetwork[INET6_ADDRSTRLEN]; struct in6_addr addr; fail_unless (0 == pgm_inet6_network (network, &addr), "inet6_network failed"); g_message ("Resolved \"%s\" to \"%s\"", network, pgm_inet_ntop (AF_INET6, &addr, snetwork, sizeof(snetwork))); fail_unless (0 == strcmp (answer, snetwork), "unexpected answer"); } END_TEST START_TEST (test_inet6_network_fail_001) { fail_unless (-1 == pgm_inet6_network (NULL, NULL), "inet6_network failed"); } END_TEST START_TEST (test_sa6_network_pass_001) { const char* network = cases6_001[_i].network; const char* answer = cases6_001[_i].answer; char snetwork[INET6_ADDRSTRLEN]; struct sockaddr_in6 addr; fail_unless (0 == pgm_sa6_network (network, &addr), "sa6_network failed"); pgm_sockaddr_ntop ((struct sockaddr*)&addr, snetwork, sizeof (snetwork)); g_message ("Resolved \"%s\" to \"%s\"", network, snetwork); fail_unless (0 == strcmp (answer, snetwork), "unexpected answer"); } END_TEST START_TEST (test_sa6_network_fail_001) { fail_unless (-1 == pgm_sa6_network (NULL, NULL), "sa6_network failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_inet_network = tcase_create ("inet-network"); suite_add_tcase (s, tc_inet_network); tcase_add_loop_test (tc_inet_network, test_inet_network_pass_001, 0, G_N_ELEMENTS(cases_001)); tcase_add_test (tc_inet_network, test_inet_network_fail_001); TCase* tc_inet6_network = tcase_create ("inet6-network"); suite_add_tcase (s, tc_inet6_network); tcase_add_loop_test (tc_inet6_network, test_inet6_network_pass_001, 0, G_N_ELEMENTS(cases6_001)); tcase_add_test (tc_inet6_network, test_inet6_network_fail_001); TCase* tc_sa6_network = tcase_create ("sa6-network"); suite_add_tcase (s, tc_sa6_network); tcase_add_loop_test (tc_sa6_network, test_sa6_network_pass_001, 0, G_N_ELEMENTS(cases6_001)); tcase_add_test (tc_sa6_network, test_sa6_network_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/thread_unittest.c0000644000175000017500000003535211640407354021125 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for concurrency operations. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include /* mock state */ /* mock functions for external references */ #include "thread.c" static void mock_setup (void) { pgm_thread_init (); } static void mock_teardown (void) { pgm_thread_shutdown (); } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * void * pgm_thread_init (void) */ START_TEST (test_init_pass_001) { pgm_thread_init (); #ifdef PGM_CHECK_NOFORK pgm_thread_shutdown (); #endif } END_TEST /* target: * void * pgm_thread_shutdown (void) */ START_TEST (test_shutdown_pass_001) { /* unreferences are emitted as warnings */ pgm_thread_shutdown (); pgm_thread_shutdown (); pgm_thread_init (); pgm_thread_shutdown (); } END_TEST /* target: * void * pgm_mutex_init (pgm_mutex_t* mutex) */ START_TEST (test_mutex_init_pass_001) { pgm_mutex_t mutex; pgm_mutex_init (&mutex); #ifdef PGM_CHECK_NOFORK pgm_mutex_free (&mutex); #endif } END_TEST /* target: * void * pgm_mutex_free (pgm_mutex_t* mutex) */ START_TEST (test_mutex_free_pass_001) { pgm_mutex_t mutex; pgm_mutex_init (&mutex); pgm_mutex_free (&mutex); } END_TEST /* target: * void * pgm_mutex_lock (pgm_mutex_t* mutex) */ START_TEST (test_mutex_lock_pass_001) { pgm_mutex_t mutex; pgm_mutex_init (&mutex); pgm_mutex_lock (&mutex); #ifdef PGM_CHECK_NOFORK pgm_mutex_unlock (&mutex); pgm_mutex_free (&mutex); #endif } END_TEST /* target: * void * pgm_mutex_unlock (pgm_mutex_t* mutex) */ START_TEST (test_mutex_unlock_pass_001) { pgm_mutex_t mutex; pgm_mutex_init (&mutex); pgm_mutex_lock (&mutex); pgm_mutex_unlock (&mutex); pgm_mutex_free (&mutex); } END_TEST /* target: * bool * pgm_mutex_trylock (pgm_mutex_t* mutex) */ START_TEST (test_mutex_trylock_pass_001) { pgm_mutex_t mutex; pgm_mutex_init (&mutex); fail_unless (TRUE == pgm_mutex_trylock (&mutex), "initial state lock"); #ifndef _WIN32 fail_unless (FALSE == pgm_mutex_trylock (&mutex), "locked mutex"); #else /* only works in separate threads */ fail_unless (TRUE == pgm_mutex_trylock (&mutex), "locked mutex"); #endif pgm_mutex_unlock (&mutex); fail_unless (TRUE == pgm_mutex_trylock (&mutex), "unlocked mutex"); pgm_mutex_unlock (&mutex); pgm_mutex_free (&mutex); } END_TEST /* target: * void * pgm_spinlock_init (pgm_spinlock_t* spinlock) */ START_TEST (test_spinlock_init_pass_001) { pgm_spinlock_t spinlock; pgm_spinlock_init (&spinlock); #ifdef PGM_CHECK_NOFORK pgm_spinlock_free (&spinlock); #endif } END_TEST /* target: * void * pgm_spinlock_free (pgm_spinlock_t* spinlock) */ START_TEST (test_spinlock_free_pass_001) { pgm_spinlock_t spinlock; pgm_spinlock_init (&spinlock); pgm_spinlock_free (&spinlock); } END_TEST /* target: * void * pgm_spinlock_lock (pgm_spinlock_t* spinlock) */ START_TEST (test_spinlock_lock_pass_001) { pgm_spinlock_t spinlock; pgm_spinlock_init (&spinlock); pgm_spinlock_lock (&spinlock); #ifdef PGM_CHECK_NOFORK pgm_spinlock_unlock (&spinlock); pgm_spinlock_free (&spinlock); #endif } END_TEST /* target: * void * pgm_spinlock_unlock (pgm_spinlock_t* spinlock) */ START_TEST (test_spinlock_unlock_pass_001) { pgm_spinlock_t spinlock; pgm_spinlock_init (&spinlock); pgm_spinlock_lock (&spinlock); pgm_spinlock_unlock (&spinlock); pgm_spinlock_free (&spinlock); } END_TEST /* target: * bool * pgm_spinlock_trylock (pgm_spinlock_t* spinlock) */ START_TEST (test_spinlock_trylock_pass_001) { pgm_spinlock_t spinlock; pgm_spinlock_init (&spinlock); fail_unless (TRUE == pgm_spinlock_trylock (&spinlock), "initial state lock"); fail_unless (FALSE == pgm_spinlock_trylock (&spinlock), "locked spinlock"); pgm_spinlock_unlock (&spinlock); fail_unless (TRUE == pgm_spinlock_trylock (&spinlock), "unlocked spinlock"); pgm_spinlock_unlock (&spinlock); pgm_spinlock_free (&spinlock); } END_TEST /* target: * void * pgm_rwlock_init (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_init_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); #ifdef PGM_CHECK_NOFORK pgm_rwlock_free (&rwlock); #endif } END_TEST /* target: * void * pgm_rwlock_free (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_free_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); pgm_rwlock_free (&rwlock); } END_TEST /* target: * void * pgm_rwlock_reader_lock (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_reader_lock_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); /* multiple readers permitted */ pgm_rwlock_reader_lock (&rwlock); pgm_rwlock_reader_lock (&rwlock); #ifdef PGM_CHECK_NOFORK pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_free (&rwlock); #endif } END_TEST /* target: * void * pgm_rwlock_reader_unlock (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_reader_unlock_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); /* single lock */ pgm_rwlock_reader_lock (&rwlock); pgm_rwlock_reader_unlock (&rwlock); /* multiple lock */ pgm_rwlock_reader_lock (&rwlock); pgm_rwlock_reader_lock (&rwlock); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_free (&rwlock); } END_TEST /* target: * bool * pgm_rwlock_reader_trylock (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_reader_trylock_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "initial state lock"); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader locked"); pgm_rwlock_reader_unlock (&rwlock); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader unlocked"); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_free (&rwlock); } END_TEST /* target: * void * pgm_rwlock_writer_lock (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_writer_lock_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); /* only single writer permitted */ fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "initial state lock"); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_writer_lock (&rwlock); fail_unless (FALSE == pgm_rwlock_reader_trylock (&rwlock), "writer locked"); #ifdef PGM_CHECK_NOFORK pgm_rwlock_writer_unlock (&rwlock); pgm_rwlock_free (&rwlock); #endif } END_TEST /* target: * void * pgm_rwlock_writer_unlock (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_writer_unlock_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); /* single lock */ pgm_rwlock_writer_lock (&rwlock); fail_unless (FALSE == pgm_rwlock_reader_trylock (&rwlock), "writer locked"); pgm_rwlock_writer_unlock (&rwlock); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "writer unlocked"); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_writer_lock (&rwlock); fail_unless (FALSE == pgm_rwlock_reader_trylock (&rwlock), "writer locked"); pgm_rwlock_writer_unlock (&rwlock); pgm_rwlock_free (&rwlock); } END_TEST /* target: * bool * pgm_rwlock_writer_trylock (pgm_rwlock_t* rwlock) */ START_TEST (test_rwlock_writer_trylock_pass_001) { pgm_rwlock_t rwlock; pgm_rwlock_init (&rwlock); /* clean lock */ fail_unless (TRUE == pgm_rwlock_writer_trylock (&rwlock), "writer lock"); pgm_rwlock_writer_unlock (&rwlock); /* blocked writer */ fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader lock"); fail_unless (FALSE == pgm_rwlock_writer_trylock (&rwlock), "writer on reader locked"); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader lock"); fail_unless (FALSE == pgm_rwlock_writer_trylock (&rwlock), "writer on reader locked"); pgm_rwlock_reader_unlock (&rwlock); fail_unless (FALSE == pgm_rwlock_writer_trylock (&rwlock), "writer on reader locked"); pgm_rwlock_reader_unlock (&rwlock); /* blocked reader */ fail_unless (TRUE == pgm_rwlock_writer_trylock (&rwlock), "writer lock"); fail_unless (FALSE == pgm_rwlock_reader_trylock (&rwlock), "reader on writer locked"); fail_unless (FALSE == pgm_rwlock_reader_trylock (&rwlock), "reader on writer locked"); pgm_rwlock_writer_unlock (&rwlock); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader lock"); pgm_rwlock_reader_unlock (&rwlock); /* two step */ fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader lock"); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader lock"); pgm_rwlock_reader_unlock (&rwlock); fail_unless (TRUE == pgm_rwlock_reader_trylock (&rwlock), "reader lock"); pgm_rwlock_reader_unlock (&rwlock); pgm_rwlock_reader_unlock (&rwlock); /* wrapped around regular reader locks */ pgm_rwlock_reader_lock (&rwlock); fail_unless (FALSE == pgm_rwlock_writer_trylock (&rwlock), "writer on reader locked"); pgm_rwlock_reader_lock (&rwlock); fail_unless (FALSE == pgm_rwlock_writer_trylock (&rwlock), "writer on reader locked"); pgm_rwlock_reader_unlock (&rwlock); fail_unless (FALSE == pgm_rwlock_writer_trylock (&rwlock), "writer on reader locked"); pgm_rwlock_reader_unlock (&rwlock); fail_unless (TRUE == pgm_rwlock_writer_trylock (&rwlock), "writer lock"); pgm_rwlock_writer_unlock (&rwlock); pgm_rwlock_free (&rwlock); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_init = tcase_create ("init"); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_init_pass_001); TCase* tc_shutdown = tcase_create ("shutdown"); suite_add_tcase (s, tc_shutdown); tcase_add_test (tc_shutdown, test_shutdown_pass_001); return s; } static Suite* make_mutex_suite (void) { Suite* s; s = suite_create ("mutex"); TCase* tc_init = tcase_create ("init"); tcase_add_checked_fixture (tc_init, mock_setup, mock_teardown); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_mutex_init_pass_001); TCase* tc_free = tcase_create ("free"); tcase_add_checked_fixture (tc_free, mock_setup, mock_teardown); suite_add_tcase (s, tc_free); tcase_add_test (tc_free, test_mutex_free_pass_001); TCase* tc_lock = tcase_create ("lock"); tcase_add_checked_fixture (tc_lock, mock_setup, mock_teardown); suite_add_tcase (s, tc_lock); tcase_add_test (tc_lock, test_mutex_lock_pass_001); TCase* tc_unlock = tcase_create ("unlock"); tcase_add_checked_fixture (tc_unlock, mock_setup, mock_teardown); suite_add_tcase (s, tc_unlock); tcase_add_test (tc_unlock, test_mutex_unlock_pass_001); TCase* tc_trylock = tcase_create ("trylock"); tcase_add_checked_fixture (tc_trylock, mock_setup, mock_teardown); suite_add_tcase (s, tc_trylock); tcase_add_test (tc_trylock, test_mutex_trylock_pass_001); return s; } static Suite* make_spinlock_suite (void) { Suite* s; s = suite_create ("spinlock"); TCase* tc_init = tcase_create ("init"); tcase_add_checked_fixture (tc_init, mock_setup, mock_teardown); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_spinlock_init_pass_001); TCase* tc_free = tcase_create ("free"); tcase_add_checked_fixture (tc_free, mock_setup, mock_teardown); suite_add_tcase (s, tc_free); tcase_add_test (tc_free, test_spinlock_free_pass_001); TCase* tc_lock = tcase_create ("lock"); tcase_add_checked_fixture (tc_lock, mock_setup, mock_teardown); suite_add_tcase (s, tc_lock); tcase_add_test (tc_lock, test_spinlock_lock_pass_001); TCase* tc_unlock = tcase_create ("unlock"); tcase_add_checked_fixture (tc_unlock, mock_setup, mock_teardown); suite_add_tcase (s, tc_unlock); tcase_add_test (tc_unlock, test_spinlock_unlock_pass_001); TCase* tc_trylock = tcase_create ("trylock"); tcase_add_checked_fixture (tc_trylock, mock_setup, mock_teardown); suite_add_tcase (s, tc_trylock); tcase_add_test (tc_trylock, test_spinlock_trylock_pass_001); return s; } static Suite* make_rwlock_suite (void) { Suite* s; s = suite_create ("rwlock"); TCase* tc_init = tcase_create ("init"); tcase_add_checked_fixture (tc_init, mock_setup, mock_teardown); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_rwlock_init_pass_001); TCase* tc_free = tcase_create ("free"); tcase_add_checked_fixture (tc_free, mock_setup, mock_teardown); suite_add_tcase (s, tc_free); tcase_add_test (tc_free, test_rwlock_free_pass_001); TCase* tc_reader_lock = tcase_create ("reader: lock"); tcase_add_checked_fixture (tc_reader_lock, mock_setup, mock_teardown); suite_add_tcase (s, tc_reader_lock); tcase_add_test (tc_reader_lock, test_rwlock_reader_lock_pass_001); TCase* tc_reader_unlock = tcase_create ("reader: unlock"); tcase_add_checked_fixture (tc_reader_unlock, mock_setup, mock_teardown); suite_add_tcase (s, tc_reader_unlock); tcase_add_test (tc_reader_unlock, test_rwlock_reader_unlock_pass_001); TCase* tc_reader_trylock = tcase_create ("reader: trylock"); tcase_add_checked_fixture (tc_reader_trylock, mock_setup, mock_teardown); suite_add_tcase (s, tc_reader_trylock); tcase_add_test (tc_reader_trylock, test_rwlock_reader_trylock_pass_001); TCase* tc_writer_lock = tcase_create ("writer: lock"); tcase_add_checked_fixture (tc_writer_lock, mock_setup, mock_teardown); suite_add_tcase (s, tc_writer_lock); tcase_add_test (tc_writer_lock, test_rwlock_writer_lock_pass_001); TCase* tc_writer_unlock = tcase_create ("writer: unlock"); tcase_add_checked_fixture (tc_writer_unlock, mock_setup, mock_teardown); suite_add_tcase (s, tc_writer_unlock); tcase_add_test (tc_writer_unlock, test_rwlock_writer_unlock_pass_001); TCase* tc_writer_trylock = tcase_create ("writer: trylock"); tcase_add_checked_fixture (tc_writer_trylock, mock_setup, mock_teardown); suite_add_tcase (s, tc_writer_trylock); tcase_add_test (tc_writer_trylock, test_rwlock_writer_trylock_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_add_suite (sr, make_mutex_suite ()); srunner_add_suite (sr, make_spinlock_suite ()); srunner_add_suite (sr, make_rwlock_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/net-snmp.txt0000644000175000017500000000113711640407354020047 0ustar locallocalnet-snmp is hard coded on mib location, only the mib file names can be specified outside of snmptranslate. $ mkdir -p ~/.snmp/mibs $ cp mibs/PGM-MIB-petrova-01.txt ~/.snmp/mibs Basic test: $ snmptranslate -m ALL -IR pgmMIB PGM-MIB::pgmMIB Display full pretty tree: $ snmptranslate -m ALL -Tp -IR pgmMIB +--pgmMIB(112) | +--pgm(1) | | | +--pgmNetworkElement(1) | | | ... Now the framework tool can be used: $ env MIBS="+ALL" mib2c pgmMIB ... To run with SNMP install snmpd, enable "master agentx" and walk: $ env MIBS="+ALL" snmpwalk -v 1 -c public localhost pgmMIB End of MIB libpgm-5.1.118-1~dfsg/openpgm/pgm/sockaddr.c0000644000175000017500000010517611640407354017513 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * struct sockaddr functions independent of in or in6. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #ifndef _WIN32 # include # include #endif #include /* FreeBSD */ #ifndef IPV6_ADD_MEMBERSHIP # define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP # define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif /* OpenSolaris differences */ #if !defined(_WIN32) && !defined(MCAST_MSFILTER) # include #endif #ifndef SOL_IP # define SOL_IP IPPROTO_IP #endif #ifndef SOL_IPV6 # define SOL_IPV6 IPPROTO_IPV6 #endif #ifndef IP_MAX_MEMBERSHIPS # define IP_MAX_MEMBERSHIPS 20 #endif PGM_GNUC_INTERNAL sa_family_t pgm_sockaddr_family ( const struct sockaddr* sa ) { return sa->sa_family; } PGM_GNUC_INTERNAL in_port_t pgm_sockaddr_port ( const struct sockaddr* sa ) { in_port_t sa_port; switch (sa->sa_family) { case AF_INET: { struct sockaddr_in s4; memcpy (&s4, sa, sizeof(s4)); sa_port = s4.sin_port; break; } case AF_INET6: { struct sockaddr_in6 s6; memcpy (&s6, sa, sizeof(s6)); sa_port = s6.sin6_port; break; } default: sa_port = 0; break; } return sa_port; } PGM_GNUC_INTERNAL socklen_t pgm_sockaddr_len ( const struct sockaddr* sa ) { socklen_t sa_len; switch (sa->sa_family) { case AF_INET: sa_len = sizeof(struct sockaddr_in); break; case AF_INET6: sa_len = sizeof(struct sockaddr_in6); break; default: sa_len = 0; break; } return sa_len; } PGM_GNUC_INTERNAL socklen_t pgm_sockaddr_storage_len ( const struct sockaddr_storage* ss ) { socklen_t ss_len; switch (ss->ss_family) { case AF_INET: ss_len = sizeof(struct sockaddr_in); break; case AF_INET6: ss_len = sizeof(struct sockaddr_in6); break; default: ss_len = 0; break; } return ss_len; } PGM_GNUC_INTERNAL uint32_t pgm_sockaddr_scope_id ( const struct sockaddr* sa ) { uint32_t scope_id; if (AF_INET6 == sa->sa_family) { struct sockaddr_in6 s6; memcpy (&s6, sa, sizeof(s6)); scope_id = s6.sin6_scope_id; } else scope_id = 0; return scope_id; } PGM_GNUC_INTERNAL int pgm_sockaddr_ntop ( const struct sockaddr* restrict sa, char* restrict host, size_t hostlen ) { return getnameinfo (sa, pgm_sockaddr_len (sa), host, hostlen, NULL, 0, NI_NUMERICHOST); } PGM_GNUC_INTERNAL int pgm_sockaddr_pton ( const char* restrict src, struct sockaddr* restrict dst /* will error on wrong size */ ) { struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM, /* not really */ .ai_protocol = IPPROTO_TCP, /* not really */ .ai_flags = AI_NUMERICHOST }, *result = NULL; const int status = getaddrinfo (src, NULL, &hints, &result); if (PGM_LIKELY(0 == status)) { memcpy (dst, result->ai_addr, result->ai_addrlen); freeaddrinfo (result); return 1; } return 0; } /* returns tri-state value: 1 if sa is multicast, 0 if sa is not multicast, -1 on error */ PGM_GNUC_INTERNAL int pgm_sockaddr_is_addr_multicast ( const struct sockaddr* sa ) { int retval; switch (sa->sa_family) { case AF_INET: { struct sockaddr_in s4; memcpy (&s4, sa, sizeof(s4)); retval = IN_MULTICAST(ntohl( s4.sin_addr.s_addr )); break; } case AF_INET6: { struct sockaddr_in6 s6; memcpy (&s6, sa, sizeof(s6)); retval = IN6_IS_ADDR_MULTICAST( &s6.sin6_addr ); break; } default: retval = -1; break; } return retval; } /* returns 1 if sa is unspecified, 0 if specified. */ PGM_GNUC_INTERNAL int pgm_sockaddr_is_addr_unspecified ( const struct sockaddr* sa ) { int retval; switch (sa->sa_family) { case AF_INET: { struct sockaddr_in s4; memcpy (&s4, sa, sizeof(s4)); retval = (INADDR_ANY == s4.sin_addr.s_addr); break; } case AF_INET6: { struct sockaddr_in6 s6; memcpy (&s6, sa, sizeof(s6)); retval = IN6_IS_ADDR_UNSPECIFIED( &s6.sin6_addr ); break; } default: retval = -1; break; } return retval; } PGM_GNUC_INTERNAL int pgm_sockaddr_cmp ( const struct sockaddr* restrict sa1, const struct sockaddr* restrict sa2 ) { int retval = 0; if (sa1->sa_family != sa2->sa_family) retval = sa1->sa_family < sa2->sa_family ? -1 : 1; else { switch (sa1->sa_family) { case AF_INET: { struct sockaddr_in sa1_in, sa2_in; memcpy (&sa1_in, sa1, sizeof(sa1_in)); memcpy (&sa2_in, sa2, sizeof(sa2_in)); if (sa1_in.sin_addr.s_addr != sa2_in.sin_addr.s_addr) retval = sa1_in.sin_addr.s_addr < sa2_in.sin_addr.s_addr ? -1 : 1; break; } /* IN6_ARE_ADDR_EQUAL(a,b) only returns true or false, i.e. insufficient for sorting. */ case AF_INET6: { struct sockaddr_in6 sa1_in6, sa2_in6; memcpy (&sa1_in6, sa1, sizeof(sa1_in6)); memcpy (&sa2_in6, sa2, sizeof(sa2_in6)); retval = memcmp (&sa1_in6.sin6_addr, &sa2_in6.sin6_addr, sizeof(struct in6_addr)); if (0 == retval && sa1_in6.sin6_scope_id != sa2_in6.sin6_scope_id) retval = sa1_in6.sin6_scope_id < sa2_in6.sin6_scope_id ? -1 : 1; break; } default: break; } } return retval; } /* IP header included with data. * * If no error occurs, pgm_sockaddr_hdrincl returns zero. Otherwise, a value * of SOCKET_ERROR is returned, and a specific error code can be retrieved * by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_hdrincl ( const SOCKET s, const sa_family_t sa_family, const bool v ) { int retval = SOCKET_ERROR; switch (sa_family) { case AF_INET: { #ifndef _WIN32 /* Solaris:ip(7P) Mentioned but not detailed. * * Linux:ip(7) "A boolean integer flag is zero when it is false, otherwise * true. If enabled, the user supplies an IP header in front of the user * data." Mentions only send-side, nothing about receive-side. * Linux:raw(7) "For receiving the IP header is always included in the packet." * * FreeBSD,OS X:IP(4) provided by example "int hincl = 1;" * * Stevens: "IP_HDRINCL has datatype int." */ const int optval = v ? 1 : 0; #else /* WinSock2:MSDN(IPPROTO_IP Socket Options) "DWORD (boolean)" */ const DWORD optval = v ? 1 : 0; #endif retval = setsockopt (s, IPPROTO_IP, IP_HDRINCL, (const char*)&optval, sizeof(optval)); break; } case AF_INET6: /* method only exists with Windows Sockets 2, just ignore. */ retval = 0; break; default: break; } return retval; } /* Return destination IP address. * * If no error occurs, pgm_sockaddr_pktinfo returns zero. Otherwise, a value * of SOCKET_ERROR is returned, and a specific error code can be retrieved * by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_pktinfo ( const SOCKET s, const sa_family_t sa_family, const bool v ) { int retval = SOCKET_ERROR; #ifndef _WIN32 /* Solaris:ip(7P) "The following options take in_pktinfo_t as the parameter" * Completely different, although ip6(7P) is a little better, "The following * options are boolean switches controlling the reception of ancillary data" * * Linux:ip(7) "A boolean integer flag is zero when it is false, otherwise * true. The argument is a flag that tells the socket whether the IP_PKTINFO * message should be passed or not." * Linux:ipv6(7) Not listed, however IPV6_PKTINFO is with "Argument is a pointer * to a boolean value in an integer." * * Absent from FreeBSD & OS X, suggested replacement IP_RECVDSTADDR. * OS X:IP6(4) "IPV6_PKTINFO int *" * * Stevens: "IP_RECVDSTADDR has datatype int." */ const int optval = v ? 1 : 0; #else /* WinSock2:MSDN(IPPROTO_IP Socket Options) "DWORD" * Also, typo in article shows only support for getsockopt() and not setsockopt(). * Also, Windows 7 introduces IP_ORIGINAL_ARRIVAL_IF for subset of CMSG data, but usage is * designed for IPv4 NAT firewalling and tunneling but not native IPv6. */ const DWORD optval = v ? 1 : 0; #endif switch (sa_family) { case AF_INET: /* MSVC100 defines IP_RECVDSTADDR but is not supported by Windows XP, Windows 7 is functional. * No reference is available on MSDN. */ #if !defined(_WIN32) && defined(IP_RECVDSTADDR) retval = setsockopt (s, IPPROTO_IP, IP_RECVDSTADDR, (const char*)&optval, sizeof(optval)); #else retval = setsockopt (s, IPPROTO_IP, IP_PKTINFO, (const char*)&optval, sizeof(optval)); #endif break; case AF_INET6: /* MSVC does not currently define IPV6_RECVPKTINFO, verify each new SDK release. */ #ifdef IPV6_RECVPKTINFO retval = setsockopt (s, IPPROTO_IPV6, IPV6_RECVPKTINFO, (const char*)&optval, sizeof(optval)); #else retval = setsockopt (s, IPPROTO_IPV6, IPV6_PKTINFO, (const char*)&optval, sizeof(optval)); #endif break; default: break; } return retval; } /* Set IP Router Alert option for all outgoing packets. * * If no error occurs, pgm_sockaddr_router_alert returns zero. Otherwise, a * value of SOCKET_ERROR is returned, and a specific error code can be * retrieved by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_router_alert ( const SOCKET s, const sa_family_t sa_family, const bool v ) { int retval = SOCKET_ERROR; #ifdef CONFIG_IP_ROUTER_ALERT /* Linux:ip(7) "A boolean integer flag is zero when it is false, otherwise * true. Expects an integer flag." * Linux:ipv6(7) "Argument is a pointer to an integer." * * Sent on special queue to rsvpd on Linux and so best avoided. */ const int optval = v ? 1 : 0; switch (sa_family) { case AF_INET: retval = setsockopt (s, IPPROTO_IP, IP_ROUTER_ALERT, (const char*)&optval, sizeof (optval)); break; case AF_INET6: retval = setsockopt (s, IPPROTO_IPV6, IPV6_ROUTER_ALERT, (const char*)&optval, sizeof (optval)); break; default: break; } #else # if defined(CONFIG_HAVE_IPOPTION) /* NB: struct ipoption is not very portable and requires a lot of additional headers. */ const struct ipoption router_alert = { .ipopt_dst = 0, .ipopt_list = { PGM_IPOPT_RA, 0x04, 0x00, 0x00 } }; const int optlen = v ? sizeof (router_alert) : 0; # else /* manually set the IP option */ # ifndef _WIN32 const int ipopt_ra = (PGM_IPOPT_RA << 24) | (0x04 << 16); const int router_alert = htonl (ipopt_ra); # else const DWORD ipopt_ra = (PGM_IPOPT_RA << 24) | (0x04 << 16); const DWORD router_alert = htonl (ipopt_ra); # endif const int optlen = v ? sizeof (router_alert) : 0; # endif switch (sa_family) { case AF_INET: /* Linux:ip(7) "The maximum option size for IPv4 is 40 bytes." * * WinSock2:MSDN(IPPROTO_IP Socket Options) "char []" */ retval = setsockopt (s, IPPROTO_IP, IP_OPTIONS, (const char*)&router_alert, optlen); break; default: break; } #endif return retval; } /* Type-of-service and precedence. * * If no error occurs, pgm_sockaddr_tos returns zero. Otherwise, a value of * SOCKET_ERROR is returned, and a specific error code can be retrieved by * calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_tos ( const SOCKET s, const sa_family_t sa_family, const int tos ) { int retval = SOCKET_ERROR; switch (sa_family) { case AF_INET: { #ifndef _WIN32 /* Solaris:ip(7P) "This option takes an integer argument as its input value." * * Linux:ip(7) "TOS is a byte." * * FreeBSD,OS X:IP(4) provided by example "int tos = IPTOS_LOWDELAY;" * * Stevens: "IP_TOS has datatype int." */ const int optval = tos; #else /* WinSock2:MSDN(IPPROTO_IP Socket Options) "DWORD (boolean) Do not use." * IP_TOS only works on WinSock2 with system override, listed support Windows 2000-only: * http://support.microsoft.com/kb/248611 * Recommended APIs: GQoS (IPv4 only), qWAVE QOS (Vista+) */ const DWORD optval = tos; #endif retval = setsockopt (s, IPPROTO_IP, IP_TOS, (const char*)&optval, sizeof(optval)); break; } case AF_INET6: /* TRAFFIC_CLASS not implemented */ break; default: break; } return retval; } /* Join multicast group. * NB: IPV6_JOIN_GROUP == IPV6_ADD_MEMBERSHIP * * If no error occurs, pgm_sockaddr_join_group returns zero. Otherwise, a * value of SOCKET_ERROR is returned, and a specific error code can be * retrieved by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_join_group ( const SOCKET s, const sa_family_t sa_family, const struct group_req* gr ) { int retval = SOCKET_ERROR; #ifdef CONFIG_HAVE_MCAST_JOIN /* Solaris:ip(7P) "The following options take a struct ip_mreq_source as the * parameter." Presumably with source field zeroed out. * Solaris:ip6(7P) "Takes a struct group_req as the parameter." * Different type for each family, however group_req is protocol-independent. * * WinSock2:MSDN(GROUP_REQ Structure) "The GROUP_REQ structure is used with the * MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP socket options." * Minimum supported client: none supported. * Minimum supported server: Windows Server 2008. * * Stevens: "MCAST_JOIN_GROUP has datatype group_req{}." * * RFC3678: Argument type struct group_req */ const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; retval = setsockopt (s, recv_level, MCAST_JOIN_GROUP, gr, sizeof(struct group_req)); #else switch (sa_family) { case AF_INET: { /* Solaris:ip(7P) Just mentions "Join a multicast group." * No further details provided. * * Linux:ip(7) "Argument is an ip_mreqn structure. For compatibility, the old * ip_mreq structure (present since Linux 1.2) is still supported." * * FreeBSD,OS X:IP(4) provided by example "struct ip_mreq mreq;" * * WinSock2:MSDN(IPPROTO_IP Socket Options) "ip_mreq" * Also, can set ip_mreq.imr_interface to be 0.0.0. * * Stevens: "IP_ADD_MEMBERSHIP has datatype ip_mreq{}." * * RFC3678: Argument type struct ip_mreq */ #ifdef CONFIG_HAVE_IP_MREQN struct ip_mreqn mreqn; struct sockaddr_in ifaddr; memset (&mreqn, 0, sizeof(mreqn)); mreqn.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gr->gr_group)->sin_addr.s_addr; if (!pgm_if_indextoaddr (gr->gr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL)) return -1; mreqn.imr_address.s_addr = ifaddr.sin_addr.s_addr; mreqn.imr_ifindex = gr->gr_interface; retval = setsockopt (s, SOL_IP, IP_ADD_MEMBERSHIP, (const char*)&mreqn, sizeof(mreqn)); #else struct ip_mreq mreq; struct sockaddr_in ifaddr; memset (&mreq, 0, sizeof(mreq)); mreq.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gr->gr_group)->sin_addr.s_addr; if (!pgm_if_indextoaddr (gr->gr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL)) return -1; mreq.imr_interface.s_addr = ifaddr.sin_addr.s_addr; retval = setsockopt (s, SOL_IP, IP_ADD_MEMBERSHIP, (const char*)&mreq, sizeof(mreq)); #endif /* !CONFIG_HAVE_IP_MREQN */ break; } case AF_INET6: { /* Solaris:ip6(7P) "Takes a struct ipv6_mreq as the parameter;" * * Linux:ipv6(7) "Argument is a pointer to a struct ipv6_mreq structure." * * OS X:IP6(4) "IPV6_JOIN_GROUP struct ipv6_mreq *" * * WinSock2:MSDN(IPPROTO_IP Socket Options) "ipv6_mreq" * * Stevens: "IPV6_JOIN_GROUP has datatype ipv6_mreq{}." */ struct ipv6_mreq mreq6; memset (&mreq6, 0, sizeof(mreq6)); mreq6.ipv6mr_multiaddr = ((const struct sockaddr_in6*)&gr->gr_group)->sin6_addr; mreq6.ipv6mr_interface = gr->gr_interface; retval = setsockopt (s, SOL_IPV6, IPV6_ADD_MEMBERSHIP, (const char*)&mreq6, sizeof(mreq6)); break; } default: break; } #endif /* CONFIG_HAVE_MCAST_JOIN */ return retval; } /* leave a joined group */ PGM_GNUC_INTERNAL int pgm_sockaddr_leave_group ( const SOCKET s, const sa_family_t sa_family, const struct group_req* gr ) { int retval = SOCKET_ERROR; #ifdef CONFIG_HAVE_MCAST_JOIN const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; retval = setsockopt (s, recv_level, MCAST_LEAVE_GROUP, gr, sizeof(struct group_req)); #else switch (sa_family) { case AF_INET: { #ifdef CONFIG_HAVE_IP_MREQN struct ip_mreqn mreqn; struct sockaddr_in ifaddr; memset (&mreqn, 0, sizeof(mreqn)); mreqn.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gr->gr_group)->sin_addr.s_addr; if (!pgm_if_indextoaddr (gr->gr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL)) return -1; mreqn.imr_address.s_addr = ifaddr.sin_addr.s_addr; mreqn.imr_ifindex = gr->gr_interface; retval = setsockopt (s, SOL_IP, IP_DROP_MEMBERSHIP, (const char*)&mreqn, sizeof(mreqn)); #else struct ip_mreq mreq; struct sockaddr_in ifaddr; memset (&mreq, 0, sizeof(mreq)); mreq.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gr->gr_group)->sin_addr.s_addr; if (!pgm_if_indextoaddr (gr->gr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL)) return -1; mreq.imr_interface.s_addr = ifaddr.sin_addr.s_addr; retval = setsockopt (s, SOL_IP, IP_DROP_MEMBERSHIP, (const char*)&mreq, sizeof(mreq)); #endif /* !CONFIG_HAVE_IP_MREQN */ break; } case AF_INET6: { struct ipv6_mreq mreq6; memset (&mreq6, 0, sizeof(mreq6)); mreq6.ipv6mr_multiaddr = ((const struct sockaddr_in6*)&gr->gr_group)->sin6_addr; mreq6.ipv6mr_interface = gr->gr_interface; retval = setsockopt (s, SOL_IPV6, IPV6_DROP_MEMBERSHIP, (const char*)&mreq6, sizeof(mreq6)); break; } default: break; } #endif /* CONFIG_HAVE_MCAST_JOIN */ return retval; } /* block either at the NIC or kernel, packets from a particular source */ PGM_GNUC_INTERNAL int pgm_sockaddr_block_source ( const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr ) { int retval = SOCKET_ERROR; #ifdef CONFIG_HAVE_MCAST_JOIN const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; retval = setsockopt (s, recv_level, MCAST_BLOCK_SOURCE, gsr, sizeof(struct group_source_req)); #elif defined(IP_BLOCK_SOURCE) switch (sa_family) { case AF_INET: { struct ip_mreq_source mreqs; struct sockaddr_in ifaddr; memset (&mreqs, 0, sizeof(mreqs)); mreqs.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_group)->sin_addr.s_addr; mreqs.imr_sourceaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_source)->sin_addr.s_addr; pgm_if_indextoaddr (gsr->gsr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL); mreqs.imr_interface.s_addr = ifaddr.sin_addr.s_addr; retval = setsockopt (s, SOL_IP, IP_BLOCK_SOURCE, (const char*)&mreqs, sizeof(mreqs)); break; } case AF_INET6: /* No IPv6 API implemented, MCAST_BLOCK_SOURCE should be available instead. */ break; default: break; } #else /* unused parameters */ (void)s; (void)sa_family; (void)gsr; #endif /* CONFIG_HAVE_MCAST_JOIN */ return retval; } /* unblock a blocked multicast source. */ PGM_GNUC_INTERNAL int pgm_sockaddr_unblock_source ( const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr ) { int retval = SOCKET_ERROR; #ifdef CONFIG_HAVE_MCAST_JOIN const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; retval = setsockopt (s, recv_level, MCAST_UNBLOCK_SOURCE, gsr, sizeof(struct group_source_req)); #elif defined(IP_UNBLOCK_SOURCE) switch (sa_family) { case AF_INET: { struct ip_mreq_source mreqs; struct sockaddr_in ifaddr; memset (&mreqs, 0, sizeof(mreqs)); mreqs.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_group)->sin_addr.s_addr; mreqs.imr_sourceaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_source)->sin_addr.s_addr; pgm_if_indextoaddr (gsr->gsr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL); mreqs.imr_interface.s_addr = ifaddr.sin_addr.s_addr; retval = setsockopt (s, SOL_IP, IP_UNBLOCK_SOURCE, (const char*)&mreqs, sizeof(mreqs)); break; } case AF_INET6: /* No IPv6 API implemented, MCAST_UNBLOCK_SOURCE should be available instead. */ break; default: break; } #else /* unused parameters */ (void)s; (void)sa_family; (void)gsr; #endif /* CONFIG_HAVE_MCAST_JOIN */ return retval; } /* Join source-specific multicast. * NB: Silently reverts to ASM if SSM not supported. * * If no error occurs, pgm_sockaddr_join_source_group returns zero. * Otherwise, a value of SOCKET_ERROR is returned, and a specific error * code can be retrieved by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_join_source_group ( const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr ) { int retval = SOCKET_ERROR; #ifdef CONFIG_HAVE_MCAST_JOIN /* Solaris:ip(7P) "The following options take a struct ip_mreq_source as the * parameter." * Solaris:ip6(7P) "Takes a struct group_source_req as the parameter." * Different type for each family, however group_source_req is protocol- * independent. * * WinSock2:MSDN(GROUP_SOURCE_REQ Structure) "The GROUP_SOURCE_REQ structure is * used with the MCAST_BLOCK_SOURCE, MCAST_JOIN_SOURCE_GROUP, * MCAST_LEAVE_SOURCE_GROUP, and MCAST_UNBLOCK_SOURCE socket options." * * Stevens: "MCAST_JOIN_SOURCE_GROUP has datatype group_source_req{}." * * RFC3678: Argument type struct group_source_req */ const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; retval = setsockopt (s, recv_level, MCAST_JOIN_SOURCE_GROUP, gsr, sizeof(struct group_source_req)); #elif defined(IP_ADD_SOURCE_MEMBERSHIP) switch (sa_family) { case AF_INET: { /* Solaris:ip(7P) "The following options take a struct ip_mreq as the * parameter." Incorrect literature wrt RFC. * * Linux:ip(7) absent. * * OS X:IP(4) absent. * * WinSock2:MSDN(IPPROTO_IP Socket Options) "ip_mreq_source" * * Stevens: "IP_ADD_SOURCE_MEMBERSHIP has datatype ip_mreq_source{}." * * RFC3678: Argument type struct ip_mreq_source */ struct ip_mreq_source mreqs; struct sockaddr_in ifaddr; memset (&mreqs, 0, sizeof(mreqs)); mreqs.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_group)->sin_addr.s_addr; mreqs.imr_sourceaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_source)->sin_addr.s_addr; pgm_if_indextoaddr (gsr->gsr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL); mreqs.imr_interface.s_addr = ifaddr.sin_addr.s_addr; retval = setsockopt (s, SOL_IP, IP_ADD_SOURCE_MEMBERSHIP, (const char*)&mreqs, sizeof(mreqs)); break; } case AF_INET6: /* No IPv6 API implemented, MCAST_JOIN_SOURCE_GROUP should be available instead. */ retval = pgm_sockaddr_join_group (s, sa_family, (const struct group_req*)gsr); break; default: break; } #else retval = pgm_sockaddr_join_group (s, sa_family, (const struct group_req*)gsr); #endif /* CONFIG_HAVE_MCAST_JOIN */ return retval; } /* drop a SSM source */ PGM_GNUC_INTERNAL int pgm_sockaddr_leave_source_group ( const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr ) { int retval = SOCKET_ERROR; #ifdef CONFIG_HAVE_MCAST_JOIN const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; retval = setsockopt (s, recv_level, MCAST_LEAVE_SOURCE_GROUP, gsr, sizeof(struct group_source_req)); #elif defined(IP_ADD_SOURCE_MEMBERSHIP) switch (sa_family) { case AF_INET: { struct ip_mreq_source mreqs; struct sockaddr_in ifaddr; memset (&mreqs, 0, sizeof(mreqs)); mreqs.imr_multiaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_group)->sin_addr.s_addr; mreqs.imr_sourceaddr.s_addr = ((const struct sockaddr_in*)&gsr->gsr_source)->sin_addr.s_addr; pgm_if_indextoaddr (gsr->gsr_interface, AF_INET, 0, (struct sockaddr*)&ifaddr, NULL); mreqs.imr_interface.s_addr = ifaddr.sin_addr.s_addr; retval = setsockopt (s, SOL_IP, IP_DROP_SOURCE_MEMBERSHIP, (const char*)&mreqs, sizeof(mreqs)); break; } case AF_INET6: /* No IPv6 API implemented, MCAST_LEAVE_SOURCE_GROUP should be available instead. */ retval = pgm_sockaddr_leave_group (s, sa_family, (const struct group_req*)gsr); break; default: break; } #else retval = pgm_sockaddr_leave_group (s, sa_family, (const struct group_req*)gsr); #endif /* CONFIG_HAVE_MCAST_JOIN */ return retval; } #if defined(MCAST_MSFILTER) || defined(SIOCSMSFILTER) /* Batch block and unblock sources. */ PGM_GNUC_INTERNAL int pgm_sockaddr_msfilter ( const SOCKET s, const sa_family_t sa_family, const struct group_filter* gf_list ) { int retval = SOCKET_ERROR; # ifdef MCAST_MSFILTER const int recv_level = (AF_INET == sa_family) ? SOL_IP : SOL_IPV6; const socklen_t len = GROUP_FILTER_SIZE(gf_list->gf_numsrc); retval = setsockopt (s, recv_level, MCAST_MSFILTER, (const char*)gf_list, len); # elif defined(SIOCSMSFILTER) /* Windows Vista and later */ const socklen_t len = GROUP_FILTER_SIZE(gf_list->gf_numsrc); u_long* filter = pgm_alloca (len); memcpy (filter, gf_list, len); retval = ioctlsocket (s, SIOCSMSFILTER, filter); # elif defined(IP_MSFILTER) || defined(SIO_SET_MULTICAST_FILTER) /* IPv4-only filter API */ if (AF_INET == sa_family) { const socklen_t len = IP_MSFILTER_SIZE(gf_list->gf_numsrc); struct ip_msfilter* filter = pgm_alloca (len); struct sockaddr_in sa4; unsigned i; memcpy (&sa4, &gf_list->gf_group, sizeof (sa4)); filter->imsf_multiaddr.s_addr = sa4.sin_addr.s_addr; pgm_if_indextoaddr (gf_list->gf_interface, AF_INET, 0, (struct sockaddr*)&sa4, NULL); filter->imsf_interface.s_addr = sa4.sin_addr.s_addr; filter->imsf_fmode = gf_list->gf_fmode; filter->imsf_numsrc = gf_list->gf_numsrc; for (i = 0; i < gf_list->gf_numsrc; i++) { memcpy (&sa4, &gf_list->gf_slist[i], sizeof (sa4)); filter->imsf_slist[i].s_addr = sa4.sin_addr.s_addr; } # ifdef IP_MSFILTER retval = ioctlsocket (s, IP_MSFILTER, (char*)filter); # else retval = ioctlsocket (s, SIO_SET_MULTICAST_FILTER, (u_long*)filter); # endif } # endif return retval; } #endif /* MCAST_MSFILTER || SIOCSMSFILTER */ /* Specify outgoing interface. * * If no error occurs, pgm_sockaddr_multicast_if returns zero. Otherwise, a * value of SOCKET_ERROR is returned, and a specific error code can be * retrieved by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_multicast_if ( const SOCKET s, const struct sockaddr* address, const unsigned ifindex ) { int retval = SOCKET_ERROR; switch (address->sa_family) { case AF_INET: { /* Solaris:ip(7P) "This option takes a struct in_addr as an argument, and it * selects that interface for outgoing IP multicast packets." * * Linux:ip(7) "Argument is an ip_mreqn or ip_mreq structure similar to * IP_ADD_MEMBERSHIP." * * OS X:IP(4) provided by example "struct in_addr addr;" * * WinSock2:MSDN(IPPROTO_IP Socket Options) "DWORD; Any IP address in the * 0.x.x.x block (first octet of 0) except IPv4 address 0.0.0.0 is treated * as an interface index." * NB: 24-bit interface index size cf. 8-bit of ip_mreq. * * Stevens: "IP_MULTICAST_IF has datatype struct in_addr{}." */ struct sockaddr_in s4; memcpy (&s4, address, sizeof(struct sockaddr_in)); retval = setsockopt (s, IPPROTO_IP, IP_MULTICAST_IF, (const char*)&s4.sin_addr, sizeof(s4.sin_addr)); break; } case AF_INET6: { #ifndef _WIN32 /* Solaris:ip6(7P) "This option takes an integer as an argument; the integer * is the interface index of the selected interface." * * Linux:ipv6(7) "The argument is a pointer to an interface index (see * netdevice(7)) in an integer." * * OS X:IP6(4) "IPV6_MULTICAST_IF u_int *" * * Stevens: "IPV6_MULTICAST_IF has datatype u_int." */ const unsigned int optval = ifindex; #else /* WinSock2:MSDN(IPPROTO_IPV6 Socket Options) "DWORD; The input value for * setting this option is a 4-byte interface index of the desired outgoing * interface." * NB: 32-bit interface index cf. 24-bit of IPv4 and 8-bit of ip_mreq. */ const DWORD optval = ifindex; #endif retval = setsockopt (s, IPPROTO_IPV6, IPV6_MULTICAST_IF, (const char*)&optval, sizeof(optval)); break; } default: break; } return retval; } /* Specify multicast loop, other applications on the same host may receive * outgoing packets. This does not affect unicast packets such as NAKs. * * If no error occurs, pgm_sockaddr_multicast_loop returns zero. Otherwise, a * value of SOCKET_ERROR is returned, and a specific error code can be * retrieved by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_multicast_loop ( const SOCKET s, const sa_family_t sa_family, const bool v ) { int retval = SOCKET_ERROR; switch (sa_family) { case AF_INET: { #ifndef _WIN32 /* Solaris:ip(7P) "Setting the unsigned character argument to 0 causes the * opposite behavior, meaning that when multiple zones are present, the * datagrams are delivered to all zones except the sending zone." * * Linux:ip(7) "Sets or reads a boolean integer argument" * * OS X:IP(4) provided by example "u_char loop;" * * Stevens: "IP_MULTICAST_LOOP has datatype u_char." */ const unsigned char optval = v ? 1 : 0; #else /* WinSock2:MSDN(IPPROTO_IP Socket Options) "DWORD (boolean)" */ const DWORD optval = v ? 1 : 0; #endif retval = setsockopt (s, IPPROTO_IP, IP_MULTICAST_LOOP, (const char*)&optval, sizeof(optval)); break; } case AF_INET6: { #ifndef _WIN32 /* Solaris:ip(7P) "Setting the unsigned character argument to 0 will cause the opposite behavior." * * Linux:ipv6(7) "Argument is a pointer to boolean." * * OS X:IP6(7) "IPV6_MULTICAST_LOOP u_int *" * * Stevens: "IPV6_MULTICAST_LOOP has datatype u_int." */ const unsigned int optval = v ? 1 : 0; #else /* WinSock2:MSDN(IPPROTO_IPV6 Socket Options) "DWORD (boolean)" */ const DWORD optval = v ? 1 : 0; #endif retval = setsockopt (s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (const char*)&optval, sizeof(optval)); break; } default: break; } return retval; } /* Specify TTL or outgoing hop limit. * NB: Only affects multicast hops, unicast hop-limit is not changed. * * If no error occurs, pgm_sockaddr_multicast_hops returns zero. Otherwise, a * value of SOCKET_ERROR is returned, and a specific error code can be * retrieved by calling pgm_get_last_sock_error(). */ PGM_GNUC_INTERNAL int pgm_sockaddr_multicast_hops ( const SOCKET s, const sa_family_t sa_family, const unsigned hops ) { int retval = SOCKET_ERROR; switch (sa_family) { case AF_INET: { #ifndef _WIN32 /* Solaris:ip(7P) "This option takes an unsigned character as an argument." * * Linux:ip(7) "Argument is an integer." * * OS X:IP(4) provided by example for SOCK_DGRAM with IP_TTL: "int ttl = 60;", * or for SOCK_RAW & SOCK_DGRAM with IP_MULTICAST_TTL: "u_char ttl;" * * Stevens: "IP_MULTICAST_TTL has datatype u_char." */ const unsigned char optval = hops; #else /* WinSock2:MSDN(IPPROTO_IP Socket Options) "DWORD" */ const DWORD optval = hops; #endif retval = setsockopt (s, IPPROTO_IP, IP_MULTICAST_TTL, (const char*)&optval, sizeof(optval)); break; } case AF_INET6: { #ifndef _WIN32 /* Solaris:ip6(7P) "This option takes an integer as an argument." * * Linux:ipv6(7) "Argument is a pointer to an integer." * * OS X:IP6(7) "IPV6_MULTICAST_HOPS int *" * * Stevens: "IPV6_MULTICAST_HOPS has datatype int." */ const int optval = hops; #else /* WinSock2:MSDN(IPPROTO_IPV6 Socket Options) "DWORD" */ const DWORD optval = hops; #endif retval = setsockopt (s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (const char*)&optval, sizeof(optval)); break; } default: break; } return retval; } PGM_GNUC_INTERNAL void pgm_sockaddr_nonblocking ( const SOCKET s, const bool v ) { #ifndef _WIN32 int flags = fcntl (s, F_GETFL); if (!v) flags &= ~O_NONBLOCK; else flags |= O_NONBLOCK; fcntl (s, F_SETFL, flags); #else u_long mode = v; ioctlsocket (s, FIONBIO, &mode); #endif } /* Note that are sockaddr structure is not passed these functions inherently * cannot support IPv6 Zone Indices and hence are rather limited for the * link-local scope. */ PGM_GNUC_INTERNAL const char* pgm_inet_ntop ( int af, const void* restrict src, char* restrict dst, socklen_t size ) { pgm_assert (AF_INET == af || AF_INET6 == af); pgm_assert (NULL != src); pgm_assert (NULL != dst); pgm_assert (size > 0); switch (af) { case AF_INET: { struct sockaddr_in sin; memset (&sin, 0, sizeof (sin)); sin.sin_family = AF_INET; sin.sin_addr = *(const struct in_addr*)src; getnameinfo ((struct sockaddr*)&sin, sizeof (sin), dst, size, NULL, 0, NI_NUMERICHOST); return dst; } case AF_INET6: { struct sockaddr_in6 sin6; memset (&sin6, 0, sizeof (sin6)); sin6.sin6_family = AF_INET6; sin6.sin6_addr = *(const struct in6_addr*)src; getnameinfo ((struct sockaddr*)&sin6, sizeof (sin6), dst, size, NULL, 0, NI_NUMERICHOST); return dst; } } #ifndef _WIN32 errno = EAFNOSUPPORT; #else WSASetLastError (WSAEAFNOSUPPORT); #endif return NULL; } PGM_GNUC_INTERNAL int pgm_inet_pton ( int af, const char* restrict src, void* restrict dst ) { pgm_assert (AF_INET == af || AF_INET6 == af); pgm_assert (NULL != src); pgm_assert (NULL != dst); struct addrinfo hints = { .ai_family = af, .ai_socktype = SOCK_STREAM, /* not really */ .ai_protocol = IPPROTO_TCP, /* not really */ .ai_flags = AI_NUMERICHOST }, *result = NULL; const int e = getaddrinfo (src, NULL, &hints, &result); if (0 != e) { return 0; /* error */ } pgm_assert (NULL != result->ai_addr); pgm_assert (0 != result->ai_addrlen); switch (result->ai_addr->sa_family) { case AF_INET: { struct sockaddr_in s4; memcpy (&s4, result->ai_addr, sizeof(s4)); memcpy (dst, &s4.sin_addr.s_addr, sizeof(struct in_addr)); break; } case AF_INET6: { struct sockaddr_in6 s6; memcpy (&s6, result->ai_addr, sizeof(s6)); memcpy (dst, &s6.sin6_addr, sizeof(struct in6_addr)); break; } default: pgm_assert_not_reached(); break; } freeaddrinfo (result); return 1; /* success */ } PGM_GNUC_INTERNAL int pgm_nla_to_sockaddr ( const void* restrict nla, struct sockaddr* restrict sa ) { uint16_t nla_family; int retval = 0; memcpy (&nla_family, nla, sizeof(nla_family)); sa->sa_family = ntohs (nla_family); switch (sa->sa_family) { case AFI_IP: sa->sa_family = AF_INET; ((struct sockaddr_in*)sa)->sin_addr.s_addr = ((const struct in_addr*)((const char*)nla + sizeof(uint32_t)))->s_addr; break; case AFI_IP6: sa->sa_family = AF_INET6; memcpy (&((struct sockaddr_in6*)sa)->sin6_addr, (const struct in6_addr*)((const char*)nla + sizeof(uint32_t)), sizeof(struct in6_addr)); break; default: retval = -EINVAL; break; } return retval; } PGM_GNUC_INTERNAL int pgm_sockaddr_to_nla ( const struct sockaddr* restrict sa, void* restrict nla ) { int retval = 0; *(uint16_t*)nla = sa->sa_family; *(uint16_t*)((char*)nla + sizeof(uint16_t)) = 0; /* reserved 16bit space */ switch (sa->sa_family) { case AF_INET: *(uint16_t*)nla = htons (AFI_IP); ((struct in_addr*)((char*)nla + sizeof(uint32_t)))->s_addr = ((const struct sockaddr_in*)sa)->sin_addr.s_addr; break; case AF_INET6: *(uint16_t*)nla = htons (AFI_IP6); memcpy ((struct in6_addr*)((char*)nla + sizeof(uint32_t)), &((const struct sockaddr_in6*)sa)->sin6_addr, sizeof(struct in6_addr)); break; default: retval = -EINVAL; break; } return retval; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/version_generator.py0000755000175000017500000000277511640407354021666 0ustar locallocal#!/usr/bin/python import os import platform import time build_date = time.strftime ("%Y-%m-%d") build_time = time.strftime ("%H:%M:%S") build_rev = filter (str.isdigit, "$Revision: 1369 $") print """ /* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * OpenPGM version. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include /* globals */ const unsigned pgm_major_version = 5; const unsigned pgm_minor_version = 1; const unsigned pgm_micro_version = 118; const char* pgm_build_date = "%s"; const char* pgm_build_time = "%s"; const char* pgm_build_system = "%s"; const char* pgm_build_machine = "%s"; const char* pgm_build_revision = "%s"; /* eof */ """%(build_date, build_time, platform.system(), platform.machine(), build_rev) # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/tsi.c.c89.patch0000644000175000017500000000076211640407354020213 0ustar locallocal--- tsi.c 2011-03-12 10:33:45.000000000 +0800 +++ tsi.c89.c 2011-03-12 11:13:49.000000000 +0800 @@ -46,11 +46,13 @@ pgm_return_val_if_fail (NULL != buf, -1); pgm_return_val_if_fail (bufsize > 0, -1); + { const uint8_t* gsi = (const uint8_t*)tsi; const uint16_t source_port = tsi->sport; return pgm_snprintf_s (buf, bufsize, _TRUNCATE, "%u.%u.%u.%u.%u.%u.%u", gsi[0], gsi[1], gsi[2], gsi[3], gsi[4], gsi[5], ntohs (source_port)); + } } /* transform TSI to ASCII string form. libpgm-5.1.118-1~dfsg/openpgm/pgm/http_unittest.c0000644000175000017500000001063511640407354020632 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for the HTTP administration interface. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "impl/framework.h" #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ static pgm_rwlock_t mock_pgm_sock_list_lock; static pgm_slist_t* mock_pgm_sock_list; /* mock functions for external references */ #define pgm_sock_list_lock mock_pgm_sock_list_lock #define pgm_sock_list mock_pgm_sock_list #define HTTP_DEBUG #include "http.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * bool * pgm_http_init ( * uint16_t* http_port, * pgm_error_t** error * ) */ START_TEST (test_init_pass_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_http_init (8080, &err), "init failed"); fail_unless (NULL == err, "init failed"); #ifdef PGM_CHECK_NOFORK fail_unless (TRUE == pgm_http_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_http_shutdown (), "shutdown failed"); #endif } END_TEST /* duplicate servers */ START_TEST (test_init_fail_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_http_init (8080, &err), "init failed"); fail_unless (TRUE == pgm_http_init (8080, &err), "init failed"); #ifdef PGM_CHECK_NOFORK fail_unless (TRUE == pgm_http_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_http_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_http_shutdown (), "shutdown failed"); #endif } END_TEST /* target: * bool * pgm_http_shutdown (void) */ START_TEST (test_shutdown_pass_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_http_init (8080, &err), "init failed"); fail_unless (NULL == err, "init failed"); fail_unless (TRUE == pgm_http_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_http_shutdown (), "shutdown failed"); } END_TEST /* repeatability */ START_TEST (test_shutdown_pass_002) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_http_init (8080, &err), "init failed"); fail_unless (NULL == err, "init failed"); fail_unless (TRUE == pgm_http_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_http_init (8080, &err), "init failed"); fail_unless (NULL == err, "init failed"); fail_unless (TRUE == pgm_http_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_http_shutdown (), "shutdown failed"); } END_TEST /* no running server */ START_TEST (test_shutdown_fail_001) { fail_unless (FALSE == pgm_http_shutdown (), "shutdown failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_init = tcase_create ("init"); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_init_pass_001); tcase_add_test (tc_init, test_init_fail_001); TCase* tc_shutdown = tcase_create ("shutdown"); suite_add_tcase (s, tc_shutdown); tcase_add_test (tc_shutdown, test_shutdown_pass_001); tcase_add_test (tc_shutdown, test_shutdown_pass_002); tcase_add_test (tc_shutdown, test_shutdown_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/atomic_unittest.c0000644000175000017500000000756711640407354021141 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for atomic operations. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include /* mock state */ /* mock functions for external references */ #define PGM_COMPILATION #include "pgm/atomic.h" /* target: * uint32_t * pgm_atomic_exchange_and_add32 ( * volatile uint32_t* atomic, * const uint32_t val * ) */ START_TEST (test_int32_exchange_and_add_pass_001) { volatile uint32_t atomic = 0; fail_unless (0 == pgm_atomic_exchange_and_add32 (&atomic, 5), "xadd failed"); fail_unless (5 == atomic, "xadd failed"); fail_unless (5 == pgm_atomic_exchange_and_add32 (&atomic, (uint32_t)-10), "xadd failed"); fail_unless ((uint32_t)-5 == atomic, "xadd failed"); } END_TEST /* target: * void * pgm_atomic_add32 ( * volatile uint32_t* atomic, * const uint32_t val * ) */ START_TEST (test_int32_add_pass_001) { volatile uint32_t atomic = (uint32_t)-5; pgm_atomic_add32 (&atomic, 20); fail_unless (15 == atomic, "add failed"); pgm_atomic_add32 (&atomic, (uint32_t)-35); fail_unless ((uint32_t)-20 == atomic, "add failed"); } END_TEST /* ensure wrap around when casting uint32 */ START_TEST (test_int32_add_pass_002) { volatile uint32_t atomic = 0; pgm_atomic_add32 (&atomic, UINT32_MAX/2); fail_unless ((UINT32_MAX/2) == atomic, "add failed"); pgm_atomic_add32 (&atomic, UINT32_MAX - (UINT32_MAX/2)); fail_unless (UINT32_MAX == atomic, "add failed"); pgm_atomic_add32 (&atomic, 1); fail_unless (0 == atomic, "add failed"); } END_TEST /* target: * uint32_t * pgm_atomic_read32 ( * volatile uint32_t* atomic * ) */ START_TEST (test_int32_get_pass_001) { volatile uint32_t atomic = (uint32_t)-20; fail_unless ((uint32_t)-20 == pgm_atomic_read32 (&atomic), "read failed"); } END_TEST /* target: * void * pgm_atomic_int32_set ( * volatile int32_t* atomic, * const int32_t val * ) */ START_TEST (test_int32_set_pass_001) { volatile uint32_t atomic = (uint32_t)-20; pgm_atomic_write32 (&atomic, 5); fail_unless (5 == atomic, "write failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_exchange_and_add = tcase_create ("exchange-and-add"); suite_add_tcase (s, tc_exchange_and_add); tcase_add_test (tc_exchange_and_add, test_int32_exchange_and_add_pass_001); TCase* tc_add = tcase_create ("add"); suite_add_tcase (s, tc_add); tcase_add_test (tc_add, test_int32_add_pass_001); tcase_add_test (tc_add, test_int32_add_pass_002); TCase* tc_get = tcase_create ("get"); suite_add_tcase (s, tc_get); tcase_add_test (tc_get, test_int32_get_pass_001); TCase* tc_set = tcase_create ("set"); suite_add_tcase (s, tc_set); tcase_add_test (tc_set, test_int32_set_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.097.intelc0000644000175000017500000002763411640407354021404 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 0, 97 ) SConsignFile('scons.signatures'+ '-' + platform.system() + '-' + platform.machine() + '-intelc'); opt = Options(None, ARGUMENTS) opt.AddOptions ( (EnumOption ('BUILD', 'build environment', 'debug', ('release', 'debug', 'profile'))), (EnumOption ('BRANCH', 'branch prediction', 'none', ('none', 'profile', 'seed'))), (EnumOption ('WITH_GETTEXT', 'l10n support via libintl', 'false', ('true', 'false'))), (EnumOption ('WITH_GLIB', 'Build GLib dependent modules', 'false', ('true', 'false'))), (EnumOption ('COVERAGE', 'test coverage', 'none', ('none', 'full'))), (EnumOption ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', ('true', 'false'))), (EnumOption ('WITH_HTTP', 'HTTP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_SNMP', 'SNMP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_CHECK', 'Check test system', 'false', ('true', 'false'))), (EnumOption ('WITH_TEST', 'Network test system', 'false', ('true', 'false'))), (EnumOption ('WITH_CC', 'C++ Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_EXAMPLES', 'Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_NCURSES', 'NCURSES examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', ('true', 'false'))), ) #----------------------------------------------------------------------------- # Dependencies def force_intelc(env): env.Tool('intelc', version='11.1', topdir='/opt/intel/Compiler/11.1/064/bin/intel64'); env = Environment(); force_intelc(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment(ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', # '-Wextra', # '-Wfloat-equal', '-Wshadow', # '-Wunsafe-loop-optimizations', '-Wpointer-arith', # '-Wbad-function-cast', # '-Wcast-qual', # '-Wcast-align', '-Wwrite-strings', # '-Waggregate-return', '-Wstrict-prototypes', # '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', # '-Wmissing-noreturn', # '-Wmissing-format-attribute', # '-Wredundant-decls', # '-Wnested-externs', # Verbose inlining reports # '-Winline', # 175: subscript out of range # - Ignored for broken compiler C99 support # e.g. tbuf[ sizeof(tbuf) ] = '\0'; '-wd175', # 177: function was declared but never referenced # - Ignored as side effect of portability pre-processor blocks. '-wd177', # 181: argument is incompatible with corresponding format string conversion # - Ignored as pre-processor fails to parse variadic printf style macros. '-wd181', # 191: type qualifier is meaningless on cast type # - Ignored as cast required for portability # e.g. pgm_txw_state_t*const state = (pgm_txw_state_t*const)&skb->cb; '-wd191', # 269: invalid format string conversion # - Ignored with failure to display PRIu32 with (volatile uint32_t) '-wd269', # 556: cannot assign to an entity of type "void *" # - Ignored, it's a C++2003 error, valid in C99 aside of const down-converting. # e.g. const char *s = ""; void *p = s; '-wd556', # 589: transfer of control bypasses initialization # - Ignored, it's a C++2003 error, perfectly valid in C99. '-wd589', # 593: variable was set but never used # '-wd593', # 981: operands are evaluated in unspecified order # - Ignored as pedantic warning against possible side effects. # e.g. printf ("%s.%s > ", # pgm_gethostbyaddr((const struct in_addr*)&ip->ip_src), # pgm_udpport_string(pgm_header->pgm_sport)); '-wd981', # 2259: non-pointer conversion from "/type a/" to "/type b/" may lose significant bits # - Ignored for really pedantic compiler temporary value conversions, # e.g. uint16_t j = 1, i = ~j; '-wd2259', '-strict-ansi', # '-pedantic', # C99 '-std=c99', '-D_XOPEN_SOURCE=600', '-D_BSD_SOURCE', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system '-DCONFIG_HAVE_PROC', # example: crash handling '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', # ioctl RTC_IRQP_SET: undefined reference to `__invalid_size_argument_for_IOC' # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # event handling '-DCONFIG_HAVE_POLL', '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt' ], PROTOBUF_CCFLAGS = '-I/miru/projects/protobuf/protobuf-2.1.0/src', PROTOBUF_LIBS = '/miru/projects/protobuf/protobuf-2.1.0/src/.libs/libprotobuf.a', PROTOBUF_PROTOC = '/miru/projects/protobuf/protobuf-2.1.0/src/protoc' ) opt.Update (env) force_intelc(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-ggdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O0','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --cflags --agent-libs'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '-intelc/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.Solaris.gcc640000644000175000017500000002477211640407354022131 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine() + '-gcc64'); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile', 'thirtytwo')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PLUS', 'libpgmplus GPL library', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies def force_gcc(env): env.PrependENVPath('PATH', '/usr/sfw/bin'); env.PrependENVPath('PATH', '/opt/glib-gcc64/bin'); env.PrependENVPath('PATH', '/usr/local/bin'); env.Tool('gcc'); env.Tool('g++'); env = Environment(); force_gcc(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', # '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_XOPEN_SOURCE=600', '-D__EXTENSIONS__', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing # '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', # '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration # '-DCONFIG_HAVE_GETIFADDRS', # '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf # '-DCONFIG_HAVE_SPRINTF_GROUPING', # '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope # '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt', # Solaris sockets 'resolv', 'socket', 'nsl' ], PROTOBUF_CCFLAGS = '-I/opt/glib-gcc64/include', PROTOBUF_LIBS = '/opt/glib-gcc64/lib/sparcv9/libprotobuf.a', PROTOBUF_PROTOC = '/opt/glib-gcc64/bin/protoc' ) force_gcc(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = ['-O2','-m64'], LINKFLAGS = '-m64') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb','-m64'], LINKFLAGS = ['-gdb','-m64']) profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg','-m64'], LINKFLAGS = ['-pg','-m64']) thirtytwo = env.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = ['-O2','-m32'], LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); def list_remove(list, target): newlist = []; for item in str(list).split(' '): if item != target: newlist.append(item); return newlist; # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': # net-snmp-config is broken in Solaris 10 and requires two separate calls env['SNMP_FLAGS'] = env.ParseFlags(['!net-snmp-config-64 --cflags', '!net-snmp-config-64 --agent-libs']); # GCC error: language arch=v9 not recognized ccflags = env['SNMP_FLAGS'].get('CCFLAGS', ''); env['SNMP_FLAGS']['CCFLAGS'] = list_remove(ccflags, '-xarch=v9'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; tests = { 'CheckCheck': CheckCheck } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '-gcc64/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/pgmMIB_unittest.c0000644000175000017500000001173711640407354020772 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM MIB routines. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include "impl/framework.h" /* mock state */ static pgm_rwlock_t mock_pgm_sock_list_lock; static pgm_slist_t* mock_pgm_sock_list; /* mock functions for external references */ #define pgm_sock_list_lock mock_pgm_sock_list_lock #define pgm_sock_list mock_pgm_sock_list static netsnmp_handler_registration* mock_netsnmp_create_handler_registration ( const char* name, Netsnmp_Node_Handler* handler_access_method, oid* reg_oid, size_t reg_oid_len, int modes ) { netsnmp_handler_registration* handler = g_malloc0 (sizeof(netsnmp_handler_registration)); return handler; } static void mock_netsnmp_handler_registration_free ( netsnmp_handler_registration* handler ) { g_assert (NULL != handler); g_free (handler); } static void mock_netsnmp_table_helper_add_indexes ( netsnmp_table_registration_info* tinfo, ... ) { } static int mock_netsnmp_register_table_iterator ( netsnmp_handler_registration* reginfo, netsnmp_iterator_info* iinfo ) { return MIB_REGISTERED_OK; } static int mock_netsnmp_set_request_error ( netsnmp_agent_request_info* reqinfo, netsnmp_request_info* request, int error_value ) { return 0; } static void* mock_netsnmp_extract_iterator_context ( netsnmp_request_info* reqinfo ) { return (void*)0x1; } static netsnmp_table_request_info* mock_netsnmp_extract_table_info ( netsnmp_request_info* reqinfo ) { return NULL; } static int mock_snmp_set_var_typed_value ( netsnmp_variable_list* newvar, u_char type, const u_char* val_str, size_t val_len ) { return 0; } static netsnmp_variable_list* mock_snmp_varlist_add_variable ( netsnmp_variable_list** varlist, const oid* oid, size_t name_length, u_char type, const u_char* value, size_t len ) { return NULL; } static void mock_snmp_free_varbind ( netsnmp_variable_list* var ) { } static void mock_snmp_free_var ( netsnmp_variable_list* var ) { } static int mock_snmp_log ( int priority, const char* format, ... ) { return 0; } static void mock_send_v2trap ( netsnmp_variable_list* var ) { } /** time module */ static void mock_pgm_time_since_epoch ( pgm_time_t* pgm_time_t_time, time_t* time_t_time ) { *time_t_time = pgm_to_secs (*pgm_time_t_time + 0); } #define netsnmp_create_handler_registration mock_netsnmp_create_handler_registration #define netsnmp_handler_registration_free mock_netsnmp_handler_registration_free #define netsnmp_table_helper_add_indexes mock_netsnmp_table_helper_add_indexes #define netsnmp_register_table_iterator mock_netsnmp_register_table_iterator #define netsnmp_set_request_error mock_netsnmp_set_request_error #define netsnmp_extract_iterator_context mock_netsnmp_extract_iterator_context #define netsnmp_extract_table_info mock_netsnmp_extract_table_info #define snmp_set_var_typed_value mock_snmp_set_var_typed_value #define snmp_varlist_add_variable mock_snmp_varlist_add_variable #define snmp_free_varbind mock_snmp_free_varbind #define snmp_free_var mock_snmp_free_var #define snmp_log mock_snmp_log #define send_v2trap mock_send_v2trap #define PGMMIB_DEBUG #include "pgmMIB.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * bool * pgm_mib_init ( * pgm_error_t** error * ) */ START_TEST (test_init_pass_001) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_mib_init (&err), "mib_init failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_init = tcase_create ("init"); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_init_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/http.c0000644000175000017500000014222511640407354016674 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * HTTP administrative interface * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #ifndef _WIN32 # include #else # include # include # include #endif #include #include #include #include #include #include #include #include #include "pgm/http.h" #include "htdocs/404.html.h" #include "htdocs/base.css.h" #include "htdocs/robots.txt.h" #include "htdocs/xhtml10_strict.doctype.h" /* OpenSolaris */ #ifndef LOGIN_NAME_MAX # ifdef _WIN32 # define LOGIN_NAME_MAX (UNLEN + 1) # else # define LOGIN_NAME_MAX 256 # endif #endif #ifdef _WIN32 # define getpid _getpid # define read _read # define write _write # define SHUT_WR SD_SEND #endif #ifdef CONFIG_HAVE_SPRINTF_GROUPING # define GROUP_FORMAT "'" #else # define GROUP_FORMAT "" #endif #define HTTP_BACKLOG 10 /* connections */ #define HTTP_TIMEOUT 60 /* seconds */ /* locals */ struct http_connection_t { pgm_list_t link_; SOCKET sock; enum { HTTP_STATE_READ, HTTP_STATE_WRITE, HTTP_STATE_FINWAIT } state; char* buf; size_t buflen; size_t bufoff; unsigned status_code; const char* status_text; const char* content_type; }; enum { HTTP_MEMORY_STATIC, HTTP_MEMORY_TAKE }; static char http_hostname[NI_MAXHOST + 1]; static char http_address[INET6_ADDRSTRLEN]; static char http_username[LOGIN_NAME_MAX + 1]; static int http_pid; static SOCKET http_sock = INVALID_SOCKET; #ifndef _WIN32 static pthread_t http_thread; static void* http_routine (void*); #else static HANDLE http_thread; static unsigned __stdcall http_routine (void*); #endif static SOCKET http_max_sock = INVALID_SOCKET; static fd_set http_readfds, http_writefds, http_exceptfds; static pgm_list_t* http_socks = NULL; static pgm_notify_t http_notify = PGM_NOTIFY_INIT; static volatile uint32_t http_ref_count = 0; static int http_tsi_response (struct http_connection_t*restrict, const pgm_tsi_t*restrict); static void http_each_receiver (const pgm_sock_t*restrict, const pgm_peer_t*restrict, pgm_string_t*restrict); static int http_receiver_response (struct http_connection_t*restrict, const pgm_sock_t*restrict, const pgm_peer_t*restrict); static void default_callback (struct http_connection_t*restrict, const char*restrict); static void robots_callback (struct http_connection_t*restrict, const char*restrict); static void css_callback (struct http_connection_t*restrict, const char*restrict); static void index_callback (struct http_connection_t*restrict, const char*restrict); static void interfaces_callback (struct http_connection_t*restrict, const char*restrict); static void transports_callback (struct http_connection_t*restrict, const char*restrict); static void histograms_callback (struct http_connection_t*restrict, const char*restrict); static struct { const char* path; void (*callback) (struct http_connection_t*restrict, const char*restrict); } http_directory[] = { { "/robots.txt", robots_callback }, { "/base.css", css_callback }, { "/", index_callback }, { "/interfaces", interfaces_callback }, { "/transports", transports_callback } #ifdef CONFIG_HISTOGRAMS ,{ "/histograms", histograms_callback } #endif }; static int http_sock_rcvtimeo ( SOCKET sock, int seconds ) { #if defined( __sun ) return 0; #elif !defined( _WIN32 ) const struct timeval timeout = { .tv_sec = seconds, .tv_usec = 0 }; return setsockopt (sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout)); #else const int optval = seconds * 1000; return setsockopt (sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&optval, sizeof(optval)); #endif } static int http_sock_sndtimeo ( SOCKET sock, int seconds ) { #if defined( __sun ) return 0; #elif !defined( _WIN32 ) const struct timeval timeout = { .tv_sec = seconds, .tv_usec = 0 }; return setsockopt (sock, SOL_SOCKET, SO_SNDTIMEO, (const char*)&timeout, sizeof(timeout)); #else const int optval = seconds * 1000; return setsockopt (sock, SOL_SOCKET, SO_SNDTIMEO, (const char*)&optval, sizeof(optval)); #endif } bool pgm_http_init ( in_port_t http_port, pgm_error_t** error ) { int e; if (pgm_atomic_exchange_and_add32 (&http_ref_count, 1) > 0) return TRUE; /* resolve and store relatively constant runtime information */ if (0 != gethostname (http_hostname, sizeof(http_hostname))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Resolving hostname: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM, .ai_protocol = IPPROTO_TCP, .ai_flags = AI_ADDRCONFIG }, *res = NULL; e = getaddrinfo (http_hostname, NULL, &hints, &res); if (0 != e) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_eai_errno (e, errno), _("Resolving hostname address: %s"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), e)); goto err_cleanup; } /* NB: getaddrinfo may return multiple addresses, one per interface & family, only the first * return result is used. The sorting order of the list defined by RFC 3484 and /etc/gai.conf */ e = getnameinfo (res->ai_addr, res->ai_addrlen, http_address, sizeof(http_address), NULL, 0, NI_NUMERICHOST); if (0 != e) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_eai_errno (e, errno), _("Resolving numeric hostname: %s"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), e)); goto err_cleanup; } freeaddrinfo (res); #ifndef _WIN32 e = getlogin_r (http_username, sizeof(http_username)); if (0 != e) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_errno (errno), _("Retrieving user name: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); goto err_cleanup; } #else wchar_t wusername[UNLEN + 1]; DWORD nSize = PGM_N_ELEMENTS( wusername ); if (!GetUserNameW (wusername, &nSize)) { const DWORD save_errno = GetLastError(); char winstr[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_win_errno (save_errno), _("Retrieving user name: %s"), pgm_win_strerror (winstr, sizeof (winstr), save_errno)); goto err_cleanup; } WideCharToMultiByte (CP_UTF8, 0, wusername, nSize + 1, http_username, sizeof(http_username), NULL, NULL); #endif /* _WIN32 */ http_pid = getpid(); /* create HTTP listen socket */ if (INVALID_SOCKET == (http_sock = socket (AF_INET, SOCK_STREAM, 0))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Creating HTTP socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } const int v = 1; if (0 != setsockopt (http_sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&v, sizeof(v))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Enabling reuse of socket local address: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } if (0 != http_sock_rcvtimeo (http_sock, HTTP_TIMEOUT) || 0 != http_sock_sndtimeo (http_sock, HTTP_TIMEOUT)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Setting socket timeout: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } struct sockaddr_in http_addr; memset (&http_addr, 0, sizeof(http_addr)); http_addr.sin_family = AF_INET; http_addr.sin_addr.s_addr = INADDR_ANY; http_addr.sin_port = htons (http_port); if (0 != bind (http_sock, (struct sockaddr*)&http_addr, sizeof(http_addr))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&http_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Binding HTTP socket to address %s: %s"), addr, pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } if (0 != listen (http_sock, HTTP_BACKLOG)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Listening to HTTP socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } /* non-blocking notification of new connections */ pgm_sockaddr_nonblocking (http_sock, TRUE); /* create notification channel */ if (0 != pgm_notify_init (&http_notify)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_sock_errno (save_errno), _("Creating HTTP notification channel: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } /* spawn thread to handle HTTP requests */ #ifndef _WIN32 const int status = pthread_create (&http_thread, NULL, &http_routine, NULL); if (0 != status) { const int save_errno = errno; char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_errno (save_errno), _("Creating HTTP thread: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } #else http_thread = (HANDLE)_beginthreadex (NULL, 0, &http_routine, NULL, 0, NULL); if (0 == http_thread) { const int save_errno = errno; char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_HTTP, pgm_error_from_errno (save_errno), _("Creating HTTP thread: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_cleanup; } #endif /* _WIN32 */ pgm_minor (_("Web interface: http://%s:%i"), http_hostname, http_port); return TRUE; err_cleanup: if (INVALID_SOCKET != http_sock) { closesocket (http_sock); http_sock = INVALID_SOCKET; } if (pgm_notify_is_valid (&http_notify)) { pgm_notify_destroy (&http_notify); } pgm_atomic_dec32 (&http_ref_count); return FALSE; } /* notify HTTP thread to shutdown, wait for shutdown and cleanup. */ bool pgm_http_shutdown (void) { pgm_return_val_if_fail (pgm_atomic_read32 (&http_ref_count) > 0, FALSE); if (pgm_atomic_exchange_and_add32 (&http_ref_count, (uint32_t)-1) != 1) return TRUE; pgm_notify_send (&http_notify); #ifndef _WIN32 pthread_join (http_thread, NULL); #else WaitForSingleObject (http_thread, INFINITE); CloseHandle (http_thread); #endif if (INVALID_SOCKET != http_sock) { closesocket (http_sock); http_sock = INVALID_SOCKET; } pgm_notify_destroy (&http_notify); return TRUE; } /* accept a new incoming HTTP connection. */ static void http_accept ( SOCKET listen_sock ) { /* new connection */ struct sockaddr_storage addr; socklen_t addrlen = sizeof(addr); SOCKET new_sock = accept (listen_sock, (struct sockaddr*)&addr, &addrlen); if (INVALID_SOCKET == new_sock) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; if (PGM_SOCK_EAGAIN == save_errno) return; pgm_warn (_("HTTP accept: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); return; } #ifndef _WIN32 /* out of bounds file descriptor for select() */ if (new_sock >= FD_SETSIZE) { closesocket (new_sock); pgm_warn (_("Rejected new HTTP client socket due to out of bounds file descriptor.")); return; } #endif pgm_sockaddr_nonblocking (new_sock, TRUE); struct http_connection_t* connection = pgm_new0 (struct http_connection_t, 1); connection->sock = new_sock; connection->state = HTTP_STATE_READ; http_socks = pgm_list_prepend_link (http_socks, &connection->link_); FD_SET( new_sock, &http_readfds ); FD_SET( new_sock, &http_exceptfds ); if (new_sock > http_max_sock) http_max_sock = new_sock; } static void http_close ( struct http_connection_t* connection ) { if (SOCKET_ERROR == closesocket (connection->sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Close HTTP client socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } switch (connection->state) { case HTTP_STATE_READ: case HTTP_STATE_FINWAIT: FD_CLR( connection->sock, &http_readfds ); break; case HTTP_STATE_WRITE: FD_CLR( connection->sock, &http_writefds ); break; } FD_CLR( connection->sock, &http_exceptfds ); http_socks = pgm_list_remove_link (http_socks, &connection->link_); if (connection->buflen > 0) { pgm_free (connection->buf); connection->buf = NULL; connection->buflen = 0; } /* find new highest fd */ if (connection->sock == http_max_sock) { http_max_sock = INVALID_SOCKET; for (pgm_list_t* list = http_socks; list; list = list->next) { struct http_connection_t* c = (void*)list; if (c->sock > http_max_sock) http_max_sock = c->sock; } } pgm_free (connection); } /* non-blocking read an incoming HTTP request */ static void http_read ( struct http_connection_t* connection ) { for (;;) { /* grow buffer as needed */ if (connection->bufoff + 1024 > connection->buflen) { connection->buf = pgm_realloc (connection->buf, connection->buflen + 1024); connection->buflen += 1024; } const ssize_t bytes_read = recv (connection->sock, &connection->buf[ connection->bufoff ], connection->buflen - connection->bufoff, 0); if (bytes_read < 0) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; if (PGM_SOCK_EINTR == save_errno || PGM_SOCK_EAGAIN == save_errno) return; pgm_warn (_("HTTP client read: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); http_close (connection); return; } /* complete */ if (strstr (connection->buf, "\r\n\r\n")) break; } /* process request, e.g. GET /index.html HTTP/1.1\r\n */ connection->buf[ connection->buflen - 1 ] = '\0'; if (0 != memcmp (connection->buf, "GET ", strlen("GET "))) { /* 501 (not implemented) */ http_close (connection); return; } char* request_uri = connection->buf + strlen("GET "); char* p = request_uri; do { if (*p == '?' || *p == ' ') { *p = '\0'; break; } } while (*(++p)); connection->status_code = 200; /* OK */ connection->status_text = "OK"; connection->content_type = "text/html"; connection->bufoff = 0; for (unsigned i = 0; i < PGM_N_ELEMENTS(http_directory); i++) { if (0 == strcmp (request_uri, http_directory[i].path)) { http_directory[i].callback (connection, request_uri); goto complete; } } default_callback (connection, request_uri); complete: connection->state = HTTP_STATE_WRITE; FD_CLR( connection->sock, &http_readfds ); FD_SET( connection->sock, &http_writefds ); } /* non-blocking write a HTTP response */ static void http_write ( struct http_connection_t* connection ) { do { const ssize_t bytes_written = send (connection->sock, &connection->buf[ connection->bufoff ], connection->buflen - connection->bufoff, 0); if (bytes_written < 0) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; if (PGM_SOCK_EINTR == save_errno || PGM_SOCK_EAGAIN == save_errno) return; pgm_warn (_("HTTP client write: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); http_close (connection); return; } connection->bufoff += bytes_written; } while (connection->bufoff < connection->buflen); if (0 == shutdown (connection->sock, SHUT_WR)) { http_close (connection); } else { pgm_debug ("HTTP socket entering finwait state."); connection->state = HTTP_STATE_FINWAIT; FD_CLR( connection->sock, &http_writefds ); FD_SET( connection->sock, &http_readfds ); } } /* read and discard pending data waiting for FIN */ static void http_finwait ( struct http_connection_t* connection ) { char buf[1024]; const ssize_t bytes_read = recv (connection->sock, buf, sizeof(buf), 0); if (bytes_read < 0) { const int save_errno = pgm_get_last_sock_error(); if (PGM_SOCK_EINTR == save_errno || PGM_SOCK_EAGAIN == save_errno) return; } http_close (connection); } static void http_process ( struct http_connection_t* connection ) { switch (connection->state) { case HTTP_STATE_READ: http_read (connection); break; case HTTP_STATE_WRITE: http_write (connection); break; case HTTP_STATE_FINWAIT: http_finwait (connection); break; } } static void http_set_status ( struct http_connection_t*restrict connection, int status_code, const char* restrict status_text ) { connection->status_code = status_code; connection->status_text = status_text; } static void http_set_content_type ( struct http_connection_t*restrict connection, const char* restrict content_type ) { connection->content_type = content_type; } /* finalise response buffer with headers and content */ static void http_set_static_response ( struct http_connection_t*restrict connection, const char* restrict content, size_t content_length ) { pgm_string_t* response = pgm_string_new (NULL); pgm_string_printf (response, "HTTP/1.0 %d %s\r\n" "Server: OpenPGM HTTP Server %u.%u.%u\r\n" "Last-Modified: Fri, 1 Jan 2010, 00:00:01 GMT\r\n" "Content-Length: %" PRIzd "\r\n" "Content-Type: %s\r\n" "Connection: close\r\n" "\r\n", connection->status_code, connection->status_text, pgm_major_version, pgm_minor_version, pgm_micro_version, content_length, connection->content_type ); pgm_string_append (response, content); if (connection->buflen) pgm_free (connection->buf); connection->buflen = response->len; connection->buf = pgm_string_free (response, FALSE); } static void http_set_response ( struct http_connection_t*restrict connection, char* restrict content, size_t content_length ) { pgm_string_t* response = pgm_string_new (NULL); pgm_string_printf (response, "HTTP/1.0 %d %s\r\n" "Server: OpenPGM HTTP Server %u.%u.%u\r\n" "Content-Length: %" PRIzd "\r\n" "Content-Type: %s\r\n" "Connection: close\r\n" "\r\n", connection->status_code, connection->status_text, pgm_major_version, pgm_minor_version, pgm_micro_version, content_length, connection->content_type ); pgm_string_append (response, content); pgm_free (content); if (connection->buflen) pgm_free (connection->buf); connection->buflen = response->len; connection->buf = pgm_string_free (response, FALSE); } /* Thread routine for processing HTTP requests */ static #ifndef _WIN32 void* #else unsigned __stdcall #endif http_routine ( PGM_GNUC_UNUSED void* arg ) { const SOCKET notify_fd = pgm_notify_get_socket (&http_notify); const int max_fd = MAX( notify_fd, http_sock ); FD_ZERO( &http_readfds ); FD_ZERO( &http_writefds ); FD_ZERO( &http_exceptfds ); FD_SET( notify_fd, &http_readfds ); FD_SET( http_sock, &http_readfds ); for (;;) { int fds = MAX( http_max_sock, max_fd ) + 1; fd_set readfds = http_readfds, writefds = http_writefds, exceptfds = http_exceptfds; fds = select (fds, &readfds, &writefds, &exceptfds, NULL); /* signal interrupt */ if (PGM_UNLIKELY(SOCKET_ERROR == fds && PGM_SOCK_EINTR == pgm_get_last_sock_error())) continue; /* terminate */ if (PGM_UNLIKELY(FD_ISSET( notify_fd, &readfds ))) break; /* new connection */ if (FD_ISSET( http_sock, &readfds )) { http_accept (http_sock); continue; } /* existing connection */ for (pgm_list_t* list = http_socks; list;) { struct http_connection_t* c = (void*)list; list = list->next; if ((FD_ISSET( c->sock, &readfds ) && HTTP_STATE_READ == c->state) || (FD_ISSET( c->sock, &writefds ) && HTTP_STATE_WRITE == c->state) || (FD_ISSET( c->sock, &exceptfds ))) { http_process (c); } } } /* cleanup */ #ifndef _WIN32 return NULL; #else _endthread(); return 0; #endif /* WIN32 */ } /* add xhtml doctype and head, populate with runtime values */ typedef enum { HTTP_TAB_GENERAL_INFORMATION, HTTP_TAB_INTERFACES, HTTP_TAB_TRANSPORTS, HTTP_TAB_HISTOGRAMS } http_tab_e; static pgm_string_t* http_create_response ( const char* subtitle, http_tab_e tab ) { pgm_assert (NULL != subtitle); pgm_assert (tab == HTTP_TAB_GENERAL_INFORMATION || tab == HTTP_TAB_INTERFACES || tab == HTTP_TAB_TRANSPORTS || tab == HTTP_TAB_HISTOGRAMS); /* surprising deficiency of GLib is no support of display locale time */ char timestamp[100]; time_t now; time (&now); const struct tm* time_ptr = localtime (&now); #ifndef _WIN32 strftime (timestamp, sizeof(timestamp), "%c", time_ptr); #else wchar_t wtimestamp[100]; const size_t slen = strftime (timestamp, sizeof(timestamp), "%c", time_ptr); const size_t wslen = MultiByteToWideChar (CP_ACP, 0, timestamp, slen, wtimestamp, 100); WideCharToMultiByte (CP_UTF8, 0, wtimestamp, wslen + 1, timestamp, sizeof(timestamp), NULL, NULL); #endif pgm_string_t* response = pgm_string_new (WWW_XHTML10_STRICT_DOCTYPE); pgm_string_append_printf (response, "\n" "%s - %s" "" "\n" "" "
" "%s" " | OpenPGM %u.%u.%u" " | %s" "
" "
" "General Information" "Interfaces" "Transports" #ifdef CONFIG_HISTOGRAMS "Histograms" #endif "
" "
" "
", http_hostname, subtitle, http_hostname, pgm_major_version, pgm_minor_version, pgm_micro_version, timestamp, tab == HTTP_TAB_GENERAL_INFORMATION ? "top" : "bottom", tab == HTTP_TAB_INTERFACES ? "top" : "bottom", tab == HTTP_TAB_TRANSPORTS ? "top" : "bottom" #ifdef CONFIG_HISTOGRAMS ,tab == HTTP_TAB_HISTOGRAMS ? "top" : "bottom" #endif ); return response; } static void http_finalize_response ( struct http_connection_t*restrict connection, pgm_string_t* restrict response ) { pgm_string_append (response, "
" "
" "©2010 Miru" "
" "\n" ""); char* buf = pgm_string_free (response, FALSE); http_set_response (connection, buf, strlen (buf)); } static void robots_callback ( struct http_connection_t*restrict connection, PGM_GNUC_UNUSED const char*restrict path ) { http_set_content_type (connection, "text/plain"); http_set_static_response (connection, WWW_ROBOTS_TXT, strlen(WWW_ROBOTS_TXT)); } static void css_callback ( struct http_connection_t*restrict connection, PGM_GNUC_UNUSED const char*restrict path ) { http_set_content_type (connection, "text/css"); http_set_static_response (connection, WWW_BASE_CSS, strlen(WWW_BASE_CSS)); } static void index_callback ( struct http_connection_t*restrict connection, const char* restrict path ) { if (strlen (path) > 1) { default_callback (connection, path); return; } pgm_rwlock_reader_lock (&pgm_sock_list_lock); const unsigned transport_count = pgm_slist_length (pgm_sock_list); pgm_rwlock_reader_unlock (&pgm_sock_list_lock); pgm_string_t* response = http_create_response ("OpenPGM", HTTP_TAB_GENERAL_INFORMATION); pgm_string_append_printf (response, "" "" "" "" "" "" "" "" "" "" "" "" "
host name:%s
user name:%s
IP address:%s
transports:%i
process ID:%i
\n", http_hostname, http_username, http_address, transport_count, http_pid); http_finalize_response (connection, response); } static void interfaces_callback ( struct http_connection_t*restrict connection, PGM_GNUC_UNUSED const char*restrict path ) { pgm_string_t* response = http_create_response ("Interfaces", HTTP_TAB_INTERFACES); pgm_string_append (response, "
");
	struct pgm_ifaddrs_t *ifap, *ifa;
	pgm_error_t* err = NULL;
	if (!pgm_getifaddrs (&ifap, &err)) {
		pgm_string_append_printf (response, "pgm_getifaddrs(): %s", (err && err->message) ? err->message : "(null)");
		http_finalize_response (connection, response);
		return;
	}
	for (ifa = ifap; ifa; ifa = ifa->ifa_next)
	{
		unsigned i = NULL == ifa->ifa_addr ? 0 : pgm_if_nametoindex (ifa->ifa_addr->sa_family, ifa->ifa_name);
		char rname[IF_NAMESIZE * 2 + 3];
		char b[IF_NAMESIZE * 2 + 3];

		pgm_if_indextoname (i, rname);
		sprintf (b, "%s (%s)", ifa->ifa_name, rname);

		 if (NULL == ifa->ifa_addr ||
		      (ifa->ifa_addr->sa_family != AF_INET &&
		       ifa->ifa_addr->sa_family != AF_INET6) )
		{
			pgm_string_append_printf (response,
				"#%d name %-15.15s ---- %-46.46s scope 0 status %s loop %s b/c %s m/c %s
\n", i, b, "", ifa->ifa_flags & IFF_UP ? "UP " : "DOWN", ifa->ifa_flags & IFF_LOOPBACK ? "YES" : "NO ", ifa->ifa_flags & IFF_BROADCAST ? "YES" : "NO ", ifa->ifa_flags & IFF_MULTICAST ? "YES" : "NO " ); continue; } char s[INET6_ADDRSTRLEN]; getnameinfo (ifa->ifa_addr, pgm_sockaddr_len(ifa->ifa_addr), s, sizeof(s), NULL, 0, NI_NUMERICHOST); pgm_string_append_printf (response, "#%d name %-15.15s IPv%i %-46.46s scope %u status %s loop %s b/c %s m/c %s
\n", i, b, ifa->ifa_addr->sa_family == AF_INET ? 4 : 6, s, (unsigned)pgm_sockaddr_scope_id(ifa->ifa_addr), ifa->ifa_flags & IFF_UP ? "UP " : "DOWN", ifa->ifa_flags & IFF_LOOPBACK ? "YES" : "NO ", ifa->ifa_flags & IFF_BROADCAST ? "YES" : "NO ", ifa->ifa_flags & IFF_MULTICAST ? "YES" : "NO " ); } pgm_freeifaddrs (ifap); pgm_string_append (response, "
\n"); http_finalize_response (connection, response); } static void transports_callback ( struct http_connection_t*restrict connection, PGM_GNUC_UNUSED const char*restrict path ) { pgm_string_t* response = http_create_response ("Transports", HTTP_TAB_TRANSPORTS); pgm_string_append (response, "
" "\n" "" "" "" "" "" "" ); if (pgm_sock_list) { pgm_rwlock_reader_lock (&pgm_sock_list_lock); pgm_slist_t* list = pgm_sock_list; while (list) { pgm_slist_t* next = list->next; pgm_sock_t* sock = list->data; char group_address[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len ((struct sockaddr*)&sock->send_gsr.gsr_group), group_address, sizeof(group_address), NULL, 0, NI_NUMERICHOST); char gsi[ PGM_GSISTRLEN ]; pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi)); const in_port_t sport = ntohs (sock->tsi.sport); const in_port_t dport = ntohs (sock->dport); pgm_string_append_printf (response, "" "" "" "" "" "", group_address, dport, gsi, sport, gsi, gsi, sport, sport); list = next; } pgm_rwlock_reader_unlock (&pgm_sock_list_lock); } else { /* no transports */ pgm_string_append (response, "" "" "" ); } pgm_string_append (response, "
Group addressDest portSource GSISource port
%s%u%s%u
This transport has no peers.
\n" "
"); http_finalize_response (connection, response); } static void histograms_callback ( struct http_connection_t*restrict connection, PGM_GNUC_UNUSED const char*restrict path ) { pgm_string_t* response = http_create_response ("Histograms", HTTP_TAB_HISTOGRAMS); pgm_histogram_write_html_graph_all (response); http_finalize_response (connection, response); } static void default_callback ( struct http_connection_t*restrict connection, const char* restrict path ) { pgm_tsi_t tsi; const int count = sscanf (path, "/%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hu", (unsigned char*)&tsi.gsi.identifier[0], (unsigned char*)&tsi.gsi.identifier[1], (unsigned char*)&tsi.gsi.identifier[2], (unsigned char*)&tsi.gsi.identifier[3], (unsigned char*)&tsi.gsi.identifier[4], (unsigned char*)&tsi.gsi.identifier[5], &tsi.sport); tsi.sport = htons (tsi.sport); if (count == 7) { const int retval = http_tsi_response (connection, &tsi); if (!retval) return; } http_set_status (connection, 404, "Not Found"); http_set_static_response (connection, WWW_404_HTML, strlen(WWW_404_HTML)); } static int http_tsi_response ( struct http_connection_t*restrict connection, const pgm_tsi_t* restrict tsi ) { /* first verify this is a valid TSI */ pgm_rwlock_reader_lock (&pgm_sock_list_lock); pgm_sock_t* sock = NULL; pgm_slist_t* list = pgm_sock_list; while (list) { pgm_sock_t* list_sock = (pgm_sock_t*)list->data; pgm_slist_t* next = list->next; /* check source */ if (pgm_tsi_equal (tsi, &list_sock->tsi)) { sock = list_sock; break; } /* check receivers */ pgm_rwlock_reader_lock (&list_sock->peers_lock); pgm_peer_t* receiver = pgm_hashtable_lookup (list_sock->peers_hashtable, tsi); if (receiver) { const int retval = http_receiver_response (connection, list_sock, receiver); pgm_rwlock_reader_unlock (&list_sock->peers_lock); pgm_rwlock_reader_unlock (&pgm_sock_list_lock); return retval; } pgm_rwlock_reader_unlock (&list_sock->peers_lock); list = next; } if (!sock) { pgm_rwlock_reader_unlock (&pgm_sock_list_lock); return -1; } /* transport now contains valid matching TSI */ char gsi[ PGM_GSISTRLEN ]; pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi)); char title[ sizeof("Transport .00000") + PGM_GSISTRLEN ]; sprintf (title, "Transport %s.%hu", gsi, ntohs (sock->tsi.sport)); char source_address[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&sock->send_gsr.gsr_source, pgm_sockaddr_len ((struct sockaddr*)&sock->send_gsr.gsr_source), source_address, sizeof(source_address), NULL, 0, NI_NUMERICHOST); char group_address[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len ((struct sockaddr*)&sock->send_gsr.gsr_group), group_address, sizeof(group_address), NULL, 0, NI_NUMERICHOST); const in_port_t dport = ntohs (sock->dport); const in_port_t sport = ntohs (sock->tsi.sport); const pgm_time_t ihb_min = sock->spm_heartbeat_len ? sock->spm_heartbeat_interval[ 1 ] : 0; const pgm_time_t ihb_max = sock->spm_heartbeat_len ? sock->spm_heartbeat_interval[ sock->spm_heartbeat_len - 1 ] : 0; char spm_path[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&sock->recv_gsr[0].gsr_source, pgm_sockaddr_len ((struct sockaddr*)&sock->recv_gsr[0].gsr_source), spm_path, sizeof(spm_path), NULL, 0, NI_NUMERICHOST); pgm_string_t* response = http_create_response (title, HTTP_TAB_TRANSPORTS); pgm_string_append_printf (response, "
" "Transport: " "%s.%u" "
", gsi, sport); /* peers */ pgm_string_append (response, "
" "\n" "" "" "" "" "" "" "" "" ); if (sock->peers_list) { pgm_rwlock_reader_lock (&sock->peers_lock); pgm_list_t* peers_list = sock->peers_list; while (peers_list) { pgm_list_t* next = peers_list->next; http_each_receiver (sock, peers_list->data, response); peers_list = next; } pgm_rwlock_reader_unlock (&sock->peers_lock); } else { /* no peers */ pgm_string_append (response, "" "" "" ); } pgm_string_append (response, "
Group addressDest portSource addressLast hopSource GSISource port
This transport has no peers.
\n" "
"); /* source and configuration information */ pgm_string_append_printf (response, "
" "\n" "" "" "" "" "" "" "" "" "" "" "", source_address, group_address, dport, gsi, sport); /* continue with source information */ pgm_string_append_printf (response, "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
Source address%s
Group address%s
Dest port%u
Source GSI%s
Source port%u
Ttl%u
Adv Mode%s
Late joindisable(2)
TXW_MAX_RTE%" GROUP_FORMAT "zd
TXW_SECS%" GROUP_FORMAT "u
TXW_ADV_SECS0
Ambient SPM interval%" GROUP_FORMAT PGM_TIME_FORMAT " ms
IHB_MIN%" GROUP_FORMAT PGM_TIME_FORMAT " ms
IHB_MAX%" GROUP_FORMAT PGM_TIME_FORMAT " ms
NAK_BO_IVL%" GROUP_FORMAT PGM_TIME_FORMAT " ms
FECdisabled(1)
Source Path Address%s
\n" "
", sock->hops, 0 == sock->adv_mode ? "time(0)" : "data(1)", sock->txw_max_rte, sock->txw_secs, pgm_to_msecs(sock->spm_ambient_interval), ihb_min, ihb_max, pgm_to_msecs(sock->nak_bo_ivl), spm_path); /* performance information */ const pgm_txw_t* window = sock->window; pgm_string_append_printf (response, "\n

Performance information

" "\n" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
Data bytes sent%" GROUP_FORMAT PRIu32 "
Data packets sent%" GROUP_FORMAT PRIu32 "
Bytes buffered%" GROUP_FORMAT PRIu32 "
Packets buffered%" GROUP_FORMAT PRIu32 "
Bytes sent%" GROUP_FORMAT PRIu32 "
Raw NAKs received%" GROUP_FORMAT PRIu32 "
Checksum errors%" GROUP_FORMAT PRIu32 "
Malformed NAKs%" GROUP_FORMAT PRIu32 "
Packets discarded%" GROUP_FORMAT PRIu32 "
Bytes retransmitted%" GROUP_FORMAT PRIu32 "
Packets retransmitted%" GROUP_FORMAT PRIu32 "
NAKs received%" GROUP_FORMAT PRIu32 "
NAKs ignored%" GROUP_FORMAT PRIu32 "
Transmission rate%" GROUP_FORMAT PRIu32 " bps
NNAK packets received%" GROUP_FORMAT PRIu32 "
NNAKs received%" GROUP_FORMAT PRIu32 "
Malformed NNAKs%" GROUP_FORMAT PRIu32 "
\n", sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT], sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT], window ? (uint32_t)pgm_txw_size (window) : 0, /* minus IP & any UDP header */ window ? (uint32_t)pgm_txw_length (window) : 0, sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED], sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS], sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS], sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED], sock->cumulative_stats[PGM_PC_SOURCE_TRANSMISSION_CURRENT_RATE], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED], sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED], sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS]); pgm_rwlock_reader_unlock (&pgm_sock_list_lock); http_finalize_response (connection, response); return 0; } static void http_each_receiver ( const pgm_sock_t* restrict sock, const pgm_peer_t* restrict peer, pgm_string_t* restrict response ) { char group_address[INET6_ADDRSTRLEN]; getnameinfo ((const struct sockaddr*)&peer->group_nla, pgm_sockaddr_len ((const struct sockaddr*)&peer->group_nla), group_address, sizeof(group_address), NULL, 0, NI_NUMERICHOST); char source_address[INET6_ADDRSTRLEN]; getnameinfo ((const struct sockaddr*)&peer->nla, pgm_sockaddr_len ((const struct sockaddr*)&peer->nla), source_address, sizeof(source_address), NULL, 0, NI_NUMERICHOST); char last_hop[INET6_ADDRSTRLEN]; getnameinfo ((const struct sockaddr*)&peer->local_nla, pgm_sockaddr_len ((const struct sockaddr*)&peer->local_nla), last_hop, sizeof(last_hop), NULL, 0, NI_NUMERICHOST); char gsi[ PGM_GSISTRLEN + sizeof(".00000") ]; pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi)); const uint16_t sport = ntohs (peer->tsi.sport); const uint16_t dport = ntohs (sock->dport); /* by definition must be the same */ pgm_string_append_printf (response, "" "%s" "%u" "%s" "%s" "%s" "%u" "", group_address, dport, source_address, last_hop, gsi, sport, gsi, gsi, sport, sport ); } static int http_time_summary ( const time_t* restrict activity_time, char* restrict sz ) { time_t now_time = time (NULL); if (*activity_time > now_time) { return sprintf (sz, "clock skew"); } struct tm* activity_tm = localtime (activity_time); now_time -= *activity_time; if (now_time < (24 * 60 * 60)) { char hourmin[6]; strftime (hourmin, sizeof(hourmin), "%H:%M", activity_tm); if (now_time < 60) { return sprintf (sz, "%s (%li second%s ago)", hourmin, now_time, now_time > 1 ? "s" : ""); } now_time /= 60; if (now_time < 60) { return sprintf (sz, "%s (%li minute%s ago)", hourmin, now_time, now_time > 1 ? "s" : ""); } now_time /= 60; return sprintf (sz, "%s (%li hour%s ago)", hourmin, now_time, now_time > 1 ? "s" : ""); } else { char daymonth[32]; #ifndef _WIN32 strftime (daymonth, sizeof(daymonth), "%d %b", activity_tm); #else wchar_t wdaymonth[32]; const size_t slen = strftime (daymonth, sizeof(daymonth), "%d %b", &activity_tm); const size_t wslen = MultiByteToWideChar (CP_ACP, 0, daymonth, slen, wdaymonth, 32); WideCharToMultiByte (CP_UTF8, 0, wdaymonth, wslen + 1, daymonth, sizeof(daymonth), NULL, NULL); #endif now_time /= 24; if (now_time < 14) { return sprintf (sz, "%s (%li day%s ago)", daymonth, now_time, now_time > 1 ? "s" : ""); } else { return sprintf (sz, "%s", daymonth); } } } static int http_receiver_response ( struct http_connection_t*restrict connection, const pgm_sock_t* restrict sock, const pgm_peer_t* restrict peer ) { char gsi[ PGM_GSISTRLEN ]; pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi)); char title[ sizeof("Peer .00000") + PGM_GSISTRLEN ]; sprintf (title, "Peer %s.%u", gsi, ntohs (peer->tsi.sport)); char group_address[INET6_ADDRSTRLEN]; getnameinfo ((const struct sockaddr*)&peer->group_nla, pgm_sockaddr_len ((const struct sockaddr*)&peer->group_nla), group_address, sizeof(group_address), NULL, 0, NI_NUMERICHOST); char source_address[INET6_ADDRSTRLEN]; getnameinfo ((const struct sockaddr*)&peer->nla, pgm_sockaddr_len ((const struct sockaddr*)&peer->nla), source_address, sizeof(source_address), NULL, 0, NI_NUMERICHOST); char last_hop[INET6_ADDRSTRLEN]; getnameinfo ((const struct sockaddr*)&peer->local_nla, pgm_sockaddr_len ((const struct sockaddr*)&peer->local_nla), last_hop, sizeof(last_hop), NULL, 0, NI_NUMERICHOST); const in_port_t sport = ntohs (peer->tsi.sport); const in_port_t dport = ntohs (sock->dport); /* by definition must be the same */ const pgm_rxw_t* window = peer->window; const uint32_t outstanding_naks = window->nak_backoff_queue.length + window->wait_ncf_queue.length + window->wait_data_queue.length; time_t last_activity_time; pgm_time_since_epoch (&peer->last_packet, &last_activity_time); char last_activity[100]; http_time_summary (&last_activity_time, last_activity); pgm_string_t* response = http_create_response (title, HTTP_TAB_TRANSPORTS); pgm_string_append_printf (response, "
" "Peer: " "%s.%u" "
", gsi, sport); /* peer information */ pgm_string_append_printf (response, "
" "\n" "" "" "" "" "" "" "" "" "" "" "" "" "", group_address, dport, source_address, last_hop, gsi, sport); pgm_string_append_printf (response, "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
Group address%s
Dest port%u
Source address%s
Last hop%s
Source GSI%s
Source port%u
NAK_BO_IVL%" GROUP_FORMAT PGM_TIME_FORMAT " ms
NAK_RPT_IVL%" GROUP_FORMAT PGM_TIME_FORMAT " ms
NAK_NCF_RETRIES%" GROUP_FORMAT "u
NAK_RDATA_IVL%" GROUP_FORMAT PGM_TIME_FORMAT " ms
NAK_DATA_RETRIES%" GROUP_FORMAT "u
Send NAKsenabled(1)
Late joindisabled(2)
NAK TTL%u
Delivery orderordered(2)
Multicast NAKsdisabled(2)
\n" "
", pgm_to_msecs (sock->nak_bo_ivl), pgm_to_msecs (sock->nak_rpt_ivl), sock->nak_ncf_retries, pgm_to_msecs (sock->nak_rdata_ivl), sock->nak_data_retries, sock->hops); pgm_string_append_printf (response, "\n

Performance information

" "\n" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" /* detected missed packets */ "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
Data bytes received%" GROUP_FORMAT PRIu32 "
Data packets received%" GROUP_FORMAT PRIu32 "
NAK failures%" GROUP_FORMAT PRIu32 "
Bytes received%" GROUP_FORMAT PRIu32 "
Checksum errors%" GROUP_FORMAT PRIu32 "
Malformed SPMs%" GROUP_FORMAT PRIu32 "
Malformed ODATA%" GROUP_FORMAT PRIu32 "
Malformed RDATA%" GROUP_FORMAT PRIu32 "
Malformed NCFs%" GROUP_FORMAT PRIu32 "
Packets discarded%" GROUP_FORMAT PRIu32 "
Losses%" GROUP_FORMAT PRIu32 "
Bytes delivered to app%" GROUP_FORMAT PRIu32 "
Packets delivered to app%" GROUP_FORMAT PRIu32 "
Duplicate SPMs%" GROUP_FORMAT PRIu32 "
Duplicate ODATA/RDATA%" GROUP_FORMAT PRIu32 "
NAK packets sent%" GROUP_FORMAT PRIu32 "
NAKs sent%" GROUP_FORMAT PRIu32 "
NAKs retransmitted%" GROUP_FORMAT PRIu32 "
NAKs failed%" GROUP_FORMAT PRIu32 "
NAKs failed due to RXW advance%" GROUP_FORMAT PRIu32 "
NAKs failed due to NCF retries%" GROUP_FORMAT PRIu32 "
NAKs failed due to DATA retries%" GROUP_FORMAT PRIu32 "
NAK failures delivered to app%" GROUP_FORMAT PRIu32 "
NAKs suppressed%" GROUP_FORMAT PRIu32 "
Malformed NAKs%" GROUP_FORMAT PRIu32 "
Outstanding NAKs%" GROUP_FORMAT PRIu32 "
Last activity%s
NAK repair min time%" GROUP_FORMAT PRIu32 " μs
NAK repair mean time%" GROUP_FORMAT PRIu32 " μs
NAK repair max time%" GROUP_FORMAT PRIu32 " μs
NAK fail min time%" GROUP_FORMAT PRIu32 " μs
NAK fail mean time%" GROUP_FORMAT PRIu32 " μs
NAK fail max time%" GROUP_FORMAT PRIu32 " μs
NAK min retransmit count%" GROUP_FORMAT PRIu32 "
NAK mean retransmit count%" GROUP_FORMAT PRIu32 "
NAK max retransmit count%" GROUP_FORMAT PRIu32 "
\n", peer->cumulative_stats[PGM_PC_RECEIVER_DATA_BYTES_RECEIVED], peer->cumulative_stats[PGM_PC_RECEIVER_DATA_MSGS_RECEIVED], peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAILURES], peer->cumulative_stats[PGM_PC_RECEIVER_BYTES_RECEIVED], sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS], peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS], peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_ODATA], peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_RDATA], peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS], peer->cumulative_stats[PGM_PC_RECEIVER_PACKETS_DISCARDED], window->cumulative_losses, window->bytes_delivered, window->msgs_delivered, peer->cumulative_stats[PGM_PC_RECEIVER_DUP_SPMS], peer->cumulative_stats[PGM_PC_RECEIVER_DUP_DATAS], peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT], peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT], peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_RETRANSMITTED], peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED], peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_RXW_ADVANCED], peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_NCF_RETRIES_EXCEEDED], peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_DATA_RETRIES_EXCEEDED], peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAILURES_DELIVERED], peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED], peer->cumulative_stats[PGM_PC_RECEIVER_NAK_ERRORS], outstanding_naks, last_activity, window->min_fill_time, peer->cumulative_stats[PGM_PC_RECEIVER_NAK_SVC_TIME_MEAN], window->max_fill_time, peer->min_fail_time, peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAIL_TIME_MEAN], peer->max_fail_time, window->min_nak_transmit_count, peer->cumulative_stats[PGM_PC_RECEIVER_TRANSMIT_MEAN], window->max_nak_transmit_count); http_finalize_response (connection, response); return 0; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/txw.c0000644000175000017500000005150711640407354016541 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * A basic transmit window: pointer array implementation. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include //#define TXW_DEBUG #ifndef TXW_DEBUG # define PGM_DISABLE_ASSERT #endif /* testing function: is TSI null * * returns TRUE if null, returns FALSE if not null. */ static inline bool pgm_tsi_is_null ( const void*const tsi ) { const union { pgm_tsi_t tsi; uint32_t l[2]; } *u = tsi; /* pre-conditions */ pgm_assert (NULL != tsi); return (0 == u->l[0] && 0 == u->l[1]); } /* returns the pointer at the given index of the window. responsibility * is with the caller to verify a single user ownership. */ static inline struct pgm_sk_buff_t* _pgm_txw_peek ( const pgm_txw_t*const window, const uint32_t sequence ) { struct pgm_sk_buff_t* skb; /* pre-conditions */ pgm_assert (NULL != window); if (pgm_txw_is_empty (window)) return NULL; if (pgm_uint32_gte (sequence, window->trail) && pgm_uint32_lte (sequence, window->lead)) { const uint_fast32_t index_ = sequence % pgm_txw_max_length (window); skb = window->pdata[index_]; pgm_assert (NULL != skb); pgm_assert (pgm_skb_is_valid (skb)); pgm_assert (pgm_tsi_is_null (&skb->tsi)); } else skb = NULL; return skb; } /* testing function: can a request be peeked from the retransmit queue. * * returns TRUE if request is available, returns FALSE if not available. */ static inline bool pgm_txw_retransmit_can_peek ( pgm_txw_t*const window ) { pgm_return_val_if_fail (NULL != window, FALSE); return (NULL != pgm_txw_retransmit_try_peek (window)); } /* sequence state must be smaller than PGM skbuff control buffer */ PGM_STATIC_ASSERT(sizeof(struct pgm_txw_state_t) <= sizeof(((struct pgm_sk_buff_t*)0)->cb)); PGM_GNUC_INTERNAL uint32_t pgm_txw_get_unfolded_checksum ( const struct pgm_sk_buff_t*const skb ) { const pgm_txw_state_t*const state = (const pgm_txw_state_t*const)&skb->cb; return state->unfolded_checksum; } PGM_GNUC_INTERNAL void pgm_txw_set_unfolded_checksum ( struct pgm_sk_buff_t*const skb, const uint32_t csum ) { pgm_txw_state_t* state = (pgm_txw_state_t*)&skb->cb; state->unfolded_checksum = csum; } PGM_GNUC_INTERNAL void pgm_txw_inc_retransmit_count ( struct pgm_sk_buff_t*const skb ) { pgm_txw_state_t*const state = (pgm_txw_state_t*const)&skb->cb; state->retransmit_count++; } PGM_GNUC_INTERNAL bool pgm_txw_retransmit_is_empty ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return pgm_queue_is_empty (&window->retransmit_queue); } /* globals */ static void pgm_txw_remove_tail (pgm_txw_t*const); static bool pgm_txw_retransmit_push_parity (pgm_txw_t*const, const uint32_t, const uint8_t); static bool pgm_txw_retransmit_push_selective (pgm_txw_t*const, const uint32_t); /* constructor for transmit window. zero-length windows are not permitted. * * returns pointer to window. */ PGM_GNUC_INTERNAL pgm_txw_t* pgm_txw_create ( const pgm_tsi_t*const tsi, const uint16_t tpdu_size, const uint32_t sqns, /* transmit window size in sequence numbers */ const unsigned secs, /* size in seconds */ const ssize_t max_rte, /* max bandwidth */ const bool use_fec, const uint8_t rs_n, const uint8_t rs_k ) { pgm_txw_t* window; /* pre-conditions */ pgm_assert (NULL != tsi); if (sqns) { pgm_assert_cmpuint (tpdu_size, ==, 0); pgm_assert_cmpuint (sqns, >, 0); pgm_assert_cmpuint (sqns & PGM_UINT32_SIGN_BIT, ==, 0); pgm_assert_cmpuint (secs, ==, 0); pgm_assert_cmpuint (max_rte, ==, 0); } else { pgm_assert_cmpuint (tpdu_size, >, 0); pgm_assert_cmpuint (secs, >, 0); pgm_assert_cmpuint (max_rte, >, 0); } if (use_fec) { pgm_assert_cmpuint (rs_n, >, 0); pgm_assert_cmpuint (rs_k, >, 0); } pgm_debug ("create (tsi:%s max-tpdu:%" PRIu16 " sqns:%" PRIu32 " secs %u max-rte %" PRIzd " use-fec:%s rs(n):%u rs(k):%u)", pgm_tsi_print (tsi), tpdu_size, sqns, secs, max_rte, use_fec ? "YES" : "NO", rs_n, rs_k); /* calculate transmit window parameters */ pgm_assert (sqns || (tpdu_size && secs && max_rte)); const unsigned alloc_sqns = sqns ? sqns : (unsigned)( (secs * max_rte) / tpdu_size ); window = pgm_malloc0 (sizeof(pgm_txw_t) + ( alloc_sqns * sizeof(struct pgm_sk_buff_t*) )); window->tsi = tsi; /* empty state for transmission group boundaries to align. * * trail = 0, lead = -1 */ window->lead = -1; window->trail = window->lead + 1; /* reed-solomon forward error correction */ if (use_fec) { window->parity_buffer = pgm_alloc_skb (tpdu_size); window->tg_sqn_shift = pgm_power2_log2 (rs_k); pgm_rs_create (&window->rs, rs_n, rs_k); window->is_fec_enabled = 1; } /* pointer array */ window->alloc = alloc_sqns; /* post-conditions */ pgm_assert_cmpuint (pgm_txw_max_length (window), ==, alloc_sqns); pgm_assert_cmpuint (pgm_txw_length (window), ==, 0); pgm_assert_cmpuint (pgm_txw_size (window), ==, 0); pgm_assert (pgm_txw_is_empty (window)); pgm_assert (!pgm_txw_is_full (window)); pgm_assert (!pgm_txw_retransmit_can_peek (window)); return window; } /* destructor for transmit window. must not be called more than once for same window. */ PGM_GNUC_INTERNAL void pgm_txw_shutdown ( pgm_txw_t*const window ) { /* pre-conditions */ pgm_assert (NULL != window); pgm_assert_cmpuint (window->alloc, >, 0); pgm_debug ("shutdown (window:%p)", (const void*)window); /* contents of window */ while (!pgm_txw_is_empty (window)) { pgm_txw_remove_tail (window); } /* window must now be empty */ pgm_assert_cmpuint (pgm_txw_length (window), ==, 0); pgm_assert_cmpuint (pgm_txw_size (window), ==, 0); pgm_assert (pgm_txw_is_empty (window)); pgm_assert (!pgm_txw_is_full (window)); /* retransmit queue must be empty */ pgm_assert (!pgm_txw_retransmit_can_peek (window)); /* free reed-solomon state */ if (window->is_fec_enabled) { pgm_free_skb (window->parity_buffer); pgm_rs_destroy (&window->rs); } /* window */ pgm_free (window); } /* add skb to transmit window, taking ownership. window does not grow. * PGM skbuff data/tail pointers must point to the PGM payload, and hence skb->len * is allowed to be zero. * * side effects: * * 1) sequence number is set in skb. * 2) window is updated with new skb. * * no return value. fatal error raised on invalid parameters. if window is full then * an entry is dropped to fulfil the request. * * it is an error to try to free the skb after adding to the window. */ PGM_GNUC_INTERNAL void pgm_txw_add ( pgm_txw_t* const restrict window, struct pgm_sk_buff_t* const restrict skb /* cannot be NULL */ ) { /* pre-conditions */ pgm_assert (NULL != window); pgm_assert (NULL != skb); pgm_assert_cmpuint (pgm_txw_max_length (window), >, 0); pgm_assert (pgm_skb_is_valid (skb)); pgm_assert (((const pgm_list_t*)skb)->next == NULL); pgm_assert (((const pgm_list_t*)skb)->prev == NULL); pgm_assert (pgm_tsi_is_null (&skb->tsi)); pgm_assert ((char*)skb->data > (char*)skb->head); pgm_assert ((sizeof(struct pgm_header) + sizeof(struct pgm_data)) <= (size_t)((char*)skb->data - (char*)skb->head)); pgm_debug ("add (window:%p skb:%p)", (const char*)window, (const char*)skb); if (pgm_txw_is_full (window)) { /* transmit window advancement scheme dependent action here */ pgm_txw_remove_tail (window); } /* generate new sequence number */ pgm_atomic_inc32 (&window->lead); skb->sequence = window->lead; /* add skb to window */ const uint_fast32_t index_ = skb->sequence % pgm_txw_max_length (window); window->pdata[index_] = skb; /* statistics */ window->size += skb->len; /* post-conditions */ pgm_assert_cmpuint (pgm_txw_length (window), >, 0); pgm_assert_cmpuint (pgm_txw_length (window), <=, pgm_txw_max_length (window)); } /* peek an entry from the window for retransmission. * * returns pointer to skbuff on success, returns NULL on invalid parameters. */ PGM_GNUC_INTERNAL struct pgm_sk_buff_t* pgm_txw_peek ( const pgm_txw_t*const window, const uint32_t sequence ) { pgm_debug ("peek (window:%p sequence:%" PRIu32 ")", (const void*)window, sequence); return _pgm_txw_peek (window, sequence); } /* remove an entry from the trailing edge of the transmit window. */ static void pgm_txw_remove_tail ( pgm_txw_t* const window ) { struct pgm_sk_buff_t *skb; pgm_txw_state_t *state; pgm_debug ("pgm_txw_remove_tail (window:%p)", (const void*)window); /* pre-conditions */ pgm_assert (NULL != window); pgm_assert (!pgm_txw_is_empty (window)); skb = _pgm_txw_peek (window, pgm_txw_trail (window)); pgm_assert (NULL != skb); pgm_assert (pgm_skb_is_valid (skb)); pgm_assert (pgm_tsi_is_null (&skb->tsi)); state = (pgm_txw_state_t*)&skb->cb; if (state->waiting_retransmit) { pgm_queue_unlink (&window->retransmit_queue, (pgm_list_t*)skb); state->waiting_retransmit = 0; } /* statistics */ window->size -= skb->len; if (state->retransmit_count > 0) { PGM_HISTOGRAM_COUNTS("Tx.RetransmitCount", state->retransmit_count); } if (state->nak_elimination_count > 0) { PGM_HISTOGRAM_COUNTS("Tx.NakEliminationCount", state->nak_elimination_count); } /* remove reference to skb */ if (PGM_UNLIKELY(pgm_mem_gc_friendly)) { const uint_fast32_t index_ = skb->sequence % pgm_txw_max_length (window); window->pdata[index_] = NULL; } pgm_free_skb (skb); /* advance trailing pointer */ pgm_atomic_inc32 (&window->trail); /* post-conditions */ pgm_assert (!pgm_txw_is_full (window)); } /* Try to add a sequence number to the retransmit queue, ignore if * already there or no longer in the transmit window. * * For parity NAKs, we deal on the transmission group sequence number * rather than the packet sequence number. To simplify managment we * use the leading window packet to store the details of the entire * transmisison group. Parity NAKs are ignored if the packet count is * less than or equal to the count already queued for retransmission. * * returns FALSE if request was eliminated, returns TRUE if request was * added to queue. */ PGM_GNUC_INTERNAL bool pgm_txw_retransmit_push ( pgm_txw_t* const window, const uint32_t sequence, const bool is_parity, /* parity NAK ⇒ sequence_number = transmission group | packet count */ const uint8_t tg_sqn_shift ) { /* pre-conditions */ pgm_assert (NULL != window); pgm_assert_cmpuint (tg_sqn_shift, <, 8 * sizeof(uint32_t)); pgm_debug ("retransmit_push (window:%p sequence:%" PRIu32 " is_parity:%s tg_sqn_shift:%u)", (const void*)window, sequence, is_parity ? "TRUE" : "FALSE", tg_sqn_shift); /* early elimination */ if (pgm_txw_is_empty (window)) return FALSE; if (is_parity) { return pgm_txw_retransmit_push_parity (window, sequence, tg_sqn_shift); } else { return pgm_txw_retransmit_push_selective (window, sequence); } } static bool pgm_txw_retransmit_push_parity ( pgm_txw_t* const window, const uint32_t sequence, const uint8_t tg_sqn_shift ) { struct pgm_sk_buff_t *skb; pgm_txw_state_t *state; /* pre-conditions */ pgm_assert (NULL != window); pgm_assert_cmpuint (tg_sqn_shift, <, 8 * sizeof(uint32_t)); const uint32_t tg_sqn_mask = 0xffffffff << tg_sqn_shift; const uint32_t nak_tg_sqn = sequence & tg_sqn_mask; /* left unshifted */ const uint32_t nak_pkt_cnt = sequence & ~tg_sqn_mask; skb = _pgm_txw_peek (window, nak_tg_sqn); if (NULL == skb) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Transmission group lead #%" PRIu32 " not in window."), nak_tg_sqn); return FALSE; } pgm_assert (pgm_skb_is_valid (skb)); pgm_assert (pgm_tsi_is_null (&skb->tsi)); state = (pgm_txw_state_t*)&skb->cb; /* check if request can be eliminated */ if (state->waiting_retransmit) { pgm_assert (NULL != ((const pgm_list_t*)skb)->next); pgm_assert (NULL != ((const pgm_list_t*)skb)->prev); if (state->pkt_cnt_requested < nak_pkt_cnt) { /* more parity packets requested than currently scheduled, simply bump up the count */ state->pkt_cnt_requested = nak_pkt_cnt; } state->nak_elimination_count++; return FALSE; } else { pgm_assert (((const pgm_list_t*)skb)->next == NULL); pgm_assert (((const pgm_list_t*)skb)->prev == NULL); } /* new request */ state->pkt_cnt_requested++; pgm_queue_push_head_link (&window->retransmit_queue, (pgm_list_t*)skb); pgm_assert (!pgm_queue_is_empty (&window->retransmit_queue)); state->waiting_retransmit = 1; return TRUE; } static bool pgm_txw_retransmit_push_selective ( pgm_txw_t* const window, const uint32_t sequence ) { struct pgm_sk_buff_t *skb; pgm_txw_state_t *state; /* pre-conditions */ pgm_assert (NULL != window); skb = _pgm_txw_peek (window, sequence); if (NULL == skb) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Requested packet #%" PRIu32 " not in window."), sequence); return FALSE; } pgm_assert (pgm_skb_is_valid (skb)); pgm_assert (pgm_tsi_is_null (&skb->tsi)); state = (pgm_txw_state_t*)&skb->cb; /* check if request can be eliminated */ if (state->waiting_retransmit) { pgm_assert (!pgm_queue_is_empty (&window->retransmit_queue)); state->nak_elimination_count++; return FALSE; } pgm_assert (((const pgm_list_t*)skb)->next == NULL); pgm_assert (((const pgm_list_t*)skb)->prev == NULL); /* new request */ pgm_queue_push_head_link (&window->retransmit_queue, (pgm_list_t*)skb); pgm_assert (!pgm_queue_is_empty (&window->retransmit_queue)); state->waiting_retransmit = 1; return TRUE; } /* try to peek a request from the retransmit queue * * return pointer of first skb in queue, or return NULL if the queue is empty. */ PGM_GNUC_INTERNAL struct pgm_sk_buff_t* pgm_txw_retransmit_try_peek ( pgm_txw_t* const window ) { struct pgm_sk_buff_t *skb; pgm_txw_state_t *state; bool is_var_pktlen = FALSE; bool is_op_encoded = FALSE; uint16_t parity_length = 0; const pgm_gf8_t **src; void *data; /* pre-conditions */ pgm_assert (NULL != window); src = pgm_newa (const pgm_gf8_t*, window->rs.k); pgm_debug ("retransmit_try_peek (window:%p)", (const void*)window); /* no lock required to detect presence of a request */ skb = (struct pgm_sk_buff_t*)pgm_queue_peek_tail_link (&window->retransmit_queue); if (PGM_UNLIKELY(NULL == skb)) { pgm_debug ("retransmit queue empty on peek."); return NULL; } pgm_assert (pgm_skb_is_valid (skb)); state = (pgm_txw_state_t*)&skb->cb; if (!state->waiting_retransmit) { pgm_assert (((const pgm_list_t*)skb)->next == NULL); pgm_assert (((const pgm_list_t*)skb)->prev == NULL); } /* packet payload still in transit */ if (PGM_UNLIKELY(1 != pgm_atomic_read32 (&skb->users))) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Retransmit sqn #%" PRIu32 " is still in transit in transmit thread."), skb->sequence); return NULL; } if (!state->pkt_cnt_requested) { return skb; } /* generate parity packet to satisify request */ const uint8_t rs_h = state->pkt_cnt_sent % (window->rs.n - window->rs.k); const uint32_t tg_sqn_mask = 0xffffffff << window->tg_sqn_shift; const uint32_t tg_sqn = skb->sequence & tg_sqn_mask; for (uint_fast8_t i = 0; i < window->rs.k; i++) { const struct pgm_sk_buff_t* odata_skb = pgm_txw_peek (window, tg_sqn + i); const uint16_t odata_tsdu_length = ntohs (odata_skb->pgm_header->pgm_tsdu_length); if (!parity_length) { parity_length = odata_tsdu_length; } else if (odata_tsdu_length != parity_length) { is_var_pktlen = TRUE; if (odata_tsdu_length > parity_length) parity_length = odata_tsdu_length; } src[i] = odata_skb->data; if (odata_skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { is_op_encoded = TRUE; } } /* construct basic PGM header to be completed by send_rdata() */ skb = window->parity_buffer; skb->data = skb->tail = skb->head = skb + 1; /* space for PGM header */ pgm_skb_put (skb, sizeof(struct pgm_header)); skb->pgm_header = skb->data; skb->pgm_data = (void*)( skb->pgm_header + 1 ); memcpy (skb->pgm_header->pgm_gsi, &window->tsi->gsi, sizeof(pgm_gsi_t)); skb->pgm_header->pgm_options = PGM_OPT_PARITY; /* append actual TSDU length if variable length packets, zero pad as necessary. */ if (is_var_pktlen) { skb->pgm_header->pgm_options |= PGM_OPT_VAR_PKTLEN; for (uint_fast8_t i = 0; i < window->rs.k; i++) { struct pgm_sk_buff_t* odata_skb = pgm_txw_peek (window, tg_sqn + i); const uint16_t odata_tsdu_length = ntohs (odata_skb->pgm_header->pgm_tsdu_length); pgm_assert (odata_tsdu_length == odata_skb->len); pgm_assert (parity_length >= odata_tsdu_length); if (!odata_skb->zero_padded) { memset (odata_skb->tail, 0, parity_length - odata_tsdu_length); *(uint16_t*)((char*)odata_skb->data + parity_length) = odata_tsdu_length; odata_skb->zero_padded = 1; } } parity_length += 2; } skb->pgm_header->pgm_tsdu_length = htons (parity_length); /* space for DATA */ pgm_skb_put (skb, sizeof(struct pgm_data) + parity_length); skb->pgm_data->data_sqn = htonl ( tg_sqn | rs_h ); data = skb->pgm_data + 1; /* encode every option separately, currently only one applies: opt_fragment */ if (is_op_encoded) { struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; struct pgm_opt_fragment *opt_fragment, null_opt_fragment; const pgm_gf8_t *opt_src[ window->rs.k ]; skb->pgm_header->pgm_options |= PGM_OPT_PRESENT; memset (&null_opt_fragment, 0, sizeof(null_opt_fragment)); *(uint8_t*)&null_opt_fragment |= PGM_OP_ENCODED_NULL; for (uint_fast8_t i = 0; i < window->rs.k; i++) { const struct pgm_sk_buff_t* odata_skb = pgm_txw_peek (window, tg_sqn + i); if (odata_skb->pgm_opt_fragment) { pgm_assert (odata_skb->pgm_header->pgm_options & PGM_OPT_PRESENT); /* skip three bytes of header */ opt_src[i] = (pgm_gf8_t*)((char*)odata_skb->pgm_opt_fragment + sizeof (struct pgm_opt_header)); } else { opt_src[i] = (pgm_gf8_t*)&null_opt_fragment; } } /* add options to this rdata packet */ const uint16_t opt_total_length = sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); /* add space for PGM options */ pgm_skb_put (skb, opt_total_length); opt_len = data; opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ( opt_total_length ); opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_FRAGMENT | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); opt_header->opt_reserved = PGM_OP_ENCODED; opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); /* The cast below is the correct way to handle the problem. * The (void *) cast is to avoid a GCC warning like: * * "warning: dereferencing type-punned pointer will break strict-aliasing rules" */ pgm_rs_encode (&window->rs, opt_src, window->rs.k + rs_h, (pgm_gf8_t*)((char*)opt_fragment + sizeof(struct pgm_opt_header)), sizeof(struct pgm_opt_fragment) - sizeof(struct pgm_opt_header)); data = opt_fragment + 1; } /* encode payload */ pgm_rs_encode (&window->rs, src, window->rs.k + rs_h, data, parity_length); /* calculate partial checksum */ const uint16_t tsdu_length = ntohs (skb->pgm_header->pgm_tsdu_length); state->unfolded_checksum = pgm_csum_partial ((char*)skb->tail - tsdu_length, tsdu_length, 0); return skb; } /* remove head entry from retransmit queue, will fail on assertion if queue is empty. */ PGM_GNUC_INTERNAL void pgm_txw_retransmit_remove_head ( pgm_txw_t* const window ) { struct pgm_sk_buff_t *skb; pgm_txw_state_t *state; /* pre-conditions */ pgm_assert (NULL != window); pgm_debug ("retransmit_remove_head (window:%p)", (const void*)window); /* tail link is valid without lock */ skb = (struct pgm_sk_buff_t*)pgm_queue_peek_tail_link (&window->retransmit_queue); pgm_assert (pgm_skb_is_valid (skb)); pgm_assert (pgm_tsi_is_null (&skb->tsi)); state = (pgm_txw_state_t*)&skb->cb; if (!state->waiting_retransmit) { pgm_assert (((const pgm_list_t*)skb)->next == NULL); pgm_assert (((const pgm_list_t*)skb)->prev == NULL); } if (state->pkt_cnt_requested) { state->pkt_cnt_sent++; /* remove if all requested parity packets have been sent */ if (state->pkt_cnt_sent == state->pkt_cnt_requested) { pgm_queue_pop_tail_link (&window->retransmit_queue); state->waiting_retransmit = 0; } } else /* selective request */ { pgm_queue_pop_tail_link (&window->retransmit_queue); state->waiting_retransmit = 0; } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/valgrind.supp0000644000175000017500000000461611640407354020271 0ustar locallocal##----------------------------------------------------------------------## ## Suppressions to run OpenPGM { miru-glib-hack-1 Memcheck:Leak fun:memalign fun:posix_memalign obj:/usr/lib/libglib-2.0.so* fun:g_slice_alloc } { miru-glib-hack-2 Memcheck:Leak fun:calloc fun:g_malloc0 obj:/usr/lib/libglib-2.0.so* fun:g_slice_alloc } { miru-glib-hack-2b Memcheck:Leak fun:malloc fun:g_malloc obj:/usr/lib/libglib-2.0.so* fun:g_slice_alloc } { miru-glib-hack-3 Memcheck:Leak fun:malloc fun:realloc fun:g_realloc obj:/usr/lib/libglib-2.0.so* fun:g_ptr_array_add fun:g_main_context_check obj:/usr/lib/libglib-2.0.so* fun:g_main_loop_run } { miru-glib-hack-4 Memcheck:Leak fun:realloc fun:g_realloc obj:/usr/lib/libglib-2.0.so* fun:g_array_set_size fun:g_static_private_set fun:g_get_language_names } { miru-glib-hack-5 Memcheck:Leak fun:malloc fun:g_malloc fun:g_slice_alloc fun:g_array_sized_new fun:g_static_private_set fun:g_get_charset fun:g_log_default_handler fun:g_logv fun:g_log } { miru-glib-hack-6 Memcheck:Leak fun:malloc fun:g_malloc fun:g_log_set_handler } { miru-glib-hack-7 Memcheck:Leak fun:calloc fun:g_malloc0 fun:g_thread_self fun:g_thread_init_glib } ## Annoying libc errors { miru-libc-hack-1 Memcheck:Addr8 obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/libc-2.*.so obj:/lib/ld-2.*.so fun:__libc_dlopen_mode fun:__nss_lookup_function obj:/lib/libc-2.*.so fun:getprotobyname_r } { miru-libc-hack-1b Memcheck:Addr8 obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/libc-2.*.so obj:/lib/ld-2.*.so fun:__libc_dlopen_mode fun:__nss_lookup_function obj:/lib/libc-2.*.so fun:getprotobyname_r } { miru-libc-hack-2 Memcheck:Cond obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/libc-2.*.so obj:/lib/ld-2.*.so fun:__libc_dlsym fun:__nss_lookup_function obj:/lib/libc-2.*.so fun:getaddrinfo } { miru-libc-hack-3 Memcheck:Addr8 obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/ld-2.*.so obj:/lib/libc-2.*.so obj:/lib/ld-2.*.so fun:__libc_dlsym fun:__nss_lookup_function obj:/lib/libc-2.*.so fun:getaddrinfo } libpgm-5.1.118-1~dfsg/openpgm/pgm/rxw_unittest.c0000644000175000017500000017064711640407354020505 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for receive window. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock global */ #define pgm_histogram_add mock_pgm_histogram_add #define pgm_time_now mock_pgm_time_now #define pgm_rs_create mock_pgm_rs_create #define pgm_rs_destroy mock_pgm_rs_destroy #define pgm_rs_decode_parity_appended mock_pgm_rs_decode_parity_appended #define pgm_histogram_init mock_pgm_histogram_init #define RXW_DEBUG #include "rxw.c" #ifdef PGM_DISABLE_ASSERT # error "PGM_DISABLE_ASSERT set" #endif static pgm_time_t mock_pgm_time_now = 0x1; /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /** reed-solomon module */ void mock_pgm_rs_create ( pgm_rs_t* rs, uint8_t n, uint8_t k ) { } void mock_pgm_rs_destroy ( pgm_rs_t* rs ) { } void mock_pgm_rs_decode_parity_appended ( pgm_rs_t* rs, pgm_gf8_t** block, const uint8_t* offsets, uint16_t len ) { // null } void mock_pgm_histogram_init ( pgm_histogram_t* histogram ) { } void mock_pgm_histogram_add ( pgm_histogram_t* histogram, int value ) { } /* generate valid skb, data pointer pointing to PGM payload */ static struct pgm_sk_buff_t* generate_valid_skb (void) { const pgm_tsi_t tsi = { { 200, 202, 203, 204, 205, 206 }, 2000 }; const guint16 tsdu_length = 1000; const guint16 header_length = sizeof(struct pgm_header) + sizeof(struct pgm_data); struct pgm_sk_buff_t* skb = pgm_alloc_skb (1500); memcpy (&skb->tsi, &tsi, sizeof(tsi)); /* fake but valid socket and timestamp */ skb->sock = (pgm_sock_t*)0x1; skb->tstamp = pgm_time_now; /* header */ pgm_skb_reserve (skb, header_length); memset (skb->head, 0, header_length); skb->pgm_header = (struct pgm_header*)skb->head; skb->pgm_data = (struct pgm_data*)(skb->pgm_header + 1); skb->pgm_header->pgm_type = PGM_ODATA; skb->pgm_header->pgm_tsdu_length = g_htons (tsdu_length); /* DATA */ pgm_skb_put (skb, tsdu_length); return skb; } /* target: * pgm_rxw_t* * pgm_rxw_create ( * const pgm_tsi_t* tsi, * const uint16_t tpdu_size, * const unsigned sqns, * const unsigned secs, * const ssize_t max_rte, * const uint32_t ack_c_p * ) */ /* vanilla sequence count window */ START_TEST (test_create_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; fail_if (NULL == pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p), "create failed"); } END_TEST /* vanilla time based window */ START_TEST (test_create_pass_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; fail_if (NULL == pgm_rxw_create (&tsi, 1500, 0, 60, 800000, ack_c_p), "create failed"); } END_TEST /* jumbo frame */ START_TEST (test_create_pass_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; fail_if (NULL == pgm_rxw_create (&tsi, 9000, 0, 60, 800000, ack_c_p), "create failed"); } END_TEST /* max frame */ START_TEST (test_create_pass_004) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; fail_if (NULL == pgm_rxw_create (&tsi, UINT16_MAX, 0, 60, 800000, ack_c_p), "create failed"); } END_TEST /* invalid tsi pointer */ START_TEST (test_create_fail_001) { const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (NULL, 1500, 100, 0, 0, ack_c_p); fail ("reached"); } END_TEST /* invalid tpdu size */ START_TEST (test_create_fail_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; fail_if (NULL == pgm_rxw_create (&tsi, 0, 100, 0, 0, ack_c_p), "create failed"); } END_TEST START_TEST (test_create_fail_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 0, 0, 60, 800000, ack_c_p); fail ("reached"); } END_TEST /* no specified sequence count or time value */ START_TEST (test_create_fail_004) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 0, 0, 0, 800000, ack_c_p); fail ("reached"); } END_TEST /* no specified rate */ START_TEST (test_create_fail_005) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 0, 0, 60, 0, ack_c_p); fail ("reached"); } END_TEST /* all invalid */ START_TEST (test_create_fail_006) { pgm_rxw_t* window = pgm_rxw_create (NULL, 0, 0, 0, 0, 0); fail ("reached"); } END_TEST /* target: * void * pgm_rxw_destroy ( * pgm_rxw_t* const window * ) */ START_TEST (test_destroy_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_destroy_fail_001) { pgm_rxw_destroy (NULL); fail ("reached"); } END_TEST /* target: * int * pgm_rxw_add ( * pgm_rxw_t* const window, * struct pgm_sk_buff_t* const skb, * const pgm_time_t now, * const pgm_time_t nak_rb_expiry * ) * failures raise assert errors and stop process execution. */ START_TEST (test_add_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); pgm_rxw_destroy (window); } END_TEST /* missing + inserted */ START_TEST (test_add_pass_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); /* #1 */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); /* #2 with jump */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (2); fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not missing"); /* #3 to fill in gap */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); fail_unless (PGM_RXW_INSERTED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not inserted"); pgm_rxw_destroy (window); } END_TEST /* duplicate + append */ START_TEST (test_add_pass_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); /* #1 */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); /* #2 repeat sequence */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); fail_unless (PGM_RXW_DUPLICATE == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not duplicate"); /* #3 append */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); pgm_rxw_destroy (window); } END_TEST /* malformed: tpdu too long */ START_TEST (test_add_pass_004) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (65535); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_MALFORMED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not malformed"); } END_TEST /* bounds + append */ START_TEST (test_add_pass_005) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); /* #1 */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); skb->pgm_data->data_trail = g_htonl (-10); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); /* #2 jump backwards */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (-1); skb->pgm_data->data_trail = g_htonl (-10); fail_unless (PGM_RXW_BOUNDS == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not bounds"); /* #3 append */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); skb->pgm_data->data_trail = g_htonl (-10); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); /* #4 jump forward */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (100 + (UINT32_MAX / 2)); skb->pgm_data->data_trail = g_htonl (UINT32_MAX / 2); fail_unless (PGM_RXW_BOUNDS == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not bounds"); /* #5 append */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (2); skb->pgm_data->data_trail = g_htonl (-10); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); pgm_rxw_destroy (window); } END_TEST /* null skb */ START_TEST (test_add_fail_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; int retval = pgm_rxw_add (window, NULL, now, nak_rb_expiry); fail ("reached"); } END_TEST /* null window */ START_TEST (test_add_fail_002) { struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; int retval = pgm_rxw_add (NULL, skb, now, nak_rb_expiry); fail ("reached"); } END_TEST /* null skb content */ START_TEST (test_add_fail_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); char buffer[1500]; memset (buffer, 0, sizeof(buffer)); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; int retval = pgm_rxw_add (window, (struct pgm_sk_buff_t*)buffer, now, nak_rb_expiry); fail ("reached"); } END_TEST /* 0 nak_rb_expiry */ START_TEST (test_add_fail_004) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; int retval = pgm_rxw_add (window, skb, now, 0); fail ("reached"); } END_TEST /* target: * struct pgm_sk_buff_t* * pgm_rxw_peek ( * pgm_rxw_t* const window, * const uint32_t sequence * ) */ START_TEST (test_peek_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); fail_unless (NULL == pgm_rxw_peek (window, 0), "peek failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (skb == pgm_rxw_peek (window, 0), "peek failed"); fail_unless (NULL == pgm_rxw_peek (window, 1), "peek failed"); fail_unless (NULL == pgm_rxw_peek (window, -1), "peek failed"); pgm_rxw_destroy (window); } END_TEST /* null window */ START_TEST (test_peek_fail_001) { struct pgm_sk_buff_t* skb = pgm_rxw_peek (NULL, 0); fail ("reached"); } END_TEST /** inline function tests **/ /* pgm_rxw_max_length () */ START_TEST (test_max_length_pass_001) { const guint window_length = 100; pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, window_length, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); fail_unless (window_length == pgm_rxw_max_length (window), "max_length failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_max_length_fail_001) { const unsigned len = pgm_rxw_max_length (NULL); fail ("reached"); } END_TEST /* pgm_rxw_length () */ START_TEST (test_length_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); fail_unless (0 == pgm_rxw_length (window), "length failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (1 == pgm_rxw_length (window), "length failed"); /* #2 */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (2 == pgm_rxw_length (window), "length failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_length_fail_001) { const uint32_t answer = pgm_rxw_length (NULL); fail ("reached"); } END_TEST /* pgm_rxw_size () */ START_TEST (test_size_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); fail_unless (0 == pgm_rxw_size (window), "size failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (1000 == pgm_rxw_size (window), "size failed"); /* #2 */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (2000 == pgm_rxw_size (window), "size failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_size_fail_001) { const size_t answer = pgm_rxw_size (NULL); fail ("reached"); } END_TEST /* pgm_rxw_is_empty */ START_TEST (test_is_empty_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); fail_unless (pgm_rxw_is_empty (window), "is_empty failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_if (pgm_rxw_is_empty (window), "is_empty failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_is_empty_fail_001) { const bool answer = pgm_rxw_is_empty (NULL); fail ("reached"); } END_TEST /* pgm_rxw_is_full */ START_TEST (test_is_full_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 1, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); fail_if (pgm_rxw_is_full (window), "is_full failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (pgm_rxw_is_full (window), "is_full failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_is_full_fail_001) { const bool answer = pgm_rxw_is_full (NULL); fail ("reached"); } END_TEST /* pgm_rxw_lead */ START_TEST (test_lead_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); guint32 lead = pgm_rxw_lead (window); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (lead + 1 == pgm_rxw_lead (window), "lead failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_lead_fail_001) { const uint32_t answer = pgm_rxw_lead (NULL); fail ("reached"); } END_TEST /* pgm_rxw_next_lead */ START_TEST (test_next_lead_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); guint32 next_lead = pgm_rxw_next_lead (window); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (next_lead == pgm_rxw_lead (window), "lead failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_next_lead_fail_001) { const uint32_t answer = pgm_rxw_next_lead (NULL); fail ("reached"); } END_TEST /* target: * ssize_t * pgm_rxw_readv ( * pgm_rxw_t* const window, * struct pgm_msgv_t** pmsg, * const unsigned msg_len * ) */ START_TEST (test_readv_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[2], *pmsg; /* #1 empty */ pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); /* #2 single TPDU-APDU */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); pmsg = msgv; fail_unless (1000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); /* #3,4 two APDUs */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (2); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); pmsg = msgv; fail_unless (2000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); /* #5,6 skip and repair APDU */ pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (4); fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not missing"); pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (3); fail_unless (PGM_RXW_INSERTED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not inserted"); pmsg = msgv; fail_unless (2000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pgm_rxw_destroy (window); } END_TEST /* zero-length */ START_TEST (test_readv_pass_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[2], *pmsg; struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pgm_rxw_destroy (window); } END_TEST /* full window */ START_TEST (test_readv_pass_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; for (unsigned i = 0; i < 100; i++) { skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); for (unsigned i = 0; i < 100; i++) { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless ((1 + i) == _pgm_rxw_commit_length (window), "commit_length failed"); } fail_unless (pgm_rxw_length (window) == _pgm_rxw_commit_length (window), "commit_length failed"); pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pgm_rxw_destroy (window); } END_TEST /* full + 1 window */ START_TEST (test_readv_pass_004) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; for (unsigned i = 0; i < 101; i++) { skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (MIN(100, 1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); for (unsigned i = 0; i < 100; i++) { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless ((1 + i) == _pgm_rxw_commit_length (window), "commit_length failed"); } fail_unless (pgm_rxw_length (window) == _pgm_rxw_commit_length (window), "commit_length failed"); pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pgm_rxw_destroy (window); } END_TEST /* full - 2 lost last in window */ START_TEST (test_readv_pass_005) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; for (unsigned i = 0; i < 98; i++) { skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_if (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); { unsigned i = 99; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not missing"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); for (unsigned i = 0; i < 98; i++) { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless ((1 + i) == _pgm_rxw_commit_length (window), "commit_length failed"); } fail_unless (pgm_rxw_length (window) == (2 + _pgm_rxw_commit_length (window)), "commit_length failed"); /* read end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST /* add full window, readv 1 skb, add 1 more */ START_TEST (test_readv_pass_006) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; for (unsigned i = 0; i < 100; i++) { skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (MIN(100, 1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); /* read one skb */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless (1 == _pgm_rxw_commit_length (window), "commit_length failed"); } /* add one more new skb */ { unsigned i = 100; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_BOUNDS == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not bounds"); fail_unless (MIN(100, 1 + i) == pgm_rxw_length (window), "length failed"); } /* read off 99 more skbs */ for (unsigned i = 0; i < 99; i++) { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless ((2 + i) == _pgm_rxw_commit_length (window), "commit_length failed"); } /* read end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST /* NULL window */ START_TEST (test_readv_fail_001) { struct pgm_msgv_t msgv[1], *pmsg = msgv; gssize len = pgm_rxw_readv (NULL, &pmsg, G_N_ELEMENTS(msgv)); fail ("reached"); } END_TEST /* NULL pmsg */ START_TEST (test_readv_fail_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); struct pgm_msgv_t msgv[1], *pmsg = msgv; gssize len = pgm_rxw_readv (window, NULL, G_N_ELEMENTS(msgv)); fail ("reached"); } END_TEST /* 0 msg-len */ START_TEST (test_readv_fail_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); struct pgm_msgv_t msgv[1], *pmsg = msgv; gssize len = pgm_rxw_readv (window, &pmsg, 0); fail ("reached"); } END_TEST /* target: * * void * pgm_rxw_remove_commit ( * pgm_rxw_t* const window * ) */ /* full - 2 lost last in window */ START_TEST (test_remove_commit_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; for (unsigned i = 0; i < 98; i++) { skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_if (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); /* #98 is missing */ { unsigned i = 99; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty"); /* now mark #98 lost */ pgm_rxw_lost (window, 98); for (unsigned i = 0; i < 98; i++) { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless ((1 + i) == _pgm_rxw_commit_length (window), "commit_length failed"); } fail_unless (100 == pgm_rxw_length (window), "length failed"); fail_unless ( 98 == _pgm_rxw_commit_length (window), "commit_length failed"); /* read end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } fail_unless (100 == pgm_rxw_length (window), "length failed"); fail_unless ( 98 == _pgm_rxw_commit_length (window), "commit_length failed"); pgm_rxw_remove_commit (window); /* read lost skb #98 */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_remove_commit (window); /* read valid skb #99 */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } /* read end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST START_TEST (test_remove_commit_fail_001) { pgm_rxw_remove_commit (NULL); fail ("reached"); } END_TEST /* target: * unsigned * pgm_rxw_remove_trail ( * pgm_rxw_t* const window * ) */ START_TEST (test_remove_trail_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[2], *pmsg; fail_unless (0 == pgm_rxw_remove_trail (window), "remove_trail failed"); /* #1,2 two APDUs */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (2); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); fail_unless (1 == pgm_rxw_remove_trail (window), "remove_trail failed"); fail_unless (1 == pgm_rxw_length (window), "length failed"); fail_unless (1000 == pgm_rxw_size (window), "size failed"); pmsg = msgv; fail_unless (1000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless (0 == pgm_rxw_remove_trail (window), "remove_trail failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_remove_trail_fail_001) { guint count = pgm_rxw_remove_trail (NULL); fail ("reached"); } END_TEST /* target: * unsigned * pgm_rxw_update ( * pgm_rxw_t* const window, * const uint32_t txw_trail, * const uint32_t txw_lead, * const pgm_time_t now, * const pgm_time_t nak_rb_expiry * ) */ START_TEST (test_update_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (0 == pgm_rxw_update (window, 100, 99, now, nak_rb_expiry), "update failed"); /* dupe */ fail_unless (0 == pgm_rxw_update (window, 100, 99, now, nak_rb_expiry), "update failed"); /* #1 at 100 */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (100); fail_unless (PGM_RXW_BOUNDS == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not bounds"); /* #2 at 101 */ skb->pgm_data->data_sqn = g_htonl (101); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); struct pgm_msgv_t msgv[1], *pmsg = msgv; fail_unless (1000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); /* #3 at 102 */ fail_unless (1 == pgm_rxw_update (window, 102, 99, now, nak_rb_expiry), "update failed"); skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (102); fail_unless (PGM_RXW_INSERTED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not inserted"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_update_fail_001) { guint count = pgm_rxw_update (NULL, 0, 0, 0, 0); fail ("reached"); } END_TEST /* target: * int * pgm_rxw_confirm ( * pgm_rxw_t* const window, * const uint32_t sequence, * const pgm_time_t now, * const pgm_time_t nak_rdata_expiry, * const pgm_time_t nak_rb_expiry * ) */ START_TEST (test_confirm_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); const pgm_time_t now = 1; const pgm_time_t nak_rdata_expiry = 2; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_BOUNDS == pgm_rxw_confirm (window, 0, now, nak_rdata_expiry, nak_rb_expiry), "confirm not bounds"); /* #1 at 100 */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (100); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (1 == pgm_rxw_length (window), "length failed"); fail_unless (PGM_RXW_BOUNDS == pgm_rxw_confirm (window, 99, now, nak_rdata_expiry, nak_rb_expiry), "confirm not bounds"); fail_unless (PGM_RXW_DUPLICATE == pgm_rxw_confirm (window, 100, now, nak_rdata_expiry, nak_rb_expiry), "confirm not duplicate"); fail_unless (PGM_RXW_APPENDED == pgm_rxw_confirm (window, 101, now, nak_rdata_expiry, nak_rb_expiry), "confirm not appended"); fail_unless (2 == pgm_rxw_length (window), "length failed"); fail_unless (PGM_RXW_UPDATED == pgm_rxw_confirm (window, 101, now, nak_rdata_expiry, nak_rb_expiry), "confirm not updated"); /* #2 at 101 */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (101); fail_unless (PGM_RXW_INSERTED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not inserted"); struct pgm_msgv_t msgv[2], *pmsg = msgv; fail_unless (2000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); pgm_rxw_destroy (window); } END_TEST /* constrained confirm */ START_TEST (test_confirm_pass_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; for (unsigned i = 0; i < 100; i++) { skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (MIN(100, 1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (pgm_rxw_is_full (window), "is_full failed"); fail_unless (_pgm_rxw_commit_is_empty (window), "is_empty failed"); /* read one skb */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless (1 == _pgm_rxw_commit_length (window), "commit_length failed"); } /* confirm next sequence */ const pgm_time_t now = 1; const pgm_time_t nak_rdata_expiry = 2; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_BOUNDS == pgm_rxw_confirm (window, 100, now, nak_rdata_expiry, nak_rb_expiry), "confirm not bounds"); /* read off 99 more skbs */ for (unsigned i = 0; i < 99; i++) { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless ((2 + i) == _pgm_rxw_commit_length (window), "commit_length failed"); } /* read end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST START_TEST (test_confirm_fail_001) { int retval = pgm_rxw_confirm (NULL, 0, 0, 0, 0); fail ("reached"); } END_TEST /* target: * void * pgm_rxw_lost ( * pgm_rxw_t* const window, * const uint32_t sequence * ) */ START_TEST (test_lost_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); const pgm_time_t now = 1; const pgm_time_t nak_rdata_expiry = 2; const pgm_time_t nak_rb_expiry = 2; /* #1 at 100 */ struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (100); fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); fail_unless (1 == pgm_rxw_length (window), "length failed"); fail_unless (1000 == pgm_rxw_size (window), "size failed"); fail_unless (PGM_RXW_APPENDED == pgm_rxw_confirm (window, 101, now, nak_rdata_expiry, nak_rb_expiry), "confirm not appended"); fail_unless (2 == pgm_rxw_length (window), "length failed"); fail_unless (1000 == pgm_rxw_size (window), "size failed"); pgm_rxw_lost (window, 101); fail_unless (2 == pgm_rxw_length (window), "length failed"); fail_unless (1000 == pgm_rxw_size (window), "size failed"); /* #2 at 101 */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (101); fail_unless (PGM_RXW_INSERTED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not inserted"); fail_unless (2 == pgm_rxw_length (window), "length failed"); fail_unless (2000 == pgm_rxw_size (window), "size failed"); pgm_rxw_destroy (window); } END_TEST START_TEST (test_lost_fail_001) { pgm_rxw_lost (NULL, 0); fail ("reached"); } END_TEST /* target: * void * pgm_rxw_state ( * pgm_rxw_t* const window, * struct pgm_sk_buff_t* skb, * int new_state * ) */ START_TEST (test_state_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); const pgm_time_t now = 1; const pgm_time_t nak_rdata_expiry = 2; const pgm_time_t nak_rb_expiry = 2; fail_unless (0 == pgm_rxw_update (window, 100, 99, now, nak_rb_expiry), "update failed"); fail_unless (PGM_RXW_APPENDED == pgm_rxw_confirm (window, 101, now, nak_rdata_expiry, nak_rb_expiry), "confirm not appended"); struct pgm_sk_buff_t* skb = pgm_rxw_peek (window, 101); pgm_rxw_state (window, skb, PGM_PKT_STATE_WAIT_NCF); pgm_rxw_state (window, skb, PGM_PKT_STATE_WAIT_DATA); pgm_rxw_destroy (window); } END_TEST START_TEST (test_state_fail_001) { struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); pgm_rxw_state (NULL, skb, PGM_PKT_STATE_BACK_OFF); fail ("reached"); } END_TEST START_TEST (test_state_fail_002) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); pgm_rxw_state (window, NULL, PGM_PKT_STATE_BACK_OFF); fail ("reached"); } END_TEST START_TEST (test_state_fail_003) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); pgm_rxw_state (window, skb, -1); fail ("reached"); } END_TEST /* pgm_peer_has_pending */ START_TEST (test_has_pending_pass_001) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); /* empty */ fail_unless (0 == window->has_event, "unexpected event"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (0); const pgm_time_t now = 1; const pgm_time_t nak_rdata_expiry = 2; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not appended"); /* 1 sequence */ fail_unless (1 == window->has_event, "no event"); window->has_event = 0; /* jump */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (2); fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not missing"); fail_unless (0 == window->has_event, "unexpected event"); /* loss */ pgm_rxw_lost (window, 1); fail_unless (1 == window->has_event, "no event"); window->has_event = 0; /* insert */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_data->data_sqn = g_htonl (1); fail_unless (PGM_RXW_INSERTED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add not inserted"); fail_unless (1 == window->has_event, "no event"); window->has_event = 0; /* confirm */ fail_unless (PGM_RXW_APPENDED == pgm_rxw_confirm (window, 3, now, nak_rdata_expiry, nak_rb_expiry), "confirm not appended"); fail_unless (0 == window->has_event, "unexpected event"); /* partial read */ struct pgm_msgv_t msgv[2], *pmsg = msgv; fail_unless (2000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless (0 == window->has_event, "unexpected event"); /* finish read */ pmsg = msgv; fail_unless (1000 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); fail_unless (0 == window->has_event, "unexpected event"); pgm_rxw_destroy (window); } END_TEST static Suite* make_basic_test_suite (void) { Suite* s; s = suite_create ("basic receive window API"); TCase* tc_create = tcase_create ("create"); suite_add_tcase (s, tc_create); tcase_add_test (tc_create, test_create_pass_001); tcase_add_test (tc_create, test_create_pass_002); tcase_add_test (tc_create, test_create_pass_003); tcase_add_test (tc_create, test_create_pass_004); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_create, test_create_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_create, test_create_fail_002, SIGABRT); tcase_add_test_raise_signal (tc_create, test_create_fail_003, SIGABRT); tcase_add_test_raise_signal (tc_create, test_create_fail_004, SIGABRT); #endif TCase* tc_destroy = tcase_create ("destroy"); suite_add_tcase (s, tc_destroy); tcase_add_test (tc_destroy, test_destroy_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_destroy, test_destroy_fail_001, SIGABRT); #endif TCase* tc_add = tcase_create ("add"); suite_add_tcase (s, tc_add); tcase_add_test (tc_add, test_add_pass_001); tcase_add_test (tc_add, test_add_pass_002); tcase_add_test (tc_add, test_add_pass_003); tcase_add_test (tc_add, test_add_pass_004); tcase_add_test (tc_add, test_add_pass_005); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_add, test_add_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_add, test_add_fail_002, SIGABRT); tcase_add_test_raise_signal (tc_add, test_add_fail_003, SIGABRT); #endif TCase* tc_peek = tcase_create ("peek"); suite_add_tcase (s, tc_peek); tcase_add_test (tc_peek, test_peek_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_peek, test_peek_fail_001, SIGABRT); #endif TCase* tc_max_length = tcase_create ("max-length"); suite_add_tcase (s, tc_max_length); tcase_add_test (tc_max_length, test_max_length_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_max_length, test_max_length_fail_001, SIGABRT); #endif TCase* tc_length = tcase_create ("length"); suite_add_tcase (s, tc_length); tcase_add_test (tc_length, test_length_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_length, test_length_fail_001, SIGABRT); #endif TCase* tc_size = tcase_create ("size"); suite_add_tcase (s, tc_size); tcase_add_test (tc_size, test_size_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_size, test_size_fail_001, SIGABRT); #endif TCase* tc_is_empty = tcase_create ("is-empty"); suite_add_tcase (s, tc_is_empty); tcase_add_test (tc_is_empty, test_is_empty_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_is_empty, test_is_empty_fail_001, SIGABRT); #endif TCase* tc_is_full = tcase_create ("is-full"); suite_add_tcase (s, tc_is_full); tcase_add_test (tc_is_full, test_is_full_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_is_full, test_is_full_fail_001, SIGABRT); #endif TCase* tc_lead = tcase_create ("lead"); suite_add_tcase (s, tc_lead); tcase_add_test (tc_lead, test_lead_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_lead, test_lead_fail_001, SIGABRT); #endif TCase* tc_next_lead = tcase_create ("next-lead"); suite_add_tcase (s, tc_next_lead); tcase_add_test (tc_next_lead, test_next_lead_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_next_lead, test_next_lead_fail_001, SIGABRT); #endif TCase* tc_readv = tcase_create ("readv"); suite_add_tcase (s, tc_readv); tcase_add_test (tc_readv, test_readv_pass_001); tcase_add_test (tc_readv, test_readv_pass_002); tcase_add_test (tc_readv, test_readv_pass_003); tcase_add_test (tc_readv, test_readv_pass_004); tcase_add_test (tc_readv, test_readv_pass_005); tcase_add_test (tc_readv, test_readv_pass_006); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_readv, test_readv_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_readv, test_readv_fail_002, SIGABRT); tcase_add_test_raise_signal (tc_readv, test_readv_fail_003, SIGABRT); #endif TCase* tc_remove_commit = tcase_create ("remove-commit"); suite_add_tcase (s, tc_remove_commit); tcase_add_test (tc_remove_commit, test_remove_commit_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_remove_commit, test_remove_commit_fail_001, SIGABRT); #endif TCase* tc_remove_trail = tcase_create ("remove-trail"); TCase* tc_update = tcase_create ("update"); suite_add_tcase (s, tc_update); tcase_add_test (tc_update, test_update_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_update, test_update_fail_001, SIGABRT); #endif TCase* tc_confirm = tcase_create ("confirm"); suite_add_tcase (s, tc_confirm); tcase_add_test (tc_confirm, test_confirm_pass_001); tcase_add_test (tc_confirm, test_confirm_pass_002); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_confirm, test_confirm_fail_001, SIGABRT); #endif TCase* tc_lost = tcase_create ("lost"); suite_add_tcase (s, tc_lost); tcase_add_test (tc_lost, test_lost_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_lost, test_lost_fail_001, SIGABRT); #endif TCase* tc_state = tcase_create ("state"); suite_add_tcase (s, tc_state); tcase_add_test (tc_state, test_state_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_state, test_state_fail_001, SIGABRT); #endif return s; } /* read through lost packet */ START_TEST (test_readv_pass_007) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; /* add #0 */ { unsigned i = 0; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } /* add # 2 */ { unsigned i = 2; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } /* lose #1 */ { pgm_rxw_lost (window, 1); } fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); /* read #0 */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } /* end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_remove_commit (window); /* read lost skb #1 */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_remove_commit (window); /* read #2 */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } /* end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST /* read through loss extended window */ START_TEST (test_readv_pass_008) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; /* add #0 */ { unsigned i = 0; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); /* read #0 */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_remove_commit (window); /* end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } /* add #100 */ { unsigned i = 100; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); } /* lose #1-99 */ { for (unsigned i = 1; i < 100; i++) pgm_rxw_lost (window, i); } /* read #100 */ { int i = 0; int bytes_read; pmsg = msgv; do { bytes_read = pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)); pgm_rxw_remove_commit (window); i++; if (i > 100) break; } while (-1 == bytes_read); fail_unless (100 == i, "readv failed"); } /* end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST /* read through long data-loss */ START_TEST (test_readv_pass_009) { pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const uint32_t ack_c_p = 500; pgm_rxw_t* window = pgm_rxw_create (&tsi, 1500, 100, 0, 0, ack_c_p); fail_if (NULL == window, "create failed"); struct pgm_msgv_t msgv[1], *pmsg; struct pgm_sk_buff_t* skb; /* add #0 */ { unsigned i = 0; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_APPENDED == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); fail_unless ((1 + i) == pgm_rxw_length (window), "length failed"); } fail_unless (_pgm_rxw_commit_is_empty (window), "commit_is_empty failed"); /* read #0 */ { pmsg = msgv; fail_unless (0 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_remove_commit (window); /* end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } /* add #2000 */ { unsigned i = 2000; skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); skb->pgm_header->pgm_tsdu_length = g_htons (0); skb->tail = (guint8*)skb->tail - skb->len; skb->len = 0; skb->pgm_data->data_sqn = g_htonl (i); const pgm_time_t now = 1; const pgm_time_t nak_rb_expiry = 2; fail_unless (PGM_RXW_MISSING == pgm_rxw_add (window, skb, now, nak_rb_expiry), "add failed"); } /* lose #1-1999 */ { for (unsigned i = 1901; i < 2000; i++) pgm_rxw_lost (window, i); } /* read #2000 */ { int i = 0; int bytes_read; pmsg = msgv; do { bytes_read = pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)); pgm_rxw_remove_commit (window); i++; if (i > 100) break; } while (-1 == bytes_read); fail_unless (100 == i, "readv failed"); } /* end-of-window */ { pmsg = msgv; fail_unless (-1 == pgm_rxw_readv (window, &pmsg, G_N_ELEMENTS(msgv)), "readv failed"); } pgm_rxw_destroy (window); } END_TEST /* a.k.a. unreliable delivery */ static Suite* make_best_effort_test_suite (void) { Suite* s; s = suite_create ("Best effort delivery"); TCase* tc_readv = tcase_create ("readv"); suite_add_tcase (s, tc_readv); tcase_add_test (tc_readv, test_readv_pass_007); tcase_add_test (tc_readv, test_readv_pass_008); tcase_add_test (tc_readv, test_readv_pass_009); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_basic_test_suite ()); srunner_add_suite (sr, make_best_effort_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/error_unittest.c0000644000175000017500000001612111640407354021000 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for error reporting. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include /* mock state */ /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } #define ERROR_DEBUG #include "error.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * void * pgm_set_error ( * pgm_error_t** err, * int err_domain, * int err_code, * const char* format, * ... * ) */ START_TEST (test_set_error_pass_001) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); } END_TEST START_TEST (test_set_error_pass_002) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred: value=%d.", 123); fail_unless (NULL != err, "set_error failed"); } END_TEST /* ignore NULL error */ START_TEST (test_set_error_pass_003) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (NULL, err_domain, err_code, "an error occurred."); } END_TEST /* overwritten error */ START_TEST (test_set_error_pass_004) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); pgm_set_error (&err, err_domain, err_code, "another error occurred."); } END_TEST /* target: * void * pgm_prefix_error ( * pgm_error_t** err, * const char* format, * ... * ) */ START_TEST (test_prefix_error_pass_001) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); pgm_prefix_error (&err, "i am a prefix:"); pgm_prefix_error (&err, "i am another prefix, value=%d:", 123); } END_TEST /* ignore null original error */ START_TEST (test_prefix_error_pass_002) { pgm_error_t* err = NULL; pgm_prefix_error (&err, "i am a prefix:"); } END_TEST /* target: * void * pgm_propagate_error ( * pgm_error_t** dest, * pgm_error_t* src, * ) */ START_TEST (test_propagate_error_pass_001) { pgm_error_t* dest = NULL; pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); pgm_propagate_error (&dest, err); fail_unless (NULL != dest, "propagate_error failed"); } END_TEST /* ignore NULL destination */ START_TEST (test_propagate_error_pass_002) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); pgm_propagate_error (NULL, err); } END_TEST /* src error SHOULD be valid */ START_TEST (test_propagate_error_pass_003) { pgm_error_t* dest = NULL; pgm_error_t* err = NULL; pgm_propagate_error (&dest, err); } END_TEST /* target: * void * pgm_clear_error ( * pgm_error_t** err * ) */ START_TEST (test_clear_error_pass_001) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); pgm_clear_error (&err); fail_unless (NULL == err, "clear_error failed"); } END_TEST START_TEST (test_clear_error_pass_002) { pgm_error_t* err = NULL; pgm_clear_error (&err); fail_unless (NULL == err, "clear_error failed"); } END_TEST START_TEST (test_clear_error_pass_003) { pgm_clear_error (NULL); } END_TEST /* target: * void * pgm_error_free ( * pgm_error_t* err * ) */ START_TEST (test_error_free_pass_001) { pgm_error_t* err = NULL; const gint err_domain = PGM_ERROR_DOMAIN_ENGINE; const gint err_code = 100; pgm_set_error (&err, err_domain, err_code, "an error occurred."); fail_unless (NULL != err, "set_error failed"); pgm_error_free (err); } END_TEST START_TEST (test_error_free_pass_002) { pgm_error_free (NULL); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_set_error = tcase_create ("set-error"); suite_add_tcase (s, tc_set_error); tcase_add_test (tc_set_error, test_set_error_pass_001); tcase_add_test (tc_set_error, test_set_error_pass_002); tcase_add_test (tc_set_error, test_set_error_pass_003); tcase_add_test (tc_set_error, test_set_error_pass_004); TCase* tc_prefix_error = tcase_create ("prefix-error"); suite_add_tcase (s, tc_prefix_error); tcase_add_test (tc_prefix_error, test_prefix_error_pass_001); tcase_add_test (tc_prefix_error, test_prefix_error_pass_002); TCase* tc_propagate_error = tcase_create ("propagate-error"); suite_add_tcase (s, tc_propagate_error); tcase_add_test (tc_propagate_error, test_propagate_error_pass_001); tcase_add_test (tc_propagate_error, test_propagate_error_pass_002); tcase_add_test (tc_propagate_error, test_propagate_error_pass_003); TCase* tc_clear_error = tcase_create ("clear-error"); suite_add_tcase (s, tc_clear_error); tcase_add_test (tc_clear_error, test_clear_error_pass_001); tcase_add_test (tc_clear_error, test_clear_error_pass_002); tcase_add_test (tc_clear_error, test_clear_error_pass_003); TCase* tc_error_free = tcase_create ("error-free"); suite_add_tcase (s, tc_error_free); tcase_add_test (tc_error_free, test_error_free_pass_001); tcase_add_test (tc_error_free, test_error_free_pass_002); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/fec-block.txt0000644000175000017500000000240211640407354020127 0ustar locallocalfrom rfc5052 ------------ step one: Input: B -- Maximum Source Block Length, i.e., the maximum number of source symbols per source block L -- Transfer Length in octets E -- Encoding Symbol Length in octets Output: T -- the number of source symbols in the object. N -- the number of source blocks into which the object shall be partitioned. Algorithm: 1. The number of source symbols in the transport object is computed as T = ceil[L/E]. 2. The transport object shall be partitioned into N = ceil[T/B] source blocks. B = maximum TPDU - IP header ( - UDP header ) - PGM header L = APDU length (pgm_transport_send length parameter). E = 1 (fixed). T = ceil( L / E ) = ceil( L / 1 ) = L N = ceil( T / B ) = ceil( L / B ) step two: Input: T -- the number of source symbols in the object. N -- the number of source blocks into which the object is partitioned. Output: I -- the number of larger source blocks. A_large -- the length of each of the larger source blocks in symbols. A_small -- the length of each of the smaller source blocks in symbols. Algorithm: 1. A_large = ceil[T/N] 2. A_small = floor[T/N] 3. I = T - A_small * N libpgm-5.1.118-1~dfsg/openpgm/pgm/source_unittest.c0000644000175000017500000010546611640407354021162 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM source transport. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #ifndef _WIN32 # include # include # include # include #else # include # include #endif #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ #define TEST_NETWORK "" #define TEST_PORT 7500 #define TEST_MAX_TPDU 1500 #define TEST_TXW_SQNS 32 #define TEST_RXW_SQNS 32 #define TEST_HOPS 16 #define TEST_SPM_AMBIENT ( pgm_secs(30) ) #define TEST_SPM_HEARTBEAT_INIT { pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(1300), pgm_secs(7), pgm_secs(16), pgm_secs(25), pgm_secs(30) } #define TEST_PEER_EXPIRY ( pgm_secs(300) ) #define TEST_SPMR_EXPIRY ( pgm_msecs(250) ) #define TEST_NAK_BO_IVL ( pgm_msecs(50) ) #define TEST_NAK_RPT_IVL ( pgm_secs(2) ) #define TEST_NAK_RDATA_IVL ( pgm_secs(2) ) #define TEST_NAK_DATA_RETRIES 5 #define TEST_NAK_NCF_RETRIES 2 static gboolean mock_is_valid_spmr = TRUE; static gboolean mock_is_valid_ack = TRUE; static gboolean mock_is_valid_nak = TRUE; static gboolean mock_is_valid_nnak = TRUE; #define pgm_txw_get_unfolded_checksum mock_pgm_txw_get_unfolded_checksum #define pgm_txw_set_unfolded_checksum mock_pgm_txw_set_unfolded_checksum #define pgm_txw_inc_retransmit_count mock_pgm_txw_inc_retransmit_count #define pgm_txw_add mock_pgm_txw_add #define pgm_txw_peek mock_pgm_txw_peek #define pgm_txw_retransmit_push mock_pgm_txw_retransmit_push #define pgm_txw_retransmit_try_peek mock_pgm_txw_retransmit_try_peek #define pgm_txw_retransmit_remove_head mock_pgm_txw_retransmit_remove_head #define pgm_rs_encode mock_pgm_rs_encode #define pgm_rate_check mock_pgm_rate_check #define pgm_verify_spmr mock_pgm_verify_spmr #define pgm_verify_ack mock_pgm_verify_ack #define pgm_verify_nak mock_pgm_verify_nak #define pgm_verify_nnak mock_pgm_verify_nnak #define pgm_compat_csum_partial mock_pgm_compat_csum_partial #define pgm_compat_csum_partial_copy mock_pgm_compat_csum_partial_copy #define pgm_csum_block_add mock_pgm_csum_block_add #define pgm_csum_fold mock_pgm_csum_fold #define pgm_sendto_hops mock_pgm_sendto_hops #define pgm_time_update_now mock_pgm_time_update_now #define pgm_setsockopt mock_pgm_setsockopt #define SOURCE_DEBUG #include "source.c" static void mock_setup (void) { if (!g_thread_supported ()) g_thread_init (NULL); } static struct pgm_sock_t* generate_sock (void) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, g_htons(1000) }; struct pgm_sock_t* sock = g_new0 (struct pgm_sock_t, 1); memcpy (&sock->tsi, &tsi, sizeof(pgm_tsi_t)); sock->is_bound = FALSE; sock->is_destroyed = FALSE; ((struct sockaddr*)&sock->send_addr)->sa_family = AF_INET; ((struct sockaddr_in*)&sock->send_addr)->sin_addr.s_addr = inet_addr ("127.0.0.2"); ((struct sockaddr*)&sock->send_gsr.gsr_group)->sa_family = AF_INET; ((struct sockaddr_in*)&sock->send_gsr.gsr_group)->sin_addr.s_addr = inet_addr ("239.192.0.1"); sock->dport = g_htons(TEST_PORT); sock->window = g_malloc0 (sizeof(pgm_txw_t)); sock->txw_sqns = TEST_TXW_SQNS; sock->max_tpdu = TEST_MAX_TPDU; sock->max_tsdu = TEST_MAX_TPDU - sizeof(struct pgm_ip) - pgm_pkt_offset (FALSE, FALSE); sock->max_tsdu_fragment = TEST_MAX_TPDU - sizeof(struct pgm_ip) - pgm_pkt_offset (TRUE, FALSE); sock->max_apdu = MIN(TEST_TXW_SQNS, PGM_MAX_FRAGMENTS) * sock->max_tsdu_fragment; sock->iphdr_len = sizeof(struct pgm_ip); sock->spm_heartbeat_interval = g_malloc0 (sizeof(guint) * (2+2)); sock->spm_heartbeat_interval[0] = pgm_secs(1); pgm_spinlock_init (&sock->txw_spinlock); pgm_mutex_init (&sock->source_mutex); pgm_mutex_init (&sock->timer_mutex); pgm_rwlock_init (&sock->lock); return sock; } static struct pgm_sk_buff_t* generate_skb (void) { const char source[] = "i am not a string"; struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_reserve (skb, pgm_pkt_offset (FALSE, FALSE)); pgm_skb_put (skb, sizeof(source)); memcpy (skb->data, source, sizeof(source)); return skb; } static struct pgm_sk_buff_t* generate_fragment_skb (void) { const char source[] = "i am not a string"; struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_reserve (skb, pgm_pkt_offset (TRUE, FALSE)); pgm_skb_put (skb, sizeof(source)); memcpy (skb->data, source, sizeof(source)); return skb; } static struct pgm_sk_buff_t* generate_odata (void) { const char source[] = "i am not a string"; const guint16 header_length = sizeof(struct pgm_header) + sizeof(struct pgm_data); struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_reserve (skb, header_length); memset (skb->head, 0, header_length); skb->pgm_header = (struct pgm_header*)skb->head; skb->pgm_data = (struct pgm_data*)(skb->pgm_header + 1); skb->pgm_header->pgm_type = PGM_ODATA; skb->pgm_header->pgm_tsdu_length = g_htons (sizeof(source)); memcpy (skb->data, source, sizeof(source)); pgm_skb_put (skb, sizeof(source)); /* reverse pull */ skb->len += (guint8*)skb->data - (guint8*)skb->head; skb->data = skb->head; return skb; } static pgm_peer_t* generate_peer (void) { pgm_peer_t* peer = g_malloc0 (sizeof(pgm_peer_t)); return peer; } static struct pgm_sk_buff_t* generate_spmr (void) { struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); const guint16 header_length = sizeof(struct pgm_header); pgm_skb_reserve (skb, header_length); memset (skb->head, 0, header_length); skb->pgm_header = (struct pgm_header*)skb->head; skb->pgm_header->pgm_type = PGM_SPMR; pgm_skb_put (skb, header_length); return skb; } static struct pgm_sk_buff_t* generate_single_nak (void) { struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); const guint16 header_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak); pgm_skb_reserve (skb, sizeof(struct pgm_header)); memset (skb->head, 0, header_length); skb->pgm_header = (struct pgm_header*)skb->head; skb->pgm_header->pgm_type = PGM_NAK; struct pgm_nak* nak = (struct pgm_nak*)(skb->pgm_header + 1); struct sockaddr_in nla = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr("127.0.0.2") }; pgm_sockaddr_to_nla ((struct sockaddr*)&nla, (char*)&nak->nak_src_nla_afi); struct sockaddr_in group = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr("239.192.0.1") }; pgm_sockaddr_to_nla ((struct sockaddr*)&group, (char*)&nak->nak_grp_nla_afi); pgm_skb_put (skb, header_length); return skb; } static struct pgm_sk_buff_t* generate_single_nnak (void) { struct pgm_sk_buff_t* skb = generate_single_nak (); skb->pgm_header->pgm_type = PGM_NNAK; return skb; } static struct pgm_sk_buff_t* generate_parity_nak (void) { struct pgm_sk_buff_t* skb = generate_single_nak (); skb->pgm_header->pgm_options = PGM_OPT_PARITY; return skb; } static struct pgm_sk_buff_t* generate_nak_list (void) { struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); const guint16 header_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak) + sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( 62 * sizeof(guint32) ); pgm_skb_reserve (skb, sizeof(struct pgm_header)); memset (skb->head, 0, header_length); skb->pgm_header = (struct pgm_header*)skb->head; skb->pgm_header->pgm_type = PGM_NAK; skb->pgm_header->pgm_options = PGM_OPT_PRESENT | PGM_OPT_NETWORK; struct pgm_nak *nak = (struct pgm_nak*)(skb->pgm_header + 1); struct sockaddr_in nla = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr("127.0.0.2") }; pgm_sockaddr_to_nla ((struct sockaddr*)&nla, (char*)&nak->nak_src_nla_afi); struct sockaddr_in group = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr("239.192.0.1") }; pgm_sockaddr_to_nla ((struct sockaddr*)&group, (char*)&nak->nak_grp_nla_afi); struct pgm_opt_length* opt_len = (struct pgm_opt_length*)(nak + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = g_htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( 62 * sizeof(guint32) ) ); struct pgm_opt_header* opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_NAK_LIST | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( 62 * sizeof(guint32) ); struct pgm_opt_nak_list* opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); for (unsigned i = 1; i < 63; i++) { opt_nak_list->opt_sqn[i-1] = g_htonl (i); } pgm_skb_put (skb, header_length); return skb; } static struct pgm_sk_buff_t* generate_parity_nak_list (void) { struct pgm_sk_buff_t* skb = generate_nak_list (); skb->pgm_header->pgm_options = PGM_OPT_PARITY | PGM_OPT_PRESENT | PGM_OPT_NETWORK; return skb; } void mock_pgm_txw_add ( pgm_txw_t* const window, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_txw_add (window:%p skb:%p)", (gpointer)window, (gpointer)skb); } struct pgm_sk_buff_t* mock_pgm_txw_peek ( const pgm_txw_t* const window, const uint32_t sequence ) { g_debug ("mock_pgm_txw_peek (window:%p sequence:%" G_GUINT32_FORMAT ")", (gpointer)window, sequence); return NULL; } bool mock_pgm_txw_retransmit_push ( pgm_txw_t* const window, const uint32_t sequence, const bool is_parity, const uint8_t tg_sqn_shift ) { g_debug ("mock_pgm_txw_retransmit_push (window:%p sequence:%" G_GUINT32_FORMAT " is-parity:%s tg-sqn-shift:%d)", (gpointer)window, sequence, is_parity ? "YES" : "NO", tg_sqn_shift); return TRUE; } void mock_pgm_txw_set_unfolded_checksum ( struct pgm_sk_buff_t*const skb, const uint32_t csum ) { } uint32_t pgm_txw_get_unfolded_checksum ( const struct pgm_sk_buff_t*const skb ) { return 0; } void mock_pgm_txw_inc_retransmit_count ( struct pgm_sk_buff_t*const skb ) { } struct pgm_sk_buff_t* mock_pgm_txw_retransmit_try_peek ( pgm_txw_t* const window ) { g_debug ("mock_pgm_txw_retransmit_try_peek (window:%p)", (gpointer)window); return generate_odata (); } void mock_pgm_txw_retransmit_remove_head ( pgm_txw_t* const window ) { g_debug ("mock_pgm_txw_retransmit_remove_head (window:%p)", (gpointer)window); } void mock_pgm_rs_encode ( pgm_rs_t* rs, const pgm_gf8_t** src, uint8_t offset, pgm_gf8_t* dst, uint16_t len ) { g_debug ("mock_pgm_rs_encode (rs:%p src:%p offset:%u dst:%p len:%u)", rs, src, offset, dst, len); } PGM_GNUC_INTERNAL bool mock_pgm_rate_check ( pgm_rate_t* bucket, const size_t data_size, const bool is_nonblocking ) { g_debug ("mock_pgm_rate_check (bucket:%p data-size:%u is-nonblocking:%s)", bucket, (unsigned)data_size, is_nonblocking ? "TRUE" : "FALSE"); return TRUE; } bool mock_pgm_verify_spmr ( const struct pgm_sk_buff_t* const skb ) { return mock_is_valid_spmr; } bool mock_pgm_verify_ack ( const struct pgm_sk_buff_t* const skb ) { return mock_is_valid_ack; } bool mock_pgm_verify_nak ( const struct pgm_sk_buff_t* const skb ) { return mock_is_valid_nak; } bool mock_pgm_verify_nnak ( const struct pgm_sk_buff_t* const skb ) { return mock_is_valid_nnak; } uint32_t mock_pgm_compat_csum_partial ( const void* addr, uint16_t len, uint32_t csum ) { return 0x0; } uint32_t mock_pgm_compat_csum_partial_copy ( const void* src, void* dst, uint16_t len, uint32_t csum ) { return 0x0; } uint32_t mock_pgm_csum_block_add ( uint32_t csum, uint32_t csum2, uint16_t offset ) { return 0x0; } uint16_t mock_pgm_csum_fold ( uint32_t csum ) { return 0x0; } PGM_GNUC_INTERNAL ssize_t mock_pgm_sendto_hops ( pgm_sock_t* sock, bool use_rate_limit, pgm_rate_t* minor_rate_control, bool use_router_alert, int level, const void* buf, size_t len, const struct sockaddr* to, socklen_t tolen ) { char saddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop (to, saddr, sizeof(saddr)); g_debug ("mock_pgm_sendto (sock:%p use-rate-limit:%s minor-rate-control:%p use-router-alert:%s level:%d buf:%p len:%u to:%s tolen:%d)", (gpointer)sock, use_rate_limit ? "YES" : "NO", (gpointer)minor_rate_control, use_router_alert ? "YES" : "NO", level, buf, (unsigned)len, saddr, tolen); return len; } /** time module */ static pgm_time_t _mock_pgm_time_update_now (void); pgm_time_update_func mock_pgm_time_update_now = _mock_pgm_time_update_now; static pgm_time_t _mock_pgm_time_update_now (void) { return 0x1; } /** socket module */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return can_fragment ? ( sizeof(struct pgm_header) + sizeof(struct pgm_data) + sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment) ) : ( sizeof(struct pgm_header) + sizeof(struct pgm_data) ); } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } bool mock_pgm_setsockopt ( pgm_sock_t* const sock, const int level, const int optname, const void* optval, const socklen_t optlen ) { if (NULL == sock) return FALSE; return TRUE; } /* mock functions for external references */ /* target: * PGMIOStatus * pgm_send ( * pgm_sock_t* sock, * gconstpointer apdu, * gsize apdu_length, * gsize* bytes_written * ) */ START_TEST (test_send_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; const gsize apdu_length = 100; guint8 buffer[ apdu_length ]; gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_send (sock, buffer, apdu_length, &bytes_written), "send not normal"); fail_unless ((gssize)apdu_length == bytes_written, "send underrun"); } END_TEST /* large apdu */ START_TEST (test_send_pass_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; const gsize apdu_length = 16000; guint8 buffer[ apdu_length ]; gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_send (sock, buffer, apdu_length, &bytes_written), "send not normal"); fail_unless ((gssize)apdu_length == bytes_written, "send underrun"); } END_TEST START_TEST (test_send_fail_001) { guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; const gsize apdu_length = 100; gsize bytes_written; fail_unless (PGM_IO_STATUS_ERROR == pgm_send (NULL, buffer, apdu_length, &bytes_written), "send not error"); } END_TEST /* target: * PGMIOStatus * pgm_sendv ( * pgm_sock_t* sock, * const struct pgmiovec* vector, * guint count, * gboolean is_one_apdu, * gsize* bytes_written * ) */ START_TEST (test_sendv_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; const gsize apdu_length = 100; guint8 buffer[ apdu_length ]; struct pgm_iovec vector[] = { { .iov_base = buffer, .iov_len = apdu_length } }; gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_sendv (sock, vector, 1, TRUE, &bytes_written), "send not normal"); fail_unless ((gssize)apdu_length == bytes_written, "send underrun"); } END_TEST /* large apdu */ START_TEST (test_sendv_pass_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; const gsize apdu_length = 16000; guint8 buffer[ apdu_length ]; struct pgm_iovec vector[] = { { .iov_base = buffer, .iov_len = apdu_length } }; gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_sendv (sock, vector, 1, TRUE, &bytes_written), "send not normal"); fail_unless ((gssize)apdu_length == bytes_written, "send underrun"); } END_TEST /* multipart apdu */ START_TEST (test_sendv_pass_003) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; const gsize apdu_length = 16000; guint8 buffer[ apdu_length ]; struct pgm_iovec vector[ 16 ]; for (unsigned i = 0; i < G_N_ELEMENTS(vector); i++) { vector[i].iov_base = &buffer[ (i * apdu_length) / G_N_ELEMENTS(vector) ]; vector[i].iov_len = apdu_length / G_N_ELEMENTS(vector); } gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_sendv (sock, vector, G_N_ELEMENTS(vector), TRUE, &bytes_written), "send not normal"); fail_unless ((gssize)apdu_length == bytes_written, "send underrun"); } END_TEST /* multiple apdus */ START_TEST (test_sendv_pass_004) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; const gsize apdu_length = 16000; struct pgm_iovec vector[ 16 ]; for (unsigned i = 0; i < G_N_ELEMENTS(vector); i++) { vector[i].iov_base = g_malloc0 (apdu_length); vector[i].iov_len = apdu_length; } gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_sendv (sock, vector, G_N_ELEMENTS(vector), FALSE, &bytes_written), "send not normal"); fail_unless ((gssize)(apdu_length * G_N_ELEMENTS(vector)) == bytes_written, "send underrun"); } END_TEST START_TEST (test_sendv_fail_001) { guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; const gsize tsdu_length = 100; struct pgm_iovec vector[] = { { .iov_base = buffer, .iov_len = tsdu_length } }; gsize bytes_written; fail_unless (PGM_IO_STATUS_ERROR == pgm_sendv (NULL, vector, 1, TRUE, &bytes_written), "send not error"); } END_TEST /* target: * PGMIOStatus * pgm_send_skbv ( * pgm_sock_t* sock, * struct pgm_sk_buff_t* vector[], * guint count, * gboolean is_one_apdu, * gsize* bytes_written * ) */ START_TEST (test_send_skbv_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; struct pgm_sk_buff_t* skb = NULL; skb = generate_skb (); fail_if (NULL == skb, "generate_skb failed"); gsize apdu_length = (gsize)skb->len; gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_send_skbv (sock, &skb, 1, TRUE, &bytes_written), "send not normal"); fail_unless (apdu_length == bytes_written, "send underrun"); } END_TEST /* multipart apdu */ START_TEST (test_send_skbv_pass_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; struct pgm_sk_buff_t* skb[16]; for (unsigned i = 0; i < G_N_ELEMENTS(skb); i++) { skb[i] = generate_fragment_skb (); fail_if (NULL == skb[i], "generate_fragment_skb failed"); } gsize apdu_length = (gsize)skb[0]->len * G_N_ELEMENTS(skb); gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_send_skbv (sock, skb, G_N_ELEMENTS(skb), TRUE, &bytes_written), "send not normal"); fail_unless (apdu_length == bytes_written, "send underrun"); } END_TEST /* multiple apdus */ START_TEST (test_send_skbv_pass_003) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->is_bound = TRUE; struct pgm_sk_buff_t* skb[16]; for (unsigned i = 0; i < G_N_ELEMENTS(skb); i++) { skb[i] = generate_skb (); fail_if (NULL == skb[i], "generate_skb failed"); } gsize bytes_written; fail_unless (PGM_IO_STATUS_NORMAL == pgm_send_skbv (sock, skb, G_N_ELEMENTS(skb), FALSE, &bytes_written), "send not normal"); fail_unless ((gssize)(skb[0]->len * G_N_ELEMENTS(skb)) == bytes_written, "send underrun"); } END_TEST START_TEST (test_send_skbv_fail_001) { struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU), *skbv[] = { skb }; fail_if (NULL == skb, "alloc_skb failed"); /* reserve PGM header */ pgm_skb_put (skb, pgm_pkt_offset (TRUE, FALSE)); const gsize tsdu_length = 100; gsize bytes_written; fail_unless (PGM_IO_STATUS_ERROR == pgm_send_skbv (NULL, skbv, 1, TRUE, &bytes_written), "send not error"); } END_TEST /* target: * gboolean * pgm_send_spm ( * pgm_sock_t* sock, * int flags * ) */ START_TEST (test_send_spm_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); fail_unless (TRUE == pgm_send_spm (sock, 0), "send_spm failed"); } END_TEST START_TEST (test_send_spm_fail_001) { pgm_send_spm (NULL, 0); fail ("reached"); } END_TEST /* target: * void * pgm_on_deferred_nak ( * pgm_sock_t* sock * ) */ START_TEST (test_on_deferred_nak_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); pgm_on_deferred_nak (sock); } END_TEST START_TEST (test_on_deferred_nak_fail_001) { pgm_on_deferred_nak (NULL); fail ("reached"); } END_TEST /* target: * gboolean * pgm_on_spmr ( * pgm_sock_t* sock, * pgm_peer_t* peer, * struct pgm_sk_buff_t* skb * ) */ /* peer spmr */ START_TEST (test_on_spmr_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); pgm_peer_t* peer = generate_peer (); fail_if (NULL == peer, "generate_peer failed"); struct pgm_sk_buff_t* skb = generate_spmr (); fail_if (NULL == skb, "generate_spmr failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_spmr (sock, peer, skb), "on_spmr failed"); } END_TEST /* source spmr */ START_TEST (test_on_spmr_pass_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); struct pgm_sk_buff_t* skb = generate_spmr (); fail_if (NULL == skb, "generate_spmr failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_spmr (sock, NULL, skb), "on_spmr failed"); } END_TEST /* invalid spmr */ START_TEST (test_on_spmr_fail_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); pgm_peer_t* peer = generate_peer (); fail_if (NULL == peer, "generate_peer failed"); struct pgm_sk_buff_t* skb = generate_spmr (); fail_if (NULL == skb, "generate_spmr failed"); skb->sock = sock; mock_is_valid_spmr = FALSE; fail_unless (FALSE == pgm_on_spmr (sock, peer, skb), "on_spmr failed"); } END_TEST START_TEST (test_on_spmr_fail_002) { pgm_on_spmr (NULL, NULL, NULL); fail ("reached"); } END_TEST /* target: * gboolean * pgm_on_nak ( * pgm_sock_t* sock, * struct pgm_sk_buff_t* skb * ) */ /* single nak */ START_TEST (test_on_nak_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); struct pgm_sk_buff_t* skb = generate_single_nak (); fail_if (NULL == skb, "generate_single_nak failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_nak (sock, skb), "on_nak failed"); } END_TEST /* nak list */ START_TEST (test_on_nak_pass_002) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); struct pgm_sk_buff_t* skb = generate_nak_list (); fail_if (NULL == skb, "generate_nak_list failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_nak (sock, skb), "on_nak failed"); } END_TEST /* single parity nak */ START_TEST (test_on_nak_pass_003) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->use_ondemand_parity = TRUE; struct pgm_sk_buff_t* skb = generate_parity_nak (); fail_if (NULL == skb, "generate_parity_nak failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_nak (sock, skb), "on_nak failed"); } END_TEST /* parity nak list */ START_TEST (test_on_nak_pass_004) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); sock->use_ondemand_parity = TRUE; struct pgm_sk_buff_t* skb = generate_parity_nak_list (); fail_if (NULL == skb, "generate_parity_nak_list failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_nak (sock, skb), "on_nak failed"); } END_TEST START_TEST (test_on_nak_fail_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); struct pgm_sk_buff_t* skb = generate_single_nak (); fail_if (NULL == skb, "generate_single_nak failed"); skb->sock = sock; mock_is_valid_nak = FALSE; fail_unless (FALSE == pgm_on_nak (sock, skb), "on_nak failed"); } END_TEST START_TEST (test_on_nak_fail_002) { pgm_on_nak (NULL, NULL); fail ("reached"); } END_TEST /* target: * gboolean * pgm_on_nnak ( * pgm_sock_t* sock, * struct pgm_sk_buff_t* skb * ) */ START_TEST (test_on_nnak_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); struct pgm_sk_buff_t* skb = generate_single_nnak (); fail_if (NULL == skb, "generate_single_nnak failed"); skb->sock = sock; fail_unless (TRUE == pgm_on_nnak (sock, skb), "on_nnak failed"); } END_TEST START_TEST (test_on_nnak_fail_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); struct pgm_sk_buff_t* skb = generate_single_nnak (); fail_if (NULL == skb, "generate_single_nnak failed"); skb->sock = sock; mock_is_valid_nnak = FALSE; fail_unless (FALSE == pgm_on_nnak (sock, skb), "on_nnak failed"); } END_TEST START_TEST (test_on_nnak_fail_002) { pgm_on_nnak (NULL, NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_AMBIENT_SPM, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_ambient_spm_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_AMBIENT_SPM; const int ambient_spm = pgm_msecs(1000); const void* optval = &ambient_spm; const socklen_t optlen = sizeof(ambient_spm); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_ambient_spm failed"); } END_TEST START_TEST (test_set_ambient_spm_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_AMBIENT_SPM; const int ambient_spm = pgm_msecs(1000); const void* optval = &ambient_spm; const socklen_t optlen = sizeof(ambient_spm); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_ambient_spm failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_HEARTBEAT_SPM, * const void* optval, * const socklen_t optlen = sizeof(int) * n * ) */ START_TEST (test_set_heartbeat_spm_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_HEARTBEAT_SPM; const int intervals[] = { 1, 2, 3, 4, 5 }; const void* optval = &intervals; const socklen_t optlen = sizeof(intervals); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_heartbeat_spm failed"); } END_TEST START_TEST (test_set_heartbeat_spm_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_HEARTBEAT_SPM; const int intervals[] = { 1, 2, 3, 4, 5 }; const void* optval = &intervals; const socklen_t optlen = sizeof(intervals); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_heartbeat_spm failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_TXW_SQNS, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_txw_sqns_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_TXW_SQNS; const int txw_sqns = 100; const void* optval = &txw_sqns; const socklen_t optlen = sizeof(txw_sqns); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_txw_sqns failed"); } END_TEST START_TEST (test_set_txw_sqns_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_TXW_SQNS; const int txw_sqns = 100; const void* optval = &txw_sqns; const socklen_t optlen = sizeof(txw_sqns); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_txw_sqns failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_TXW_SECS, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_txw_secs_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_TXW_SECS; const int txw_secs = pgm_secs(10); const void* optval = &txw_secs; const socklen_t optlen = sizeof(txw_secs); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_txw_secs failed"); } END_TEST START_TEST (test_set_txw_secs_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_TXW_SECS; const int txw_secs = pgm_secs(10); const void* optval = &txw_secs; const socklen_t optlen = sizeof(txw_secs); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_txw_secs failed"); } END_TEST /* target: * bool * pgm_setsockopt ( * pgm_sock_t* const sock, * const int level = IPPROTO_PGM, * const int optname = PGM_TXW_MAX_RTE, * const void* optval, * const socklen_t optlen = sizeof(int) * ) */ START_TEST (test_set_txw_max_rte_pass_001) { pgm_sock_t* sock = generate_sock (); fail_if (NULL == sock, "generate_sock failed"); const int level = IPPROTO_PGM; const int optname = PGM_TXW_MAX_RTE; const int txw_max_rte = 100*1000; const void* optval = &txw_max_rte; const socklen_t optlen = sizeof(txw_max_rte); fail_unless (TRUE == pgm_setsockopt (sock, level, optname, optval, optlen), "set_txw_max_rte failed"); } END_TEST START_TEST (test_set_txw_max_rte_fail_001) { const int level = IPPROTO_PGM; const int optname = PGM_TXW_MAX_RTE; const int txw_max_rte = 100*1000; const void* optval = &txw_max_rte; const socklen_t optlen = sizeof(txw_max_rte); fail_unless (FALSE == pgm_setsockopt (NULL, level, optname, optval, optlen), "set_txw_max_rte failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_send = tcase_create ("send"); suite_add_tcase (s, tc_send); tcase_add_checked_fixture (tc_send, mock_setup, NULL); tcase_add_test (tc_send, test_send_pass_001); tcase_add_test (tc_send, test_send_pass_002); tcase_add_test (tc_send, test_send_fail_001); TCase* tc_sendv = tcase_create ("sendv"); suite_add_tcase (s, tc_sendv); tcase_add_checked_fixture (tc_sendv, mock_setup, NULL); tcase_add_test (tc_sendv, test_sendv_pass_001); tcase_add_test (tc_sendv, test_sendv_pass_002); tcase_add_test (tc_sendv, test_sendv_pass_003); tcase_add_test (tc_sendv, test_sendv_pass_004); tcase_add_test (tc_sendv, test_sendv_fail_001); TCase* tc_send_skbv = tcase_create ("send-skbv"); suite_add_tcase (s, tc_send_skbv); tcase_add_checked_fixture (tc_send_skbv, mock_setup, NULL); tcase_add_test (tc_send_skbv, test_send_skbv_pass_001); tcase_add_test (tc_send_skbv, test_send_skbv_pass_002); tcase_add_test (tc_send_skbv, test_send_skbv_fail_001); TCase* tc_send_spm = tcase_create ("send-spm"); suite_add_tcase (s, tc_send_spm); tcase_add_checked_fixture (tc_send_spm, mock_setup, NULL); tcase_add_test (tc_send_spm, test_send_spm_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_send_spm, test_send_spm_fail_001, SIGABRT); #endif TCase* tc_on_deferred_nak = tcase_create ("on-deferred-nak"); suite_add_tcase (s, tc_on_deferred_nak); tcase_add_checked_fixture (tc_on_deferred_nak, mock_setup, NULL); tcase_add_test (tc_on_deferred_nak, test_on_deferred_nak_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_on_deferred_nak, test_on_deferred_nak_fail_001, SIGABRT); #endif TCase* tc_on_spmr = tcase_create ("on-spmr"); suite_add_tcase (s, tc_on_spmr); tcase_add_checked_fixture (tc_on_spmr, mock_setup, NULL); tcase_add_test (tc_on_spmr, test_on_spmr_pass_001); tcase_add_test (tc_on_spmr, test_on_spmr_pass_002); tcase_add_test (tc_on_spmr, test_on_spmr_fail_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_on_spmr, test_on_spmr_fail_002, SIGABRT); #endif TCase* tc_on_nak = tcase_create ("on-nak"); suite_add_tcase (s, tc_on_nak); tcase_add_checked_fixture (tc_on_nak, mock_setup, NULL); tcase_add_test (tc_on_nak, test_on_nak_pass_001); tcase_add_test (tc_on_nak, test_on_nak_pass_002); tcase_add_test (tc_on_nak, test_on_nak_pass_003); tcase_add_test (tc_on_nak, test_on_nak_pass_004); tcase_add_test (tc_on_nak, test_on_nak_fail_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_on_nak, test_on_nak_fail_002, SIGABRT); #endif TCase* tc_on_nnak = tcase_create ("on-nnak"); suite_add_tcase (s, tc_on_nnak); tcase_add_checked_fixture (tc_on_nnak, mock_setup, NULL); tcase_add_test (tc_on_nnak, test_on_nnak_pass_001); tcase_add_test (tc_on_nnak, test_on_nnak_fail_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_on_nnak, test_on_nnak_fail_002, SIGABRT); #endif TCase* tc_set_ambient_spm = tcase_create ("set-ambient-spm"); suite_add_tcase (s, tc_set_ambient_spm); tcase_add_checked_fixture (tc_set_ambient_spm, mock_setup, NULL); tcase_add_test (tc_set_ambient_spm, test_set_ambient_spm_pass_001); tcase_add_test (tc_set_ambient_spm, test_set_ambient_spm_fail_001); TCase* tc_set_heartbeat_spm = tcase_create ("set-heartbeat-spm"); suite_add_tcase (s, tc_set_heartbeat_spm); tcase_add_checked_fixture (tc_set_heartbeat_spm, mock_setup, NULL); tcase_add_test (tc_set_heartbeat_spm, test_set_heartbeat_spm_pass_001); tcase_add_test (tc_set_heartbeat_spm, test_set_heartbeat_spm_fail_001); TCase* tc_set_txw_sqns = tcase_create ("set-txw-sqns"); suite_add_tcase (s, tc_set_txw_sqns); tcase_add_checked_fixture (tc_set_txw_sqns, mock_setup, NULL); tcase_add_test (tc_set_txw_sqns, test_set_txw_sqns_pass_001); tcase_add_test (tc_set_txw_sqns, test_set_txw_sqns_fail_001); TCase* tc_set_txw_secs = tcase_create ("set-txw-secs"); suite_add_tcase (s, tc_set_txw_secs); tcase_add_checked_fixture (tc_set_txw_secs, mock_setup, NULL); tcase_add_test (tc_set_txw_secs, test_set_txw_secs_pass_001); tcase_add_test (tc_set_txw_secs, test_set_txw_secs_fail_001); TCase* tc_set_txw_max_rte = tcase_create ("set-txw-max-rte"); suite_add_tcase (s, tc_set_txw_max_rte); tcase_add_checked_fixture (tc_set_txw_max_rte, mock_setup, NULL); tcase_add_test (tc_set_txw_max_rte, test_set_txw_max_rte_pass_001); tcase_add_test (tc_set_txw_max_rte, test_set_txw_max_rte_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/autom4te.cache/0000755000175000017500000000000011644640132020344 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/autom4te.cache/output.10000644000175000017500000162162511644640132022003 0ustar locallocal@%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. @%:@ Generated by GNU Autoconf 2.68 for OpenPGM 5.1.118. @%:@ @%:@ Report bugs to . @%:@ @%:@ @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @%:@ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software @%:@ Foundation, Inc. @%:@ @%:@ @%:@ This configure script is free software; the Free Software Foundation @%:@ gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in @%:@( *posix*) : set -o posix ;; @%:@( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in @%:@( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in @%:@(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in @%:@( *posix*) : set -o posix ;; @%:@( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in @%:@( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in @%:@ (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: openpgm-dev@googlegroups.com about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## @%:@ as_fn_unset VAR @%:@ --------------- @%:@ Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset @%:@ as_fn_set_status STATUS @%:@ ----------------------- @%:@ Set @S|@? to STATUS, without forking. as_fn_set_status () { return $1 } @%:@ as_fn_set_status @%:@ as_fn_exit STATUS @%:@ ----------------- @%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } @%:@ as_fn_exit @%:@ as_fn_mkdir_p @%:@ ------------- @%:@ Create "@S|@as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } @%:@ as_fn_mkdir_p @%:@ as_fn_append VAR VALUE @%:@ ---------------------- @%:@ Append the text in VALUE to the end of the definition contained in VAR. Take @%:@ advantage of any shell optimizations that allow amortized linear growth over @%:@ repeated appends, instead of the typical quadratic growth present in naive @%:@ implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append @%:@ as_fn_arith ARG... @%:@ ------------------ @%:@ Perform arithmetic evaluation on the ARGs, and store the result in the @%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments @%:@ must be portable across @S|@(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith @%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] @%:@ ---------------------------------------- @%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are @%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the @%:@ script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } @%:@ as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in @%:@((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in @%:@( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in @%:@(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIB@&t@OBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenPGM' PACKAGE_TARNAME='openpgm' PACKAGE_VERSION='5.1.118' PACKAGE_STRING='OpenPGM 5.1.118' PACKAGE_BUGREPORT='openpgm-dev@googlegroups.com' PACKAGE_URL='http://code.google.com/p/openpgm/' ac_unique_file="reed_solomon.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIB@&t@OBJS ALLOCA LIBTOOL_DEPS PYTHON PERL CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC VERSION_MICRO VERSION_MINOR VERSION_MAJOR VERSION_INFO RELEASE_INFO AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures OpenPGM 5.1.118 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @<:@@S|@ac_default_prefix@:>@ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX @<:@PREFIX@:>@ By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root @<:@DATAROOTDIR/doc/openpgm@:>@ --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of OpenPGM 5.1.118:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared@<:@=PKGS@:>@ build shared libraries @<:@default=yes@:>@ --enable-static@<:@=PKGS@:>@ build static libraries @<:@default=yes@:>@ --enable-fast-install@<:@=PKGS@:>@ optimize for fast installation @<:@default=yes@:>@ --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic try to use only PIC/non-PIC objects @<:@default=use both@:>@ --with-gnu-ld assume the C compiler uses GNU ld @<:@default=no@:>@ --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . OpenPGM home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF OpenPGM configure 5.1.118 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## @%:@ ac_fn_c_try_compile LINENO @%:@ -------------------------- @%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_compile @%:@ ac_fn_c_try_link LINENO @%:@ ----------------------- @%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_link @%:@ ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES @%:@ ------------------------------------------------------- @%:@ Tests whether HEADER exists and can be compiled using the include files in @%:@ INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @%:@include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_header_compile @%:@ ac_fn_c_try_cpp LINENO @%:@ ---------------------- @%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_cpp @%:@ ac_fn_c_try_run LINENO @%:@ ---------------------- @%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes @%:@ that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_run @%:@ ac_fn_c_check_func LINENO FUNC VAR @%:@ ---------------------------------- @%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* 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 $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_func @%:@ ac_fn_c_check_type LINENO TYPE VAR INCLUDES @%:@ ------------------------------------------- @%:@ Tests whether TYPE exists after having included INCLUDES, setting cache @%:@ variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_type @%:@ ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES @%:@ ------------------------------------------------------- @%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using @%:@ the include files in INCLUDES and setting the cache variable VAR @%:@ accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @%:@include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------------- ## ## Report this to openpgm-dev@googlegroups.com ## ## ------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_header_mongrel @%:@ ac_fn_c_find_intX_t LINENO BITS VAR @%:@ ----------------------------------- @%:@ Finds a signed integer type with width BITS, setting cache variable VAR @%:@ accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array @<:@1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))@:>@; test_array @<:@0@:>@ = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array @<:@1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))@:>@; test_array @<:@0@:>@ = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in @%:@( int$2_t) : eval "$3=yes" ;; @%:@( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_find_intX_t @%:@ ac_fn_c_find_uintX_t LINENO BITS VAR @%:@ ------------------------------------ @%:@ Finds an unsigned integer type with width BITS, setting cache variable VAR @%:@ accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array @<:@1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)@:>@; test_array @<:@0@:>@ = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in @%:@( uint$2_t) : eval "$3=yes" ;; @%:@( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_find_uintX_t @%:@ ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES @%:@ --------------------------------------------- @%:@ Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR @%:@ accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { @%:@ifndef $as_decl_name @%:@ifdef __cplusplus (void) $as_decl_use; @%:@else (void) $as_decl_name; @%:@endif @%:@endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_decl @%:@ ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES @%:@ ---------------------------------------------------- @%:@ Tries to find if the field MEMBER exists in type AGGR, after including @%:@ INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenPGM $as_me 5.1.118, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in @%:@(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Ubuntu 10 : v1.11 # OSX 10.6 : v1.10 # Solaris 10 : v1.8 am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in @%:@(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='openpgm' VERSION='5.1.118' # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' @%:@ Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac AM_BACKSLASH='\' RELEASE_INFO=5.1 VERSION_INFO=0:118 VERSION_MAJOR=5 VERSION_MINOR=1 VERSION_MICRO=118 # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $@%:@ != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf @%:@ Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4' macro_revision='1.3293' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep @%:@ Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } @%:@ Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } @%:@ Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "@%:@define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$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_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no @%:@ Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi @%:@ Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi @%:@ Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default @%:@ Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF @%:@define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' lt_prog_compiler_pic='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic@&t@ -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic@&t@ -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # nb: earliest verifiable version is 2.2. # Apply system specific rules. CFLAGS="$CFLAGS -D_REENTRANT" case "$host_os" in linux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE" ;; solaris*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} 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 socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket; 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_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostname" >&5 $as_echo_n "checking for library containing gethostname... " >&6; } if ${ac_cv_search_gethostname+:} 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 gethostname (); int main () { return gethostname (); ; return 0; } _ACEOF for ac_lib in '' nsl; 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_gethostname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostname+:} false; then : break fi done if ${ac_cv_search_gethostname+:} false; then : else ac_cv_search_gethostname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostname" >&5 $as_echo "$ac_cv_search_gethostname" >&6; } ac_res=$ac_cv_search_gethostname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_aton" >&5 $as_echo_n "checking for library containing inet_aton... " >&6; } if ${ac_cv_search_inet_aton+:} 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 inet_aton (); int main () { return inet_aton (); ; return 0; } _ACEOF for ac_lib in '' resolv; 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_inet_aton=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_inet_aton+:} false; then : break fi done if ${ac_cv_search_inet_aton+:} false; then : else ac_cv_search_inet_aton=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_aton" >&5 $as_echo "$ac_cv_search_inet_aton" >&6; } ac_res=$ac_cv_search_inet_aton if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing kstat_open" >&5 $as_echo_n "checking for library containing kstat_open... " >&6; } if ${ac_cv_search_kstat_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 kstat_open (); int main () { return kstat_open (); ; return 0; } _ACEOF for ac_lib in '' kstat; 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_kstat_open=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_kstat_open+:} false; then : break fi done if ${ac_cv_search_kstat_open+:} false; then : else ac_cv_search_kstat_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_kstat_open" >&5 $as_echo "$ac_cv_search_kstat_open" >&6; } ac_res=$ac_cv_search_kstat_open if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ;; *) ;; esac # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} 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 sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; 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_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_mutex_trylock" >&5 $as_echo_n "checking for library containing pthread_mutex_trylock... " >&6; } if ${ac_cv_search_pthread_mutex_trylock+:} 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 pthread_mutex_trylock (); int main () { return pthread_mutex_trylock (); ; return 0; } _ACEOF for ac_lib in '' pthread; 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_pthread_mutex_trylock=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pthread_mutex_trylock+:} false; then : break fi done if ${ac_cv_search_pthread_mutex_trylock+:} false; then : else ac_cv_search_pthread_mutex_trylock=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_mutex_trylock" >&5 $as_echo "$ac_cv_search_pthread_mutex_trylock" >&6; } ac_res=$ac_cv_search_pthread_mutex_trylock if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} 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 clock_gettime (); int main () { return clock_gettime (); ; 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_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_clock_gettime+:} false; then : break fi done if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Checks for header files. ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "@%:@define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "@%:@define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "@%:@define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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 CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 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: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF @%:@define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_header in arpa/inet.h fcntl.h float.h inttypes.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.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 # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "@%:@define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "@%:@define uid_t int" >>confdefs.h $as_echo "@%:@define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" case $ac_cv_c_int64_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int64_t $ac_cv_c_int64_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define mode_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int * int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int main () { int s[1]; int * $ac_kw t = s; t[0] = 0; return foo(t) ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 $as_echo "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) $as_echo "@%:@define restrict /**/" >>confdefs.h ;; *) cat >>confdefs.h <<_ACEOF @%:@define restrict $ac_cv_c_restrict _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "@%:@define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @%:@define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) $as_echo "@%:@define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @%:@define uint64_t $ac_cv_c_uint64_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "@%:@define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @%:@define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # Checks for library functions. # TODO: gettext() fails out-of-the-box from AutoConf. #AM_GNU_GETTEXT for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=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: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "@%:@define HAVE_MALLOC 1" >>confdefs.h else $as_echo "@%:@define HAVE_MALLOC 0" >>confdefs.h case " $LIB@&t@OBJS " in *" malloc.$ac_objext "* ) ;; *) LIB@&t@OBJS="$LIB@&t@OBJS malloc.$ac_objext" ;; esac $as_echo "@%:@define malloc rpl_malloc" >>confdefs.h fi for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$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 getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=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: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "@%:@define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=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: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "@%:@define HAVE_REALLOC 1" >>confdefs.h else $as_echo "@%:@define HAVE_REALLOC 0" >>confdefs.h case " $LIB@&t@OBJS " in *" realloc.$ac_objext "* ) ;; *) LIB@&t@OBJS="$LIB@&t@OBJS realloc.$ac_objext" ;; esac $as_echo "@%:@define realloc rpl_realloc" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF @%:@define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "@%:@define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in atexit clock_gettime floor ftime gethostbyaddr gethostbyname gethostname gettimeofday inet_ntoa memmove memset regcomp select setenv setlocale socket sqrt stpcpy strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul strtoull 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 # POSIX spinlocks { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_spinlock" >&5 $as_echo_n "checking for pthread_spinlock... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_spinlock_t spinlock; pthread_spin_lock (&spinlock); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_POSIX_SPINLOCK" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # NSS protocol lookup ac_fn_c_check_func "$LINENO" "getprotobyname_r" "ac_cv_func_getprotobyname_r" if test "x$ac_cv_func_getprotobyname_r" = xyes; then : fi if test "x$ac_cv_func_getprotobyname_r" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 4- or 5-param getprotobyname_r" >&5 $as_echo_n "checking for 4- or 5-param getprotobyname_r... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { getprotobyname_r ((const char*)0, (struct protoent*)0, (char*)0, (size_t)0, (struct protoent**)0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: 5-param" >&5 $as_echo "5-param" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R2" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: 4-param" >&5 $as_echo "4-param" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # NSS networks lookup, IPv4 only ac_fn_c_check_func "$LINENO" "getnetent" "ac_cv_func_getnetent" if test "x$ac_cv_func_getnetent" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_GETNETENT" fi # variadic macros { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 variadic macros" >&5 $as_echo_n "checking for C99 variadic macros... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #define error(...) fprintf (stderr, __VA_ARGS__) int main () { error("moo"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_ISO_VARARGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU-style variadic macros" >&5 $as_echo_n "checking for GNU-style variadic macros... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #define error(x...) fprintf (stderr, x) int main () { error("moo"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GNUC_VARARGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # stack memory api header { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca.h" >&5 $as_echo_n "checking for alloca.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { void* ptr = alloca (1); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_ALLOCA_H" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # eventfd API { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eventfd" >&5 $as_echo_n "checking for eventfd... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { eventfd (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_EVENTFD" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # useful /proc system { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/cpuinfo" >&5 $as_echo_n "checking for /proc/cpuinfo... " >&6; } if ${ac_cv_file__proc_cpuinfo+:} 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 "/proc/cpuinfo"; then ac_cv_file__proc_cpuinfo=yes else ac_cv_file__proc_cpuinfo=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_cpuinfo" >&5 $as_echo "$ac_cv_file__proc_cpuinfo" >&6; } if test "x$ac_cv_file__proc_cpuinfo" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_PROC" fi # example: crash handling ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_BACKTRACE" fi # timing ac_fn_c_check_func "$LINENO" "pselect" "ac_cv_func_pselect" if test "x$ac_cv_func_pselect" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_PSELECT" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/rtc" >&5 $as_echo_n "checking for /dev/rtc... " >&6; } if ${ac_cv_file__dev_rtc+:} 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/rtc"; then ac_cv_file__dev_rtc=yes else ac_cv_file__dev_rtc=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_rtc" >&5 $as_echo "$ac_cv_file__dev_rtc" >&6; } if test "x$ac_cv_file__dev_rtc" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_RTC" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RDTSC instruction" >&5 $as_echo_n "checking for RDTSC instruction... " >&6; } case "$host_os" in darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { unsigned long lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_TSC" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/hpet" >&5 $as_echo_n "checking for /dev/hpet... " >&6; } if ${ac_cv_file__dev_hpet+:} 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/hpet"; then ac_cv_file__dev_hpet=yes else ac_cv_file__dev_hpet=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_hpet" >&5 $as_echo "$ac_cv_file__dev_hpet" >&6; } if test "x$ac_cv_file__dev_hpet" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_HPET" fi # event handling ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" if test "x$ac_cv_func_poll" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_POLL" fi ac_fn_c_check_func "$LINENO" "epoll_ctl" "ac_cv_func_epoll_ctl" if test "x$ac_cv_func_epoll_ctl" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_EPOLL" fi # interface enumeration ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" if test "x$ac_cv_func_getifaddrs" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_GETIFADDRS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct ifreq.ifr_netmask" >&5 $as_echo_n "checking for struct ifreq.ifr_netmask... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct ifaddrs ifa; ifa.ifa_netmask = (struct sockaddr*)0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_IFR_NETMASK" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # win32 cmsg ac_fn_c_check_member "$LINENO" "struct _WSAMSG" "name" "ac_cv_member_struct__WSAMSG_name" "$ac_includes_default" if test "x$ac_cv_member_struct__WSAMSG_name" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_WSACMSGHDR" fi # multicast { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct group_req.gr_interface" >&5 $as_echo_n "checking for struct group_req.gr_interface... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct group_req gr; gr.gr_interface = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_MCAST_JOIN" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct ip_mreqn.imr_ifindex" >&5 $as_echo_n "checking for struct ip_mreqn.imr_ifindex... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct ip_mreqn mreqn; mreqn.imr_ifindex = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_IP_MREQN" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # sprintf, caveat http://savannah.gnu.org/patch/?6848 (ax_c_printf_thsep) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf thousands' grouping" >&5 $as_echo_n "checking for printf thousands' grouping... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { printf ("%'d", 1000000); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_SPRINTF_GROUPING" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" if test "x$ac_cv_func_vasprintf" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_VASPRINTF" fi # symbol linking scope # nb: sun x86 ld doesn't support DSO visibility but the compiler raises # warnings and these are easier to detect in autoconf. save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidden visibility attribute" >&5 $as_echo_n "checking for hidden visibility attribute... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __SUNPRO_C __hidden #else __attribute__((visibility("hidden"))) #endif void moo (void) {}; int main () { moo(); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$save_CFLAGS -DCONFIG_HAVE_DSO_VISIBILITY" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$save_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # socket binding CFLAGS="$CFLAGS -DCONFIG_BIND_INADDR_ANY" # IP header order as per IP(4) on FreeBSD { $as_echo "$as_me:${as_lineno-$LINENO}: checking for raw IP sockets ip_{len,off} host byte ordering" >&5 $as_echo_n "checking for raw IP sockets ip_{len,off} host byte ordering... " >&6; } case "$host_os" in *openbsd*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *bsd*|*darwin*|*osf*|*unixware*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HOST_ORDER_IP_LEN -DCONFIG_HOST_ORDER_IP_OFF" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac # extended assembler on SPARC case "$host" in sparc-sun-solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPARC extended assembler" >&5 $as_echo_n "checking for SPARC extended assembler... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include uint32_t add32_with_carry (uint32_t a, uint32_t b) { __asm__ ( "addcc %2, %0, %0\n\taddx %0, %%g0, %0" : "=r" (a) : "0" (a), "r" (b) : "cc"); return a; } int main () { uint32_t c = add32_with_carry (1, 2); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: optimization required" >&5 $as_echo "optimization required" >&6; } CFLAGS="$CFLAGS -xO1" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; *) ;; esac # ticket spinlock friendly: unaligned pointers & atomic ops (excl. Sun Pro) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unaligned pointers" >&5 $as_echo_n "checking for unaligned pointers... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ char* nezumi = "mouse"; int main () { short x = *(short*)(nezumi + 2) ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } pgm_unaligned_pointers=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } pgm_unaligned_pointers=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}: checking for intrinsic atomic ops" >&5 $as_echo_n "checking for intrinsic atomic ops... " >&6; } # AC_PREPROC_IFELSE not always portable cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) /* GCC assembler */ #elif defined( __sun ) /* Solaris intrinsic */ #elif defined( __APPLE__ ) /* Darwin intrinsic */ #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* GCC 4.0.1 intrinsic */ #elif defined( _WIN32 ) /* Windows intrinsic */ #else # error "Unsupported atomic ops." #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } if test "$pgm_unaligned_pointers" = yes; then CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK -DCONFIG_DUMB_RWSPINLOCK" else CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_config_files="$ac_config_files Makefile openpgm-${RELEASE_INFO}.pc openpgm.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIB@&t@OBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in @%:@( *posix*) : set -o posix ;; @%:@( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in @%:@( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in @%:@(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH @%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] @%:@ ---------------------------------------- @%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are @%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the @%:@ script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } @%:@ as_fn_error @%:@ as_fn_set_status STATUS @%:@ ----------------------- @%:@ Set @S|@? to STATUS, without forking. as_fn_set_status () { return $1 } @%:@ as_fn_set_status @%:@ as_fn_exit STATUS @%:@ ----------------- @%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } @%:@ as_fn_exit @%:@ as_fn_unset VAR @%:@ --------------- @%:@ Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset @%:@ as_fn_append VAR VALUE @%:@ ---------------------- @%:@ Append the text in VALUE to the end of the definition contained in VAR. Take @%:@ advantage of any shell optimizations that allow amortized linear growth over @%:@ repeated appends, instead of the typical quadratic growth present in naive @%:@ implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append @%:@ as_fn_arith ARG... @%:@ ------------------ @%:@ Perform arithmetic evaluation on the ARGs, and store the result in the @%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments @%:@ must be portable across @S|@(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in @%:@((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @%:@ as_fn_mkdir_p @%:@ ------------- @%:@ Create "@S|@as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } @%:@ as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in @%:@( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in @%:@(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by OpenPGM $as_me 5.1.118, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to . OpenPGM home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ OpenPGM config.status 5.1.118 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX @%:@@%:@ Running $as_me. @%:@@%:@ _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "openpgm-${RELEASE_INFO}.pc") CONFIG_FILES="$CONFIG_FILES openpgm-${RELEASE_INFO}.pc" ;; "openpgm.spec") CONFIG_FILES="$CONFIG_FILES openpgm.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi libpgm-5.1.118-1~dfsg/openpgm/pgm/autom4te.cache/traces.00000644000175000017500000032107111644640130021710 0ustar locallocalm4trace:/usr/share/aclocal/argz.m4:12: -1- AC_DEFUN([gl_FUNC_ARGZ], [gl_PREREQ_ARGZ AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_TYPES([error_t], [], [AC_DEFINE([error_t], [int], [Define to a type to use for `error_t' if it is not otherwise available.]) AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h does not typedef error_t.])], [#if defined(HAVE_ARGZ_H) # include #endif]) ARGZ_H= AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) dnl if have system argz functions, allow forced use of dnl libltdl-supplied implementation (and default to do so dnl on "known bad" systems). Could use a runtime check, but dnl (a) detecting malloc issues is notoriously unreliable dnl (b) only known system that declares argz functions, dnl provides them, yet they are broken, is cygwin dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) dnl So, it's more straightforward simply to special case dnl this for known bad systems. AS_IF([test -z "$ARGZ_H"], [AC_CACHE_CHECK( [if argz actually works], [lt_cv_sys_argz_works], [[case $host_os in #( *cygwin*) lt_cv_sys_argz_works=no if test "$cross_compiling" != no; then lt_cv_sys_argz_works="guessing no" else lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' save_IFS=$IFS IFS=-. set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` IFS=$save_IFS lt_os_major=${2-0} lt_os_minor=${3-0} lt_os_micro=${4-0} if test "$lt_os_major" -gt 1 \ || { test "$lt_os_major" -eq 1 \ && { test "$lt_os_minor" -gt 5 \ || { test "$lt_os_minor" -eq 5 \ && test "$lt_os_micro" -gt 24; }; }; }; then lt_cv_sys_argz_works=yes fi fi ;; #( *) lt_cv_sys_argz_works=yes ;; esac]]) AS_IF([test "$lt_cv_sys_argz_works" = yes], [AC_DEFINE([HAVE_WORKING_ARGZ], 1, [This value is set to 1 to indicate that the system argz facility works])], [ARGZ_H=argz.h AC_LIBOBJ([argz])])]) AC_SUBST([ARGZ_H]) ]) m4trace:/usr/share/aclocal/argz.m4:79: -1- AC_DEFUN([gl_PREREQ_ARGZ], [:]) m4trace:/usr/share/aclocal/libtool.m4:69: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ]) m4trace:/usr/share/aclocal/libtool.m4:107: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) m4trace:/usr/share/aclocal/libtool.m4:107: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) m4trace:/usr/share/aclocal/libtool.m4:108: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) m4trace:/usr/share/aclocal/libtool.m4:108: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) m4trace:/usr/share/aclocal/libtool.m4:607: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ]) m4trace:/usr/share/aclocal/libtool.m4:788: -1- AC_DEFUN([LT_SUPPORTED_TAG], []) m4trace:/usr/share/aclocal/libtool.m4:799: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ]) m4trace:/usr/share/aclocal/libtool.m4:861: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) m4trace:/usr/share/aclocal/libtool.m4:861: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete. You should run autoupdate.])dnl LT_LANG(C++)]) m4trace:/usr/share/aclocal/libtool.m4:862: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) m4trace:/usr/share/aclocal/libtool.m4:862: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete. You should run autoupdate.])dnl LT_LANG(Fortran 77)]) m4trace:/usr/share/aclocal/libtool.m4:863: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) m4trace:/usr/share/aclocal/libtool.m4:863: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete. You should run autoupdate.])dnl LT_LANG(Fortran)]) m4trace:/usr/share/aclocal/libtool.m4:864: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) m4trace:/usr/share/aclocal/libtool.m4:864: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete. You should run autoupdate.])dnl LT_LANG(Java)]) m4trace:/usr/share/aclocal/libtool.m4:865: -1- AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) m4trace:/usr/share/aclocal/libtool.m4:865: -1- AC_DEFUN([AC_LIBTOOL_RC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_RC' is obsolete. You should run autoupdate.])dnl LT_LANG(Windows Resource)]) m4trace:/usr/share/aclocal/libtool.m4:1181: -1- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) m4trace:/usr/share/aclocal/libtool.m4:1445: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ]) m4trace:/usr/share/aclocal/libtool.m4:1487: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1487: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1496: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ]) m4trace:/usr/share/aclocal/libtool.m4:1531: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1531: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1538: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ]) m4trace:/usr/share/aclocal/libtool.m4:1671: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1671: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1782: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ]) m4trace:/usr/share/aclocal/libtool.m4:1899: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])]) m4trace:/usr/share/aclocal/libtool.m4:1899: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])]) m4trace:/usr/share/aclocal/libtool.m4:2884: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ]) m4trace:/usr/share/aclocal/libtool.m4:2946: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])]) m4trace:/usr/share/aclocal/libtool.m4:2946: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])]) m4trace:/usr/share/aclocal/libtool.m4:2969: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ]) m4trace:/usr/share/aclocal/libtool.m4:3443: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) m4trace:/usr/share/aclocal/libtool.m4:3443: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) m4trace:/usr/share/aclocal/libtool.m4:3444: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) m4trace:/usr/share/aclocal/libtool.m4:3444: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) m4trace:/usr/share/aclocal/libtool.m4:3514: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ]) m4trace:/usr/share/aclocal/libtool.m4:3533: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])]) m4trace:/usr/share/aclocal/libtool.m4:3533: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])]) m4trace:/usr/share/aclocal/libtool.m4:7498: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) m4trace:/usr/share/aclocal/libtool.m4:7507: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])]) m4trace:/usr/share/aclocal/libtool.m4:7507: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])]) m4trace:/usr/share/aclocal/libtool.m4:7514: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) m4trace:/usr/share/aclocal/libtool.m4:7519: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])]) m4trace:/usr/share/aclocal/libtool.m4:7519: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])]) m4trace:/usr/share/aclocal/libtool.m4:7639: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])]) m4trace:/usr/share/aclocal/libtool.m4:7639: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:16: -1- AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) _$0($*) ]) m4trace:/usr/share/aclocal/ltdl.m4:68: -1- AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ]) m4trace:/usr/share/aclocal/ltdl.m4:81: -1- AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_CONVENIENCE]) m4trace:/usr/share/aclocal/ltdl.m4:81: -1- AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBLTDL_CONVENIENCE' is obsolete. You should run autoupdate.])dnl _LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_CONVENIENCE]) m4trace:/usr/share/aclocal/ltdl.m4:124: -1- AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ]) m4trace:/usr/share/aclocal/ltdl.m4:137: -1- AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_INSTALLABLE]) m4trace:/usr/share/aclocal/ltdl.m4:137: -1- AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBLTDL_INSTALLABLE' is obsolete. You should run autoupdate.])dnl _LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_INSTALLABLE]) m4trace:/usr/share/aclocal/ltdl.m4:213: -1- AC_DEFUN([_LT_LIBOBJ], [ m4_pattern_allow([^_LT_LIBOBJS$]) _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" ]) m4trace:/usr/share/aclocal/ltdl.m4:226: -1- AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) dnl We need to keep our own list of libobjs separate from our parent project, dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while dnl we look for our own LIBOBJs. m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) m4_pushdef([AC_LIBSOURCES]) dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: m4_if(_LTDL_MODE, [], [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) AC_ARG_WITH([included_ltdl], [AS_HELP_STRING([--with-included-ltdl], [use the GNU ltdl sources included here])]) if test "x$with_included_ltdl" != xyes; then # We are not being forced to use the included libltdl sources, so # decide whether there is a useful installed version we can use. AC_CHECK_HEADER([ltdl.h], [AC_CHECK_DECL([lt_dlinterface_register], [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], [with_included_ltdl=no], [with_included_ltdl=yes])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT #include ])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT] ) fi dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE dnl was called yet, then for old times' sake, we assume libltdl is in an dnl eponymous directory: AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) AC_ARG_WITH([ltdl_include], [AS_HELP_STRING([--with-ltdl-include=DIR], [use the ltdl headers installed in DIR])]) if test -n "$with_ltdl_include"; then if test -f "$with_ltdl_include/ltdl.h"; then : else AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) fi else with_ltdl_include=no fi AC_ARG_WITH([ltdl_lib], [AS_HELP_STRING([--with-ltdl-lib=DIR], [use the libltdl.la installed in DIR])]) if test -n "$with_ltdl_lib"; then if test -f "$with_ltdl_lib/libltdl.la"; then : else AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) fi else with_ltdl_lib=no fi case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in ,yes,no,no,) m4_case(m4_default(_LTDL_TYPE, [convenience]), [convenience], [_LTDL_CONVENIENCE], [installable], [_LTDL_INSTALLABLE], [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) ;; ,no,no,no,) # If the included ltdl is not to be used, then use the # preinstalled libltdl we found. AC_DEFINE([HAVE_LTDL], [1], [Define this if a modern libltdl is already installed]) LIBLTDL=-lltdl LTDLDEPS= LTDLINCL= ;; ,no*,no,*) AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) ;; *) with_included_ltdl=no LIBLTDL="-L$with_ltdl_lib -lltdl" LTDLDEPS= LTDLINCL="-I$with_ltdl_include" ;; esac INCLTDL="$LTDLINCL" # Report our decision... AC_MSG_CHECKING([where to find libltdl headers]) AC_MSG_RESULT([$LTDLINCL]) AC_MSG_CHECKING([where to find libltdl library]) AC_MSG_RESULT([$LIBLTDL]) _LTDL_SETUP dnl restore autoconf definition. m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBSOURCES]) AC_CONFIG_COMMANDS_PRE([ _ltdl_libobjs= _ltdl_ltlibobjs= if test -n "$_LT_LIBOBJS"; then # Remove the extension. _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" done fi AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) ]) # Only expand once: m4_define([LTDL_INIT]) ]) m4trace:/usr/share/aclocal/ltdl.m4:352: -1- AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) m4trace:/usr/share/aclocal/ltdl.m4:352: -1- AC_DEFUN([AC_LIB_LTDL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIB_LTDL' is obsolete. You should run autoupdate.])dnl LTDL_INIT($@)]) m4trace:/usr/share/aclocal/ltdl.m4:353: -1- AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) m4trace:/usr/share/aclocal/ltdl.m4:353: -1- AC_DEFUN([AC_WITH_LTDL], [AC_DIAGNOSE([obsolete], [The macro `AC_WITH_LTDL' is obsolete. You should run autoupdate.])dnl LTDL_INIT($@)]) m4trace:/usr/share/aclocal/ltdl.m4:354: -1- AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) m4trace:/usr/share/aclocal/ltdl.m4:354: -1- AC_DEFUN([LT_WITH_LTDL], [AC_DIAGNOSE([obsolete], [The macro `LT_WITH_LTDL' is obsolete. You should run autoupdate.])dnl LTDL_INIT($@)]) m4trace:/usr/share/aclocal/ltdl.m4:367: -1- AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_SYS_MODULE_EXT])dnl AC_REQUIRE([LT_SYS_MODULE_PATH])dnl AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl AC_REQUIRE([LT_LIB_DLLOAD])dnl AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl AC_REQUIRE([gl_FUNC_ARGZ])dnl m4_require([_LT_CHECK_OBJDIR])dnl m4_require([_LT_HEADER_DLFCN])dnl m4_require([_LT_CHECK_DLPREOPEN])dnl m4_require([_LT_DECL_SED])dnl dnl Don't require this, or it will be expanded earlier than the code dnl that sets the variables it relies on: _LT_ENABLE_INSTALL dnl _LTDL_MODE specific code must be called at least once: _LTDL_MODE_DISPATCH # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS # the user used. This is so that ltdl.h can pick up the parent projects # config.h file, The first file in AC_CONFIG_HEADERS must contain the # definitions required by ltdl.c. # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). AC_CONFIG_COMMANDS_PRE([dnl m4_pattern_allow([^LT_CONFIG_H$])dnl m4_ifset([AH_HEADER], [LT_CONFIG_H=AH_HEADER], [m4_ifset([AC_LIST_HEADERS], [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], [])])]) AC_SUBST([LT_CONFIG_H]) AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) m4_pattern_allow([LT_LIBEXT])dnl AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) name= eval "lt_libprefix=\"$libname_spec\"" m4_pattern_allow([LT_LIBPREFIX])dnl AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) name=ltdl eval "LTDLOPEN=\"$libname_spec\"" AC_SUBST([LTDLOPEN]) ]) m4trace:/usr/share/aclocal/ltdl.m4:443: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether deplibs are loaded by dlopen], [lt_cv_sys_dlopen_deplibs], [# PORTME does your system automatically load deplibs for dlopen? # or its logical equivalent (e.g. shl_load for HP-UX < 11) # For now, we just catch OSes we know something about -- in the # future, we'll try test this programmatically. lt_cv_sys_dlopen_deplibs=unknown case $host_os in aix3*|aix4.1.*|aix4.2.*) # Unknown whether this is true for these versions of AIX, but # we want this `case' here to explicitly catch those versions. lt_cv_sys_dlopen_deplibs=unknown ;; aix[[4-9]]*) lt_cv_sys_dlopen_deplibs=yes ;; amigaos*) case $host_cpu in powerpc) lt_cv_sys_dlopen_deplibs=no ;; esac ;; darwin*) # Assuming the user has installed a libdl from somewhere, this is true # If you are looking for one http://www.opendarwin.org/projects/dlcompat lt_cv_sys_dlopen_deplibs=yes ;; freebsd* | dragonfly*) lt_cv_sys_dlopen_deplibs=yes ;; gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) # GNU and its variants, using gnu ld.so (Glibc) lt_cv_sys_dlopen_deplibs=yes ;; hpux10*|hpux11*) lt_cv_sys_dlopen_deplibs=yes ;; interix*) lt_cv_sys_dlopen_deplibs=yes ;; irix[[12345]]*|irix6.[[01]]*) # Catch all versions of IRIX before 6.2, and indicate that we don't # know how it worked for any of those versions. lt_cv_sys_dlopen_deplibs=unknown ;; irix*) # The case above catches anything before 6.2, and it's known that # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; netbsd* | netbsdelf*-gnu) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) lt_cv_sys_dlopen_deplibs=yes ;; osf[[1234]]*) # dlopen did load deplibs (at least at 4.x), but until the 5.x series, # it did *not* use an RPATH in a shared library to find objects the # library depends on, so we explicitly say `no'. lt_cv_sys_dlopen_deplibs=no ;; osf5.0|osf5.0a|osf5.1) # dlopen *does* load deplibs and with the right loader patch applied # it even uses RPATH in a shared library to search for shared objects # that the library depends on, but there's no easy way to know if that # patch is installed. Since this is the case, all we can really # say is unknown -- it depends on the patch being installed. If # it is, this changes to `yes'. Without it, it would be `no'. lt_cv_sys_dlopen_deplibs=unknown ;; osf*) # the two cases above should catch all versions of osf <= 5.1. Read # the comments above for what we know about them. # At > 5.1, deplibs are loaded *and* any RPATH in a shared library # is used to find them so we can finally say `yes'. lt_cv_sys_dlopen_deplibs=yes ;; qnx*) lt_cv_sys_dlopen_deplibs=yes ;; solaris*) lt_cv_sys_dlopen_deplibs=yes ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) libltdl_cv_sys_dlopen_deplibs=yes ;; esac ]) if test "$lt_cv_sys_dlopen_deplibs" != yes; then AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], [Define if the OS needs help to load dependent libraries for dlopen().]) fi ]) m4trace:/usr/share/aclocal/ltdl.m4:542: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:542: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:549: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which extension is used for runtime loadable modules], [libltdl_cv_shlibext], [ module=yes eval libltdl_cv_shlibext=$shrext_cmds ]) if test -n "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_MODULE_EXT])dnl AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], [Define to the extension used for runtime loadable modules, say, ".so".]) fi ]) m4trace:/usr/share/aclocal/ltdl.m4:565: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:565: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:572: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which variable specifies run-time module search path], [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) if test -n "$lt_cv_module_path_var"; then m4_pattern_allow([LT_MODULE_PATH_VAR])dnl AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], [Define to the name of the environment variable that determines the run-time module search path.]) fi ]) m4trace:/usr/share/aclocal/ltdl.m4:584: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:584: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:591: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([for the default library search path], [lt_cv_sys_dlsearch_path], [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) if test -n "$lt_cv_sys_dlsearch_path"; then sys_dlsearch_path= for dir in $lt_cv_sys_dlsearch_path; do if test -z "$sys_dlsearch_path"; then sys_dlsearch_path="$dir" else sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" fi done m4_pattern_allow([LT_DLSEARCH_PATH])dnl AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], [Define to the system default library search path.]) fi ]) m4trace:/usr/share/aclocal/ltdl.m4:612: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:612: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:638: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) LT_DLLOADERS= AC_SUBST([LT_DLLOADERS]) AC_LANG_PUSH([C]) LIBADD_DLOPEN= AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) if test "$ac_cv_search_dlopen" != "none required" ; then LIBADD_DLOPEN="-ldl" fi libltdl_cv_lib_dl_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H # include #endif ]], [[dlopen(0, 0);]])], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_CHECK_LIB([svld], [dlopen], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes then lt_save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" AC_CHECK_FUNCS([dlerror]) LIBS="$lt_save_LIBS" fi AC_SUBST([LIBADD_DLOPEN]) LIBADD_SHL_LOAD= AC_CHECK_FUNC([shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], [AC_CHECK_LIB([dld], [shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD="-ldld"])]) AC_SUBST([LIBADD_SHL_LOAD]) case $host_os in darwin[[1567]].*) # We only want this for pre-Mac OS X 10.4. AC_CHECK_FUNC([_dyld_func_lookup], [AC_DEFINE([HAVE_DYLD], [1], [Define if you have the _dyld_func_lookup function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | os2* | pw32*) AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac AC_CHECK_LIB([dld], [dld_link], [AC_DEFINE([HAVE_DLD], [1], [Define if you have the GNU dld library.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) AC_SUBST([LIBADD_DLD_LINK]) m4_pattern_allow([^LT_DLPREOPEN$]) LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done AC_DEFINE([HAVE_LIBDLLOADER], [1], [Define if libdlloader will be built on this platform]) fi AC_SUBST([LT_DLPREOPEN]) dnl This isn't used anymore, but set it for backwards compatibility LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" AC_SUBST([LIBADD_DL]) AC_LANG_POP ]) m4trace:/usr/share/aclocal/ltdl.m4:731: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:731: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:739: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([for _ prefix in compiled symbols], [lt_cv_sys_symbol_underscore], [lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. ac_nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.c >&AS_MESSAGE_LOG_FD fi rm -rf conftest* ]) sys_symbol_underscore=$lt_cv_sys_symbol_underscore AC_SUBST([sys_symbol_underscore]) ]) m4trace:/usr/share/aclocal/ltdl.m4:776: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:776: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:783: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl if test x"$lt_cv_sys_symbol_underscore" = xyes; then if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], [libltdl_cv_need_uscore], [libltdl_cv_need_uscore=unknown save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" _LT_TRY_DLOPEN_SELF( [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], [], [libltdl_cv_need_uscore=cross]) LIBS="$save_LIBS" ]) fi fi if test x"$libltdl_cv_need_uscore" = xyes; then AC_DEFINE([NEED_USCORE], [1], [Define if dlsym() requires a leading underscore in symbol names.]) fi ]) m4trace:/usr/share/aclocal/ltdl.m4:808: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])]) m4trace:/usr/share/aclocal/ltdl.m4:808: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete. You should run autoupdate.])dnl m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])]) m4trace:/usr/share/aclocal/ltoptions.m4:14: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) m4trace:/usr/share/aclocal/ltoptions.m4:111: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:111: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete. You should run autoupdate.])dnl _LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:146: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:146: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete. You should run autoupdate.])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:195: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:199: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:203: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:203: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete. You should run autoupdate.])dnl AC_ENABLE_SHARED($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:204: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:204: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete. You should run autoupdate.])dnl AC_DISABLE_SHARED($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:249: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:253: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:257: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:257: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete. You should run autoupdate.])dnl AC_ENABLE_STATIC($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:258: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:258: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete. You should run autoupdate.])dnl AC_DISABLE_STATIC($@)]) m4trace:/usr/share/aclocal/ltoptions.m4:303: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:303: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete. You should run autoupdate.])dnl _LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:310: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:310: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete. You should run autoupdate.])dnl _LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:343: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltoptions.m4:343: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete. You should run autoupdate.])dnl _LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) m4trace:/usr/share/aclocal/ltsugar.m4:13: -1- AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) m4trace:/usr/share/aclocal/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4' macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) m4trace:/usr/share/aclocal/lt~obsolete.m4:36: -1- AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4trace:/usr/share/aclocal/lt~obsolete.m4:40: -1- AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH]) m4trace:/usr/share/aclocal/lt~obsolete.m4:41: -1- AC_DEFUN([_LT_AC_SHELL_INIT]) m4trace:/usr/share/aclocal/lt~obsolete.m4:42: -1- AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX]) m4trace:/usr/share/aclocal/lt~obsolete.m4:44: -1- AC_DEFUN([_LT_AC_TAGVAR]) m4trace:/usr/share/aclocal/lt~obsolete.m4:45: -1- AC_DEFUN([AC_LTDL_ENABLE_INSTALL]) m4trace:/usr/share/aclocal/lt~obsolete.m4:46: -1- AC_DEFUN([AC_LTDL_PREOPEN]) m4trace:/usr/share/aclocal/lt~obsolete.m4:47: -1- AC_DEFUN([_LT_AC_SYS_COMPILER]) m4trace:/usr/share/aclocal/lt~obsolete.m4:48: -1- AC_DEFUN([_LT_AC_LOCK]) m4trace:/usr/share/aclocal/lt~obsolete.m4:49: -1- AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE]) m4trace:/usr/share/aclocal/lt~obsolete.m4:50: -1- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF]) m4trace:/usr/share/aclocal/lt~obsolete.m4:51: -1- AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O]) m4trace:/usr/share/aclocal/lt~obsolete.m4:52: -1- AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS]) m4trace:/usr/share/aclocal/lt~obsolete.m4:53: -1- AC_DEFUN([AC_LIBTOOL_OBJDIR]) m4trace:/usr/share/aclocal/lt~obsolete.m4:54: -1- AC_DEFUN([AC_LTDL_OBJDIR]) m4trace:/usr/share/aclocal/lt~obsolete.m4:55: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH]) m4trace:/usr/share/aclocal/lt~obsolete.m4:56: -1- AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP]) m4trace:/usr/share/aclocal/lt~obsolete.m4:57: -1- AC_DEFUN([AC_PATH_MAGIC]) m4trace:/usr/share/aclocal/lt~obsolete.m4:58: -1- AC_DEFUN([AC_PROG_LD_GNU]) m4trace:/usr/share/aclocal/lt~obsolete.m4:59: -1- AC_DEFUN([AC_PROG_LD_RELOAD_FLAG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:60: -1- AC_DEFUN([AC_DEPLIBS_CHECK_METHOD]) m4trace:/usr/share/aclocal/lt~obsolete.m4:61: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI]) m4trace:/usr/share/aclocal/lt~obsolete.m4:62: -1- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) m4trace:/usr/share/aclocal/lt~obsolete.m4:63: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC]) m4trace:/usr/share/aclocal/lt~obsolete.m4:64: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS]) m4trace:/usr/share/aclocal/lt~obsolete.m4:65: -1- AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP]) m4trace:/usr/share/aclocal/lt~obsolete.m4:66: -1- AC_DEFUN([LT_AC_PROG_EGREP]) m4trace:/usr/share/aclocal/lt~obsolete.m4:71: -1- AC_DEFUN([_AC_PROG_LIBTOOL]) m4trace:/usr/share/aclocal/lt~obsolete.m4:72: -1- AC_DEFUN([AC_LIBTOOL_SETUP]) m4trace:/usr/share/aclocal/lt~obsolete.m4:73: -1- AC_DEFUN([_LT_AC_CHECK_DLFCN]) m4trace:/usr/share/aclocal/lt~obsolete.m4:74: -1- AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) m4trace:/usr/share/aclocal/lt~obsolete.m4:75: -1- AC_DEFUN([_LT_AC_TAGCONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:77: -1- AC_DEFUN([_LT_AC_LANG_CXX]) m4trace:/usr/share/aclocal/lt~obsolete.m4:78: -1- AC_DEFUN([_LT_AC_LANG_F77]) m4trace:/usr/share/aclocal/lt~obsolete.m4:79: -1- AC_DEFUN([_LT_AC_LANG_GCJ]) m4trace:/usr/share/aclocal/lt~obsolete.m4:80: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:81: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:82: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:83: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:84: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:85: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:86: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:87: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:88: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:89: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:90: -1- AC_DEFUN([AC_LIBTOOL_CONFIG]) m4trace:/usr/share/aclocal/lt~obsolete.m4:91: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C]) m4trace:/usr/share/aclocal/lt~obsolete.m4:93: -1- AC_DEFUN([_LT_AC_PROG_CXXCPP]) m4trace:/usr/share/aclocal/lt~obsolete.m4:96: -1- AC_DEFUN([_LT_PROG_F77]) m4trace:/usr/share/aclocal/lt~obsolete.m4:97: -1- AC_DEFUN([_LT_PROG_FC]) m4trace:/usr/share/aclocal/lt~obsolete.m4:98: -1- AC_DEFUN([_LT_PROG_CXX]) m4trace:/usr/share/aclocal-1.11/amversion.m4:14: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) m4trace:/usr/share/aclocal-1.11/amversion.m4:33: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) m4trace:/usr/share/aclocal-1.11/auxdir.m4:47: -1- AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) m4trace:/usr/share/aclocal-1.11/cond.m4:15: -1- AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) m4trace:/usr/share/aclocal-1.11/depend.m4:28: -1- AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) m4trace:/usr/share/aclocal-1.11/depend.m4:163: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) m4trace:/usr/share/aclocal-1.11/depend.m4:171: -1- AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) m4trace:/usr/share/aclocal-1.11/depout.m4:14: -1- AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ]) m4trace:/usr/share/aclocal-1.11/depout.m4:75: -1- AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) m4trace:/usr/share/aclocal-1.11/init.m4:26: -1- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) m4trace:/usr/share/aclocal-1.11/init.m4:126: -1- AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) m4trace:/usr/share/aclocal-1.11/install-sh.m4:11: -1- AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) m4trace:/usr/share/aclocal-1.11/lead-dot.m4:12: -1- AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) m4trace:/usr/share/aclocal-1.11/make.m4:14: -1- AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) m4trace:/usr/share/aclocal-1.11/missing.m4:14: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) m4trace:/usr/share/aclocal-1.11/missing.m4:24: -1- AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) m4trace:/usr/share/aclocal-1.11/mkdirp.m4:11: -1- AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) m4trace:/usr/share/aclocal-1.11/options.m4:13: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) m4trace:/usr/share/aclocal-1.11/options.m4:19: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) m4trace:/usr/share/aclocal-1.11/options.m4:25: -1- AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) m4trace:/usr/share/aclocal-1.11/options.m4:31: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) m4trace:/usr/share/aclocal-1.11/runlog.m4:12: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) m4trace:/usr/share/aclocal-1.11/sanity.m4:14: -1- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) m4trace:/usr/share/aclocal-1.11/silent.m4:14: -1- AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) m4trace:/usr/share/aclocal-1.11/strip.m4:17: -1- AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) m4trace:/usr/share/aclocal-1.11/substnot.m4:14: -1- AC_DEFUN([_AM_SUBST_NOTMAKE]) m4trace:/usr/share/aclocal-1.11/substnot.m4:19: -1- AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) m4trace:/usr/share/aclocal-1.11/tar.m4:24: -1- AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.ac:8: -1- m4_pattern_forbid([_AC_]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) m4trace:configure.ac:8: -1- m4_pattern_allow([^AS_FLAGS$]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?m4_]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^dnl$]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?AS_]) m4trace:configure.ac:8: -1- m4_pattern_allow([^SHELL$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PATH_SEPARATOR$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_NAME$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_VERSION$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_STRING$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_URL$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^exec_prefix$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^prefix$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^program_transform_name$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^bindir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^sbindir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^libexecdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^datarootdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^datadir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^sysconfdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^sharedstatedir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^localstatedir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^includedir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^oldincludedir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^docdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^infodir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^htmldir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^dvidir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^pdfdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^psdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^libdir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^localedir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^mandir$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_NAME$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_VERSION$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_STRING$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_URL$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^DEFS$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^ECHO_C$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^ECHO_N$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^ECHO_T$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^build_alias$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^host_alias$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^target_alias$]) m4trace:configure.ac:15: -1- AM_INIT_AUTOMAKE([1.10 no-define foreign]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) m4trace:configure.ac:15: -1- AM_SET_CURRENT_AUTOMAKE_VERSION m4trace:configure.ac:15: -1- AM_AUTOMAKE_VERSION([1.11.1]) m4trace:configure.ac:15: -1- _AM_AUTOCONF_VERSION([2.68]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_DATA$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__isrc$]) m4trace:configure.ac:15: -1- _AM_SUBST_NOTMAKE([am__isrc]) m4trace:configure.ac:15: -1- m4_pattern_allow([^CYGPATH_W$]) m4trace:configure.ac:15: -1- _AM_SET_OPTIONS([1.10 no-define foreign]) m4trace:configure.ac:15: -1- _AM_SET_OPTION([1.10]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([1.10]) m4trace:configure.ac:15: -1- _AM_SET_OPTION([no-define]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([no-define]) m4trace:configure.ac:15: -1- _AM_SET_OPTION([foreign]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([foreign]) m4trace:configure.ac:15: -1- m4_pattern_allow([^PACKAGE$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^VERSION$]) m4trace:configure.ac:15: -1- _AM_IF_OPTION([no-define], [], [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([no-define]) m4trace:configure.ac:15: -1- AM_SANITY_CHECK m4trace:configure.ac:15: -1- AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) m4trace:configure.ac:15: -1- AM_MISSING_HAS_RUN m4trace:configure.ac:15: -1- AM_AUX_DIR_EXPAND m4trace:configure.ac:15: -1- m4_pattern_allow([^ACLOCAL$]) m4trace:configure.ac:15: -1- AM_MISSING_PROG([AUTOCONF], [autoconf]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AUTOCONF$]) m4trace:configure.ac:15: -1- AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AUTOMAKE$]) m4trace:configure.ac:15: -1- AM_MISSING_PROG([AUTOHEADER], [autoheader]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AUTOHEADER$]) m4trace:configure.ac:15: -1- AM_MISSING_PROG([MAKEINFO], [makeinfo]) m4trace:configure.ac:15: -1- m4_pattern_allow([^MAKEINFO$]) m4trace:configure.ac:15: -1- AM_PROG_INSTALL_SH m4trace:configure.ac:15: -1- m4_pattern_allow([^install_sh$]) m4trace:configure.ac:15: -1- AM_PROG_INSTALL_STRIP m4trace:configure.ac:15: -1- m4_pattern_allow([^STRIP$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) m4trace:configure.ac:15: -1- AM_PROG_MKDIR_P m4trace:configure.ac:15: -1- m4_pattern_allow([^MKDIR_P$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^mkdir_p$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AWK$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^SET_MAKE$]) m4trace:configure.ac:15: -1- AM_SET_LEADING_DOT m4trace:configure.ac:15: -1- m4_pattern_allow([^am__leading_dot$]) m4trace:configure.ac:15: -1- _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([tar-ustar]) m4trace:configure.ac:15: -1- _AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([tar-pax]) m4trace:configure.ac:15: -1- _AM_PROG_TAR([v7]) m4trace:configure.ac:15: -1- AM_MISSING_PROG([AMTAR], [tar]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AMTAR$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__tar$]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__untar$]) m4trace:configure.ac:15: -1- _AM_IF_OPTION([no-dependencies], [], [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([no-dependencies]) m4trace:configure.ac:15: -1- _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])]) m4trace:configure.ac:15: -2- _AM_MANGLE_OPTION([silent-rules]) m4trace:configure.ac:16: -1- AM_SILENT_RULES([yes]) m4trace:configure.ac:16: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) m4trace:configure.ac:16: -1- m4_pattern_allow([^AM_BACKSLASH$]) m4trace:configure.ac:16: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH]) m4trace:configure.ac:18: -1- m4_pattern_allow([^RELEASE_INFO$]) m4trace:configure.ac:19: -1- m4_pattern_allow([^VERSION_INFO$]) m4trace:configure.ac:21: -1- m4_pattern_allow([^VERSION_MAJOR$]) m4trace:configure.ac:22: -1- m4_pattern_allow([^VERSION_MINOR$]) m4trace:configure.ac:23: -1- m4_pattern_allow([^VERSION_MICRO$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CFLAGS$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^LDFLAGS$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CPPFLAGS$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^ac_ct_CC$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^EXEEXT$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^OBJEXT$]) m4trace:configure.ac:26: -1- _AM_DEPENDENCIES([CC]) m4trace:configure.ac:26: -1- AM_SET_DEPDIR m4trace:configure.ac:26: -1- m4_pattern_allow([^DEPDIR$]) m4trace:configure.ac:26: -1- AM_OUTPUT_DEPENDENCY_COMMANDS m4trace:configure.ac:26: -1- AM_MAKE_INCLUDE m4trace:configure.ac:26: -1- m4_pattern_allow([^am__include$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__quote$]) m4trace:configure.ac:26: -1- AM_DEP_TRACK m4trace:configure.ac:26: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) m4trace:configure.ac:26: -1- m4_pattern_allow([^AMDEP_TRUE$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^AMDEP_FALSE$]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE]) m4trace:configure.ac:26: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CCDEPMODE$]) m4trace:configure.ac:26: -1- AM_CONDITIONAL([am__fastdepCC], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) m4trace:configure.ac:28: -1- AC_PROG_LIBTOOL m4trace:configure.ac:28: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete. You should run autoupdate.], [/usr/share/aclocal/libtool.m4:107: AC_PROG_LIBTOOL is expanded from... configure.ac:28: the top level]) m4trace:configure.ac:28: -1- LT_INIT m4trace:configure.ac:28: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$]) m4trace:configure.ac:28: -1- LTOPTIONS_VERSION m4trace:configure.ac:28: -1- LTSUGAR_VERSION m4trace:configure.ac:28: -1- LTVERSION_VERSION m4trace:configure.ac:28: -1- LTOBSOLETE_VERSION m4trace:configure.ac:28: -1- _LT_PROG_LTMAIN m4trace:configure.ac:28: -1- m4_pattern_allow([^LIBTOOL$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build_cpu$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build_vendor$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build_os$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host_cpu$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host_vendor$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host_os$]) m4trace:configure.ac:28: -1- _LT_PREPARE_SED_QUOTE_VARS m4trace:configure.ac:28: -1- _LT_PROG_ECHO_BACKSLASH m4trace:configure.ac:28: -1- LT_PATH_LD m4trace:configure.ac:28: -1- m4_pattern_allow([^SED$]) m4trace:configure.ac:28: -1- AC_PROG_EGREP m4trace:configure.ac:28: -1- m4_pattern_allow([^GREP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^EGREP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^FGREP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^GREP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LD$]) m4trace:configure.ac:28: -1- LT_PATH_NM m4trace:configure.ac:28: -1- m4_pattern_allow([^DUMPBIN$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^ac_ct_DUMPBIN$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DUMPBIN$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^NM$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LN_S$]) m4trace:configure.ac:28: -1- LT_CMD_MAX_LEN m4trace:configure.ac:28: -1- m4_pattern_allow([^OBJDUMP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OBJDUMP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DLLTOOL$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DLLTOOL$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^AR$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^ac_ct_AR$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^STRIP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^RANLIB$]) m4trace:configure.ac:28: -1- _LT_WITH_SYSROOT m4trace:configure.ac:28: -1- m4_pattern_allow([LT_OBJDIR]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LT_OBJDIR$]) m4trace:configure.ac:28: -1- _LT_CC_BASENAME([$compiler]) m4trace:configure.ac:28: -1- _LT_PATH_TOOL_PREFIX([${ac_tool_prefix}file], [/usr/bin$PATH_SEPARATOR$PATH]) m4trace:configure.ac:28: -1- _LT_PATH_TOOL_PREFIX([file], [/usr/bin$PATH_SEPARATOR$PATH]) m4trace:configure.ac:28: -1- LT_SUPPORTED_TAG([CC]) m4trace:configure.ac:28: -1- _LT_COMPILER_BOILERPLATE m4trace:configure.ac:28: -1- _LT_LINKER_BOILERPLATE m4trace:configure.ac:28: -1- _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], [lt_cv_prog_compiler_rtti_exceptions], [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, )="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, ) -fno-rtti -fno-exceptions"]) m4trace:configure.ac:28: -1- _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, ) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, )], [$_LT_TAGVAR(lt_prog_compiler_pic, )@&t@m4_if([],[],[ -DPIC],[m4_if([],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, ) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, )=" $_LT_TAGVAR(lt_prog_compiler_pic, )" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, )= _LT_TAGVAR(lt_prog_compiler_can_build_shared, )=no]) m4trace:configure.ac:28: -1- _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_cv_prog_compiler_static_works], [$lt_tmp_static_flag], [], [_LT_TAGVAR(lt_prog_compiler_static, )=]) m4trace:configure.ac:28: -1- m4_pattern_allow([^MANIFEST_TOOL$]) m4trace:configure.ac:28: -1- _LT_REQUIRED_DARWIN_CHECKS m4trace:configure.ac:28: -1- m4_pattern_allow([^DSYMUTIL$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^NMEDIT$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LIPO$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OTOOL$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OTOOL64$]) m4trace:configure.ac:28: -1- _LT_LINKER_OPTION([if $CC understands -b], [lt_cv_prog_compiler__b], [-b], [_LT_TAGVAR(archive_cmds, )='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, )='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags']) m4trace:configure.ac:28: -1- LT_SYS_DLOPEN_SELF m4trace:configure.ac:28: -1- m4_pattern_allow([^CPP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^CPPFLAGS$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^CPP$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^STDC_HEADERS$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^HAVE_DLFCN_H$]) m4trace:configure.ac:29: -1- m4_pattern_allow([^PERL$]) m4trace:configure.ac:30: -1- m4_pattern_allow([^PYTHON$]) m4trace:configure.ac:34: -1- LT_INIT m4trace:configure.ac:35: -1- m4_pattern_allow([^LIBTOOL_DEPS$]) m4trace:configure.ac:36: -1- m4_pattern_allow([^PERL$]) m4trace:configure.ac:37: -1- m4_pattern_allow([^PYTHON$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^size_t$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_ALLOCA_H$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_ALLOCA$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^ALLOCA$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^C_ALLOCA$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^CRAY_STACKSEG_END$]) m4trace:configure.ac:63: -1- m4_pattern_allow([^STACK_DIRECTION$]) m4trace:configure.ac:67: -1- m4_pattern_allow([^HAVE__BOOL$]) m4trace:configure.ac:67: -1- m4_pattern_allow([^HAVE_STDBOOL_H$]) m4trace:configure.ac:68: -1- m4_pattern_allow([^uid_t$]) m4trace:configure.ac:68: -1- m4_pattern_allow([^gid_t$]) m4trace:configure.ac:70: -1- m4_pattern_allow([^int16_t$]) m4trace:configure.ac:71: -1- m4_pattern_allow([^int32_t$]) m4trace:configure.ac:72: -1- m4_pattern_allow([^int64_t$]) m4trace:configure.ac:73: -1- m4_pattern_allow([^int8_t$]) m4trace:configure.ac:74: -1- m4_pattern_allow([^mode_t$]) m4trace:configure.ac:75: -1- m4_pattern_allow([^restrict$]) m4trace:configure.ac:75: -1- m4_pattern_allow([^restrict$]) m4trace:configure.ac:76: -1- m4_pattern_allow([^size_t$]) m4trace:configure.ac:77: -1- m4_pattern_allow([^ssize_t$]) m4trace:configure.ac:78: -1- m4_pattern_allow([^uint16_t$]) m4trace:configure.ac:79: -1- m4_pattern_allow([^_UINT32_T$]) m4trace:configure.ac:79: -1- m4_pattern_allow([^uint32_t$]) m4trace:configure.ac:80: -1- m4_pattern_allow([^_UINT64_T$]) m4trace:configure.ac:80: -1- m4_pattern_allow([^uint64_t$]) m4trace:configure.ac:81: -1- m4_pattern_allow([^_UINT8_T$]) m4trace:configure.ac:81: -1- m4_pattern_allow([^uint8_t$]) m4trace:configure.ac:86: -1- m4_pattern_allow([^HAVE_STDLIB_H$]) m4trace:configure.ac:86: -1- m4_pattern_allow([^HAVE_MALLOC$]) m4trace:configure.ac:86: -1- m4_pattern_allow([^HAVE_MALLOC$]) m4trace:configure.ac:86: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.ac:86: -1- m4_pattern_allow([^malloc$]) m4trace:configure.ac:87: -1- AC_DEFUN([_AC_Header_stdlib_h], [m4_divert_text([INIT_PREPARE], [AS_VAR_APPEND([ac_header_list], [" stdlib.h"])]) _AC_HEADERS_EXPANSION]) m4trace:configure.ac:87: -1- AC_DEFUN([_AC_Header_unistd_h], [m4_divert_text([INIT_PREPARE], [AS_VAR_APPEND([ac_header_list], [" unistd.h"])]) _AC_HEADERS_EXPANSION]) m4trace:configure.ac:87: -1- AC_DEFUN([_AC_Header_sys_param_h], [m4_divert_text([INIT_PREPARE], [AS_VAR_APPEND([ac_header_list], [" sys/param.h"])]) _AC_HEADERS_EXPANSION]) m4trace:configure.ac:87: -1- m4_pattern_allow([^HAVE_GETPAGESIZE$]) m4trace:configure.ac:87: -1- m4_pattern_allow([^HAVE_MMAP$]) m4trace:configure.ac:88: -1- m4_pattern_allow([^HAVE_STDLIB_H$]) m4trace:configure.ac:88: -1- m4_pattern_allow([^HAVE_REALLOC$]) m4trace:configure.ac:88: -1- m4_pattern_allow([^HAVE_REALLOC$]) m4trace:configure.ac:88: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.ac:88: -1- m4_pattern_allow([^realloc$]) m4trace:configure.ac:89: -1- m4_pattern_allow([^HAVE_DECL_STRERROR_R$]) m4trace:configure.ac:89: -1- m4_pattern_allow([^HAVE_STRERROR_R$]) m4trace:configure.ac:89: -1- m4_pattern_allow([^STRERROR_R_CHAR_P$]) m4trace:configure.ac:149: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [../../lib/autoconf/general.m4:2778: AC_CHECK_FILE is expanded from... configure.ac:149: the top level]) m4trace:configure.ac:157: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [../../lib/autoconf/general.m4:2778: AC_CHECK_FILE is expanded from... configure.ac:157: the top level]) m4trace:configure.ac:173: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [../../lib/autoconf/general.m4:2778: AC_CHECK_FILE is expanded from... configure.ac:173: the top level]) m4trace:configure.ac:276: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from... configure.ac:276: the top level]) m4trace:configure.ac:308: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.ac:308: -1- m4_pattern_allow([^LTLIBOBJS$]) m4trace:configure.ac:308: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) m4trace:configure.ac:308: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) m4trace:configure.ac:308: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) m4trace:configure.ac:308: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) m4trace:configure.ac:308: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) m4trace:configure.ac:308: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS m4trace:configure.ac:308: -1- _LT_PROG_LTMAIN libpgm-5.1.118-1~dfsg/openpgm/pgm/autom4te.cache/output.00000644000175000017500000162212311644640130021772 0ustar locallocal@%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. @%:@ Generated by GNU Autoconf 2.68 for OpenPGM 5.1.118. @%:@ @%:@ Report bugs to . @%:@ @%:@ @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @%:@ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software @%:@ Foundation, Inc. @%:@ @%:@ @%:@ This configure script is free software; the Free Software Foundation @%:@ gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in @%:@( *posix*) : set -o posix ;; @%:@( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in @%:@( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in @%:@(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in @%:@( *posix*) : set -o posix ;; @%:@( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in @%:@( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in @%:@ (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: openpgm-dev@googlegroups.com about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## @%:@ as_fn_unset VAR @%:@ --------------- @%:@ Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset @%:@ as_fn_set_status STATUS @%:@ ----------------------- @%:@ Set @S|@? to STATUS, without forking. as_fn_set_status () { return $1 } @%:@ as_fn_set_status @%:@ as_fn_exit STATUS @%:@ ----------------- @%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } @%:@ as_fn_exit @%:@ as_fn_mkdir_p @%:@ ------------- @%:@ Create "@S|@as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } @%:@ as_fn_mkdir_p @%:@ as_fn_append VAR VALUE @%:@ ---------------------- @%:@ Append the text in VALUE to the end of the definition contained in VAR. Take @%:@ advantage of any shell optimizations that allow amortized linear growth over @%:@ repeated appends, instead of the typical quadratic growth present in naive @%:@ implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append @%:@ as_fn_arith ARG... @%:@ ------------------ @%:@ Perform arithmetic evaluation on the ARGs, and store the result in the @%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments @%:@ must be portable across @S|@(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith @%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] @%:@ ---------------------------------------- @%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are @%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the @%:@ script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } @%:@ as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in @%:@((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in @%:@( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in @%:@(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIB@&t@OBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenPGM' PACKAGE_TARNAME='openpgm' PACKAGE_VERSION='5.1.118' PACKAGE_STRING='OpenPGM 5.1.118' PACKAGE_BUGREPORT='openpgm-dev@googlegroups.com' PACKAGE_URL='http://code.google.com/p/openpgm/' ac_unique_file="reed_solomon.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIB@&t@OBJS ALLOCA LIBTOOL_DEPS PYTHON PERL CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC VERSION_MICRO VERSION_MINOR VERSION_MAJOR VERSION_INFO RELEASE_INFO AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures OpenPGM 5.1.118 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @<:@@S|@ac_default_prefix@:>@ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX @<:@PREFIX@:>@ By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root @<:@DATAROOTDIR/doc/openpgm@:>@ --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of OpenPGM 5.1.118:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared@<:@=PKGS@:>@ build shared libraries @<:@default=yes@:>@ --enable-static@<:@=PKGS@:>@ build static libraries @<:@default=yes@:>@ --enable-fast-install@<:@=PKGS@:>@ optimize for fast installation @<:@default=yes@:>@ --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic try to use only PIC/non-PIC objects @<:@default=use both@:>@ --with-gnu-ld assume the C compiler uses GNU ld @<:@default=no@:>@ --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . OpenPGM home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF OpenPGM configure 5.1.118 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## @%:@ ac_fn_c_try_compile LINENO @%:@ -------------------------- @%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_compile @%:@ ac_fn_c_try_link LINENO @%:@ ----------------------- @%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_link @%:@ ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES @%:@ ------------------------------------------------------- @%:@ Tests whether HEADER exists and can be compiled using the include files in @%:@ INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @%:@include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_header_compile @%:@ ac_fn_c_try_cpp LINENO @%:@ ---------------------- @%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_cpp @%:@ ac_fn_c_try_run LINENO @%:@ ---------------------- @%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes @%:@ that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } @%:@ ac_fn_c_try_run @%:@ ac_fn_c_check_func LINENO FUNC VAR @%:@ ---------------------------------- @%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* 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 $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_func @%:@ ac_fn_c_check_type LINENO TYPE VAR INCLUDES @%:@ ------------------------------------------- @%:@ Tests whether TYPE exists after having included INCLUDES, setting cache @%:@ variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_type @%:@ ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES @%:@ ------------------------------------------------------- @%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using @%:@ the include files in INCLUDES and setting the cache variable VAR @%:@ accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @%:@include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------------- ## ## Report this to openpgm-dev@googlegroups.com ## ## ------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_header_mongrel @%:@ ac_fn_c_find_intX_t LINENO BITS VAR @%:@ ----------------------------------- @%:@ Finds a signed integer type with width BITS, setting cache variable VAR @%:@ accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array @<:@1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))@:>@; test_array @<:@0@:>@ = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array @<:@1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))@:>@; test_array @<:@0@:>@ = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in @%:@( int$2_t) : eval "$3=yes" ;; @%:@( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_find_intX_t @%:@ ac_fn_c_find_uintX_t LINENO BITS VAR @%:@ ------------------------------------ @%:@ Finds an unsigned integer type with width BITS, setting cache variable VAR @%:@ accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array @<:@1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)@:>@; test_array @<:@0@:>@ = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in @%:@( uint$2_t) : eval "$3=yes" ;; @%:@( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_find_uintX_t @%:@ ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES @%:@ --------------------------------------------- @%:@ Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR @%:@ accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { @%:@ifndef $as_decl_name @%:@ifdef __cplusplus (void) $as_decl_use; @%:@else (void) $as_decl_name; @%:@endif @%:@endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_decl @%:@ ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES @%:@ ---------------------------------------------------- @%:@ Tries to find if the field MEMBER exists in type AGGR, after including @%:@ INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } @%:@ ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenPGM $as_me 5.1.118, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in @%:@(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Ubuntu 10 : v1.11 # OSX 10.6 : v1.10 # Solaris 10 : v1.8 am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in @%:@(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='openpgm' VERSION='5.1.118' # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' @%:@ Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac AM_BACKSLASH='\' RELEASE_INFO=5.1 VERSION_INFO=0:118 VERSION_MAJOR=5 VERSION_MINOR=1 VERSION_MICRO=118 # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $@%:@ != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf @%:@ Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4' macro_revision='1.3293' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep @%:@ Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } @%:@ Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } @%:@ Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "@%:@define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$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_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no @%:@ Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi @%:@ Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi @%:@ Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default @%:@ Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF @%:@define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' lt_prog_compiler_pic='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic@&t@ -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic@&t@ -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # nb: earliest verifiable version is 2.2. # Apply system specific rules. CFLAGS="$CFLAGS -D_REENTRANT" case "$host_os" in linux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE" ;; solaris*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} 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 socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket; 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_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostname" >&5 $as_echo_n "checking for library containing gethostname... " >&6; } if ${ac_cv_search_gethostname+:} 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 gethostname (); int main () { return gethostname (); ; return 0; } _ACEOF for ac_lib in '' nsl; 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_gethostname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostname+:} false; then : break fi done if ${ac_cv_search_gethostname+:} false; then : else ac_cv_search_gethostname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostname" >&5 $as_echo "$ac_cv_search_gethostname" >&6; } ac_res=$ac_cv_search_gethostname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_aton" >&5 $as_echo_n "checking for library containing inet_aton... " >&6; } if ${ac_cv_search_inet_aton+:} 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 inet_aton (); int main () { return inet_aton (); ; return 0; } _ACEOF for ac_lib in '' resolv; 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_inet_aton=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_inet_aton+:} false; then : break fi done if ${ac_cv_search_inet_aton+:} false; then : else ac_cv_search_inet_aton=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_aton" >&5 $as_echo "$ac_cv_search_inet_aton" >&6; } ac_res=$ac_cv_search_inet_aton if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing kstat_open" >&5 $as_echo_n "checking for library containing kstat_open... " >&6; } if ${ac_cv_search_kstat_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 kstat_open (); int main () { return kstat_open (); ; return 0; } _ACEOF for ac_lib in '' kstat; 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_kstat_open=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_kstat_open+:} false; then : break fi done if ${ac_cv_search_kstat_open+:} false; then : else ac_cv_search_kstat_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_kstat_open" >&5 $as_echo "$ac_cv_search_kstat_open" >&6; } ac_res=$ac_cv_search_kstat_open if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ;; *) ;; esac # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} 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 sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; 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_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_mutex_trylock" >&5 $as_echo_n "checking for library containing pthread_mutex_trylock... " >&6; } if ${ac_cv_search_pthread_mutex_trylock+:} 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 pthread_mutex_trylock (); int main () { return pthread_mutex_trylock (); ; return 0; } _ACEOF for ac_lib in '' pthread; 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_pthread_mutex_trylock=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pthread_mutex_trylock+:} false; then : break fi done if ${ac_cv_search_pthread_mutex_trylock+:} false; then : else ac_cv_search_pthread_mutex_trylock=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_mutex_trylock" >&5 $as_echo "$ac_cv_search_pthread_mutex_trylock" >&6; } ac_res=$ac_cv_search_pthread_mutex_trylock if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} 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 clock_gettime (); int main () { return clock_gettime (); ; 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_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_clock_gettime+:} false; then : break fi done if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Checks for header files. ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "@%:@define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "@%:@define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "@%:@define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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 CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 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: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF @%:@define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_header in arpa/inet.h fcntl.h float.h inttypes.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.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 # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "@%:@define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "@%:@define uid_t int" >>confdefs.h $as_echo "@%:@define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" case $ac_cv_c_int64_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int64_t $ac_cv_c_int64_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define mode_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int * int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int main () { int s[1]; int * $ac_kw t = s; t[0] = 0; return foo(t) ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 $as_echo "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) $as_echo "@%:@define restrict /**/" >>confdefs.h ;; *) cat >>confdefs.h <<_ACEOF @%:@define restrict $ac_cv_c_restrict _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF @%:@define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF @%:@define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "@%:@define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @%:@define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) $as_echo "@%:@define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @%:@define uint64_t $ac_cv_c_uint64_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "@%:@define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @%:@define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # Checks for library functions. # TODO: gettext() fails out-of-the-box from AutoConf. #AM_GNU_GETTEXT for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=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: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "@%:@define HAVE_MALLOC 1" >>confdefs.h else $as_echo "@%:@define HAVE_MALLOC 0" >>confdefs.h case " $LIB@&t@OBJS " in *" malloc.$ac_objext "* ) ;; *) LIB@&t@OBJS="$LIB@&t@OBJS malloc.$ac_objext" ;; esac $as_echo "@%:@define malloc rpl_malloc" >>confdefs.h fi for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$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 getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=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: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "@%:@define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=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: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "@%:@define HAVE_REALLOC 1" >>confdefs.h else $as_echo "@%:@define HAVE_REALLOC 0" >>confdefs.h case " $LIB@&t@OBJS " in *" realloc.$ac_objext "* ) ;; *) LIB@&t@OBJS="$LIB@&t@OBJS realloc.$ac_objext" ;; esac $as_echo "@%:@define realloc rpl_realloc" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF @%:@define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "@%:@define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in atexit clock_gettime floor ftime gethostbyaddr gethostbyname gethostname gettimeofday inet_ntoa memmove memset regcomp select setenv setlocale socket sqrt stpcpy strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul strtoull 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 # POSIX spinlocks { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_spinlock" >&5 $as_echo_n "checking for pthread_spinlock... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_spinlock_t spinlock; pthread_spin_lock (&spinlock); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_POSIX_SPINLOCK" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # NSS protocol lookup ac_fn_c_check_func "$LINENO" "getprotobyname_r" "ac_cv_func_getprotobyname_r" if test "x$ac_cv_func_getprotobyname_r" = xyes; then : fi if test "x$ac_cv_func_getprotobyname_r" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 4- or 5-param getprotobyname_r" >&5 $as_echo_n "checking for 4- or 5-param getprotobyname_r... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { getprotobyname_r ((const char*)0, (struct protoent*)0, (char*)0, (size_t)0, (struct protoent**)0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: 5-param" >&5 $as_echo "5-param" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R2" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: 4-param" >&5 $as_echo "4-param" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # NSS networks lookup, IPv4 only ac_fn_c_check_func "$LINENO" "getnetent" "ac_cv_func_getnetent" if test "x$ac_cv_func_getnetent" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_GETNETENT" fi # variadic macros { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 variadic macros" >&5 $as_echo_n "checking for C99 variadic macros... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #define error(...) fprintf (stderr, __VA_ARGS__) int main () { error("moo"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_ISO_VARARGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU-style variadic macros" >&5 $as_echo_n "checking for GNU-style variadic macros... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #define error(x...) fprintf (stderr, x) int main () { error("moo"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GNUC_VARARGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # stack memory api header { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca.h" >&5 $as_echo_n "checking for alloca.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { void* ptr = alloca (1); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_ALLOCA_H" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # eventfd API { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eventfd" >&5 $as_echo_n "checking for eventfd... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { eventfd (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_EVENTFD" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # useful /proc system { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/cpuinfo" >&5 $as_echo_n "checking for /proc/cpuinfo... " >&6; } if ${ac_cv_file__proc_cpuinfo+:} 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 "/proc/cpuinfo"; then ac_cv_file__proc_cpuinfo=yes else ac_cv_file__proc_cpuinfo=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_cpuinfo" >&5 $as_echo "$ac_cv_file__proc_cpuinfo" >&6; } if test "x$ac_cv_file__proc_cpuinfo" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_PROC" fi # example: crash handling ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_BACKTRACE" fi # timing ac_fn_c_check_func "$LINENO" "pselect" "ac_cv_func_pselect" if test "x$ac_cv_func_pselect" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_PSELECT" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/rtc" >&5 $as_echo_n "checking for /dev/rtc... " >&6; } if ${ac_cv_file__dev_rtc+:} 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/rtc"; then ac_cv_file__dev_rtc=yes else ac_cv_file__dev_rtc=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_rtc" >&5 $as_echo "$ac_cv_file__dev_rtc" >&6; } if test "x$ac_cv_file__dev_rtc" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_RTC" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RDTSC instruction" >&5 $as_echo_n "checking for RDTSC instruction... " >&6; } case "$host_os" in darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { unsigned long lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_TSC" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/hpet" >&5 $as_echo_n "checking for /dev/hpet... " >&6; } if ${ac_cv_file__dev_hpet+:} 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/hpet"; then ac_cv_file__dev_hpet=yes else ac_cv_file__dev_hpet=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_hpet" >&5 $as_echo "$ac_cv_file__dev_hpet" >&6; } if test "x$ac_cv_file__dev_hpet" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_HPET" fi # event handling ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" if test "x$ac_cv_func_poll" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_POLL" fi ac_fn_c_check_func "$LINENO" "epoll_ctl" "ac_cv_func_epoll_ctl" if test "x$ac_cv_func_epoll_ctl" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_EPOLL" fi # interface enumeration ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" if test "x$ac_cv_func_getifaddrs" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_GETIFADDRS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct ifreq.ifr_netmask" >&5 $as_echo_n "checking for struct ifreq.ifr_netmask... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct ifaddrs ifa; ifa.ifa_netmask = (struct sockaddr*)0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_IFR_NETMASK" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # win32 cmsg ac_fn_c_check_member "$LINENO" "struct _WSAMSG" "name" "ac_cv_member_struct__WSAMSG_name" "$ac_includes_default" if test "x$ac_cv_member_struct__WSAMSG_name" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_WSACMSGHDR" fi # multicast { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct group_req.gr_interface" >&5 $as_echo_n "checking for struct group_req.gr_interface... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct group_req gr; gr.gr_interface = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_MCAST_JOIN" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct ip_mreqn.imr_ifindex" >&5 $as_echo_n "checking for struct ip_mreqn.imr_ifindex... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct ip_mreqn mreqn; mreqn.imr_ifindex = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_IP_MREQN" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # sprintf, caveat http://savannah.gnu.org/patch/?6848 (ax_c_printf_thsep) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf thousands' grouping" >&5 $as_echo_n "checking for printf thousands' grouping... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { printf ("%'d", 1000000); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_SPRINTF_GROUPING" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" if test "x$ac_cv_func_vasprintf" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_VASPRINTF" fi # symbol linking scope # nb: sun x86 ld doesn't support DSO visibility but the compiler raises # warnings and these are easier to detect in autoconf. save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidden visibility attribute" >&5 $as_echo_n "checking for hidden visibility attribute... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __SUNPRO_C __hidden #else __attribute__((visibility("hidden"))) #endif void moo (void) {}; int main () { moo(); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$save_CFLAGS -DCONFIG_HAVE_DSO_VISIBILITY" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$save_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # socket binding CFLAGS="$CFLAGS -DCONFIG_BIND_INADDR_ANY" # IP header order as per IP(4) on FreeBSD { $as_echo "$as_me:${as_lineno-$LINENO}: checking for raw IP sockets ip_{len,off} host byte ordering" >&5 $as_echo_n "checking for raw IP sockets ip_{len,off} host byte ordering... " >&6; } case "$host_os" in *openbsd*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *bsd*|*darwin*|*osf*|*unixware*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HOST_ORDER_IP_LEN -DCONFIG_HOST_ORDER_IP_OFF" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac # extended assembler on SPARC case "$host" in sparc-sun-solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPARC extended assembler" >&5 $as_echo_n "checking for SPARC extended assembler... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include uint32_t add32_with_carry (uint32_t a, uint32_t b) { __asm__ ( "addcc %2, %0, %0\n\taddx %0, %%g0, %0" : "=r" (a) : "0" (a), "r" (b) : "cc"); return a; } int main () { uint32_t c = add32_with_carry (1, 2); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: optimization required" >&5 $as_echo "optimization required" >&6; } CFLAGS="$CFLAGS -xO1" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; *) ;; esac # ticket spinlock friendly: unaligned pointers & atomic ops (excl. Sun Pro) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unaligned pointers" >&5 $as_echo_n "checking for unaligned pointers... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ char* nezumi = "mouse"; int main () { short x = *(short*)(nezumi + 2) ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } pgm_unaligned_pointers=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } pgm_unaligned_pointers=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}: checking for intrinsic atomic ops" >&5 $as_echo_n "checking for intrinsic atomic ops... " >&6; } # AC_PREPROC_IFELSE not always portable cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) /* GCC assembler */ #elif defined( __sun ) /* Solaris intrinsic */ #elif defined( __APPLE__ ) /* Darwin intrinsic */ #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* GCC 4.0.1 intrinsic */ #elif defined( _WIN32 ) /* Windows intrinsic */ #else # error "Unsupported atomic ops." #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } if test "$pgm_unaligned_pointers" = yes; then CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK -DCONFIG_DUMB_RWSPINLOCK" else CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_config_files="$ac_config_files Makefile openpgm-${RELEASE_INFO}.pc openpgm.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIB@&t@OBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in @%:@( *posix*) : set -o posix ;; @%:@( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in @%:@( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in @%:@(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH @%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] @%:@ ---------------------------------------- @%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are @%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the @%:@ script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } @%:@ as_fn_error @%:@ as_fn_set_status STATUS @%:@ ----------------------- @%:@ Set @S|@? to STATUS, without forking. as_fn_set_status () { return $1 } @%:@ as_fn_set_status @%:@ as_fn_exit STATUS @%:@ ----------------- @%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } @%:@ as_fn_exit @%:@ as_fn_unset VAR @%:@ --------------- @%:@ Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset @%:@ as_fn_append VAR VALUE @%:@ ---------------------- @%:@ Append the text in VALUE to the end of the definition contained in VAR. Take @%:@ advantage of any shell optimizations that allow amortized linear growth over @%:@ repeated appends, instead of the typical quadratic growth present in naive @%:@ implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append @%:@ as_fn_arith ARG... @%:@ ------------------ @%:@ Perform arithmetic evaluation on the ARGs, and store the result in the @%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments @%:@ must be portable across @S|@(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in @%:@((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @%:@ as_fn_mkdir_p @%:@ ------------- @%:@ Create "@S|@as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } @%:@ as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in @%:@( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in @%:@(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by OpenPGM $as_me 5.1.118, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to . OpenPGM home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ OpenPGM config.status 5.1.118 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX @%:@@%:@ Running $as_me. @%:@@%:@ _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "openpgm-${RELEASE_INFO}.pc") CONFIG_FILES="$CONFIG_FILES openpgm-${RELEASE_INFO}.pc" ;; "openpgm.spec") CONFIG_FILES="$CONFIG_FILES openpgm.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi libpgm-5.1.118-1~dfsg/openpgm/pgm/autom4te.cache/traces.10000644000175000017500000015006411644640132021715 0ustar locallocalm4trace:configure.ac:8: -1- AC_INIT([OpenPGM], [m4_esyscmd([perl version.pl %major.%minor.%micro])], [openpgm-dev@googlegroups.com], [openpgm], [http://code.google.com/p/openpgm/]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.ac:8: -1- m4_pattern_forbid([_AC_]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) m4trace:configure.ac:8: -1- m4_pattern_allow([^AS_FLAGS$]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?m4_]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^dnl$]) m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?AS_]) m4trace:configure.ac:8: -1- AC_SUBST([SHELL]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([SHELL]) m4trace:configure.ac:8: -1- m4_pattern_allow([^SHELL$]) m4trace:configure.ac:8: -1- AC_SUBST([PATH_SEPARATOR]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PATH_SEPARATOR$]) m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PACKAGE_NAME]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_NAME$]) m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_VERSION$]) m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PACKAGE_STRING]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_STRING$]) m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([PACKAGE_URL]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_URL$]) m4trace:configure.ac:8: -1- AC_SUBST([exec_prefix], [NONE]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([exec_prefix]) m4trace:configure.ac:8: -1- m4_pattern_allow([^exec_prefix$]) m4trace:configure.ac:8: -1- AC_SUBST([prefix], [NONE]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([prefix]) m4trace:configure.ac:8: -1- m4_pattern_allow([^prefix$]) m4trace:configure.ac:8: -1- AC_SUBST([program_transform_name], [s,x,x,]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([program_transform_name]) m4trace:configure.ac:8: -1- m4_pattern_allow([^program_transform_name$]) m4trace:configure.ac:8: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([bindir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^bindir$]) m4trace:configure.ac:8: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([sbindir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^sbindir$]) m4trace:configure.ac:8: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([libexecdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^libexecdir$]) m4trace:configure.ac:8: -1- AC_SUBST([datarootdir], ['${prefix}/share']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([datarootdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^datarootdir$]) m4trace:configure.ac:8: -1- AC_SUBST([datadir], ['${datarootdir}']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([datadir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^datadir$]) m4trace:configure.ac:8: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([sysconfdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^sysconfdir$]) m4trace:configure.ac:8: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([sharedstatedir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^sharedstatedir$]) m4trace:configure.ac:8: -1- AC_SUBST([localstatedir], ['${prefix}/var']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([localstatedir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^localstatedir$]) m4trace:configure.ac:8: -1- AC_SUBST([includedir], ['${prefix}/include']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([includedir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^includedir$]) m4trace:configure.ac:8: -1- AC_SUBST([oldincludedir], ['/usr/include']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([oldincludedir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^oldincludedir$]) m4trace:configure.ac:8: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], ['${datarootdir}/doc/${PACKAGE_TARNAME}'], ['${datarootdir}/doc/${PACKAGE}'])]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([docdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^docdir$]) m4trace:configure.ac:8: -1- AC_SUBST([infodir], ['${datarootdir}/info']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([infodir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^infodir$]) m4trace:configure.ac:8: -1- AC_SUBST([htmldir], ['${docdir}']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([htmldir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^htmldir$]) m4trace:configure.ac:8: -1- AC_SUBST([dvidir], ['${docdir}']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([dvidir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^dvidir$]) m4trace:configure.ac:8: -1- AC_SUBST([pdfdir], ['${docdir}']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([pdfdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^pdfdir$]) m4trace:configure.ac:8: -1- AC_SUBST([psdir], ['${docdir}']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([psdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^psdir$]) m4trace:configure.ac:8: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([libdir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^libdir$]) m4trace:configure.ac:8: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([localedir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^localedir$]) m4trace:configure.ac:8: -1- AC_SUBST([mandir], ['${datarootdir}/man']) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([mandir]) m4trace:configure.ac:8: -1- m4_pattern_allow([^mandir$]) m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_NAME$]) m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ @%:@undef PACKAGE_NAME]) m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ @%:@undef PACKAGE_TARNAME]) m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_VERSION$]) m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ @%:@undef PACKAGE_VERSION]) m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_STRING$]) m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ @%:@undef PACKAGE_STRING]) m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ @%:@undef PACKAGE_BUGREPORT]) m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL]) m4trace:configure.ac:8: -1- m4_pattern_allow([^PACKAGE_URL$]) m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */ @%:@undef PACKAGE_URL]) m4trace:configure.ac:8: -1- AC_SUBST([DEFS]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([DEFS]) m4trace:configure.ac:8: -1- m4_pattern_allow([^DEFS$]) m4trace:configure.ac:8: -1- AC_SUBST([ECHO_C]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([ECHO_C]) m4trace:configure.ac:8: -1- m4_pattern_allow([^ECHO_C$]) m4trace:configure.ac:8: -1- AC_SUBST([ECHO_N]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([ECHO_N]) m4trace:configure.ac:8: -1- m4_pattern_allow([^ECHO_N$]) m4trace:configure.ac:8: -1- AC_SUBST([ECHO_T]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([ECHO_T]) m4trace:configure.ac:8: -1- m4_pattern_allow([^ECHO_T$]) m4trace:configure.ac:8: -1- AC_SUBST([LIBS]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([LIBS]) m4trace:configure.ac:8: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:8: -1- AC_SUBST([build_alias]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([build_alias]) m4trace:configure.ac:8: -1- m4_pattern_allow([^build_alias$]) m4trace:configure.ac:8: -1- AC_SUBST([host_alias]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([host_alias]) m4trace:configure.ac:8: -1- m4_pattern_allow([^host_alias$]) m4trace:configure.ac:8: -1- AC_SUBST([target_alias]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([target_alias]) m4trace:configure.ac:8: -1- m4_pattern_allow([^target_alias$]) m4trace:configure.ac:15: -1- AM_INIT_AUTOMAKE([1.10 no-define foreign]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) m4trace:configure.ac:15: -1- AM_AUTOMAKE_VERSION([1.11.1]) m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([install-sh]) m4trace:configure.ac:15: -1- AC_SUBST([INSTALL_PROGRAM]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) m4trace:configure.ac:15: -1- AC_SUBST([INSTALL_SCRIPT]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) m4trace:configure.ac:15: -1- AC_SUBST([INSTALL_DATA]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([INSTALL_DATA]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_DATA$]) m4trace:configure.ac:15: -1- AC_SUBST([am__isrc], [' -I$(srcdir)']) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([am__isrc]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__isrc$]) m4trace:configure.ac:15: -1- _AM_SUBST_NOTMAKE([am__isrc]) m4trace:configure.ac:15: -1- AC_SUBST([CYGPATH_W]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([CYGPATH_W]) m4trace:configure.ac:15: -1- m4_pattern_allow([^CYGPATH_W$]) m4trace:configure.ac:15: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME']) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([PACKAGE]) m4trace:configure.ac:15: -1- m4_pattern_allow([^PACKAGE$]) m4trace:configure.ac:15: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION']) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([VERSION]) m4trace:configure.ac:15: -1- m4_pattern_allow([^VERSION$]) m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([missing]) m4trace:configure.ac:15: -1- AC_SUBST([ACLOCAL]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([ACLOCAL]) m4trace:configure.ac:15: -1- m4_pattern_allow([^ACLOCAL$]) m4trace:configure.ac:15: -1- AC_SUBST([AUTOCONF]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([AUTOCONF]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AUTOCONF$]) m4trace:configure.ac:15: -1- AC_SUBST([AUTOMAKE]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([AUTOMAKE]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AUTOMAKE$]) m4trace:configure.ac:15: -1- AC_SUBST([AUTOHEADER]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([AUTOHEADER]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AUTOHEADER$]) m4trace:configure.ac:15: -1- AC_SUBST([MAKEINFO]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([MAKEINFO]) m4trace:configure.ac:15: -1- m4_pattern_allow([^MAKEINFO$]) m4trace:configure.ac:15: -1- AC_SUBST([install_sh]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([install_sh]) m4trace:configure.ac:15: -1- m4_pattern_allow([^install_sh$]) m4trace:configure.ac:15: -1- AC_SUBST([STRIP]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([STRIP]) m4trace:configure.ac:15: -1- m4_pattern_allow([^STRIP$]) m4trace:configure.ac:15: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM]) m4trace:configure.ac:15: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([install-sh]) m4trace:configure.ac:15: -1- AC_SUBST([MKDIR_P]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([MKDIR_P]) m4trace:configure.ac:15: -1- m4_pattern_allow([^MKDIR_P$]) m4trace:configure.ac:15: -1- AC_SUBST([mkdir_p], ["$MKDIR_P"]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([mkdir_p]) m4trace:configure.ac:15: -1- m4_pattern_allow([^mkdir_p$]) m4trace:configure.ac:15: -1- AC_SUBST([AWK]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([AWK]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AWK$]) m4trace:configure.ac:15: -1- AC_SUBST([SET_MAKE]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([SET_MAKE]) m4trace:configure.ac:15: -1- m4_pattern_allow([^SET_MAKE$]) m4trace:configure.ac:15: -1- AC_SUBST([am__leading_dot]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([am__leading_dot]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__leading_dot$]) m4trace:configure.ac:15: -1- AC_SUBST([AMTAR]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([AMTAR]) m4trace:configure.ac:15: -1- m4_pattern_allow([^AMTAR$]) m4trace:configure.ac:15: -1- AC_SUBST([am__tar]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([am__tar]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__tar$]) m4trace:configure.ac:15: -1- AC_SUBST([am__untar]) m4trace:configure.ac:15: -1- AC_SUBST_TRACE([am__untar]) m4trace:configure.ac:15: -1- m4_pattern_allow([^am__untar$]) m4trace:configure.ac:16: -1- AM_SILENT_RULES([yes]) m4trace:configure.ac:16: -1- AC_SUBST([AM_DEFAULT_VERBOSITY]) m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AM_DEFAULT_VERBOSITY]) m4trace:configure.ac:16: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) m4trace:configure.ac:16: -1- AC_SUBST([AM_BACKSLASH]) m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AM_BACKSLASH]) m4trace:configure.ac:16: -1- m4_pattern_allow([^AM_BACKSLASH$]) m4trace:configure.ac:16: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH]) m4trace:configure.ac:18: -1- AC_SUBST([RELEASE_INFO], [m4_esyscmd([perl version.pl %major.%minor])]) m4trace:configure.ac:18: -1- AC_SUBST_TRACE([RELEASE_INFO]) m4trace:configure.ac:18: -1- m4_pattern_allow([^RELEASE_INFO$]) m4trace:configure.ac:19: -1- AC_SUBST([VERSION_INFO], [m4_esyscmd([perl version.pl 0:%micro])]) m4trace:configure.ac:19: -1- AC_SUBST_TRACE([VERSION_INFO]) m4trace:configure.ac:19: -1- m4_pattern_allow([^VERSION_INFO$]) m4trace:configure.ac:21: -1- AC_SUBST([VERSION_MAJOR], [m4_esyscmd([perl version.pl %major])]) m4trace:configure.ac:21: -1- AC_SUBST_TRACE([VERSION_MAJOR]) m4trace:configure.ac:21: -1- m4_pattern_allow([^VERSION_MAJOR$]) m4trace:configure.ac:22: -1- AC_SUBST([VERSION_MINOR], [m4_esyscmd([perl version.pl %minor])]) m4trace:configure.ac:22: -1- AC_SUBST_TRACE([VERSION_MINOR]) m4trace:configure.ac:22: -1- m4_pattern_allow([^VERSION_MINOR$]) m4trace:configure.ac:23: -1- AC_SUBST([VERSION_MICRO], [m4_esyscmd([perl version.pl %micro])]) m4trace:configure.ac:23: -1- AC_SUBST_TRACE([VERSION_MICRO]) m4trace:configure.ac:23: -1- m4_pattern_allow([^VERSION_MICRO$]) m4trace:configure.ac:26: -1- AC_SUBST([CC]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CC]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- AC_SUBST([CFLAGS]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CFLAGS]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CFLAGS$]) m4trace:configure.ac:26: -1- AC_SUBST([LDFLAGS]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([LDFLAGS]) m4trace:configure.ac:26: -1- m4_pattern_allow([^LDFLAGS$]) m4trace:configure.ac:26: -1- AC_SUBST([LIBS]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([LIBS]) m4trace:configure.ac:26: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:26: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CPPFLAGS]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CPPFLAGS$]) m4trace:configure.ac:26: -1- AC_SUBST([CC]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CC]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- AC_SUBST([CC]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CC]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- AC_SUBST([CC]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CC]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- AC_SUBST([CC]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CC]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CC$]) m4trace:configure.ac:26: -1- AC_SUBST([ac_ct_CC]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([ac_ct_CC]) m4trace:configure.ac:26: -1- m4_pattern_allow([^ac_ct_CC$]) m4trace:configure.ac:26: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([EXEEXT]) m4trace:configure.ac:26: -1- m4_pattern_allow([^EXEEXT$]) m4trace:configure.ac:26: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([OBJEXT]) m4trace:configure.ac:26: -1- m4_pattern_allow([^OBJEXT$]) m4trace:configure.ac:26: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([DEPDIR]) m4trace:configure.ac:26: -1- m4_pattern_allow([^DEPDIR$]) m4trace:configure.ac:26: -1- AC_SUBST([am__include]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([am__include]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__include$]) m4trace:configure.ac:26: -1- AC_SUBST([am__quote]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([am__quote]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__quote$]) m4trace:configure.ac:26: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) m4trace:configure.ac:26: -1- AC_SUBST([AMDEP_TRUE]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([AMDEP_TRUE]) m4trace:configure.ac:26: -1- m4_pattern_allow([^AMDEP_TRUE$]) m4trace:configure.ac:26: -1- AC_SUBST([AMDEP_FALSE]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([AMDEP_FALSE]) m4trace:configure.ac:26: -1- m4_pattern_allow([^AMDEP_FALSE$]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE]) m4trace:configure.ac:26: -1- AC_SUBST([AMDEPBACKSLASH]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([AMDEPBACKSLASH]) m4trace:configure.ac:26: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH]) m4trace:configure.ac:26: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([CCDEPMODE]) m4trace:configure.ac:26: -1- m4_pattern_allow([^CCDEPMODE$]) m4trace:configure.ac:26: -1- AM_CONDITIONAL([am__fastdepCC], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) m4trace:configure.ac:26: -1- AC_SUBST([am__fastdepCC_TRUE]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) m4trace:configure.ac:26: -1- AC_SUBST([am__fastdepCC_FALSE]) m4trace:configure.ac:26: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE]) m4trace:configure.ac:26: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) m4trace:configure.ac:28: -1- AC_PROG_LIBTOOL m4trace:configure.ac:28: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete. You should run autoupdate.], [aclocal.m4:128: AC_PROG_LIBTOOL is expanded from... configure.ac:28: the top level]) m4trace:configure.ac:28: -1- LT_INIT m4trace:configure.ac:28: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$]) m4trace:configure.ac:28: -1- m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$]) m4trace:configure.ac:28: -1- AC_REQUIRE_AUX_FILE([ltmain.sh]) m4trace:configure.ac:28: -1- AC_SUBST([LIBTOOL]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([LIBTOOL]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LIBTOOL$]) m4trace:configure.ac:28: -1- AC_CANONICAL_HOST m4trace:configure.ac:28: -1- AC_CANONICAL_BUILD m4trace:configure.ac:28: -1- AC_REQUIRE_AUX_FILE([config.sub]) m4trace:configure.ac:28: -1- AC_REQUIRE_AUX_FILE([config.guess]) m4trace:configure.ac:28: -1- AC_SUBST([build], [$ac_cv_build]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([build]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build$]) m4trace:configure.ac:28: -1- AC_SUBST([build_cpu], [$[1]]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([build_cpu]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build_cpu$]) m4trace:configure.ac:28: -1- AC_SUBST([build_vendor], [$[2]]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([build_vendor]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build_vendor$]) m4trace:configure.ac:28: -1- AC_SUBST([build_os]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([build_os]) m4trace:configure.ac:28: -1- m4_pattern_allow([^build_os$]) m4trace:configure.ac:28: -1- AC_SUBST([host], [$ac_cv_host]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([host]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host$]) m4trace:configure.ac:28: -1- AC_SUBST([host_cpu], [$[1]]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([host_cpu]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host_cpu$]) m4trace:configure.ac:28: -1- AC_SUBST([host_vendor], [$[2]]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([host_vendor]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host_vendor$]) m4trace:configure.ac:28: -1- AC_SUBST([host_os]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([host_os]) m4trace:configure.ac:28: -1- m4_pattern_allow([^host_os$]) m4trace:configure.ac:28: -1- AC_SUBST([SED]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([SED]) m4trace:configure.ac:28: -1- m4_pattern_allow([^SED$]) m4trace:configure.ac:28: -1- AC_SUBST([GREP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([GREP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^GREP$]) m4trace:configure.ac:28: -1- AC_SUBST([EGREP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([EGREP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^EGREP$]) m4trace:configure.ac:28: -1- AC_SUBST([FGREP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([FGREP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^FGREP$]) m4trace:configure.ac:28: -1- AC_SUBST([GREP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([GREP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^GREP$]) m4trace:configure.ac:28: -1- AC_SUBST([LD]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([LD]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LD$]) m4trace:configure.ac:28: -1- AC_SUBST([DUMPBIN]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([DUMPBIN]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DUMPBIN$]) m4trace:configure.ac:28: -1- AC_SUBST([ac_ct_DUMPBIN]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([ac_ct_DUMPBIN]) m4trace:configure.ac:28: -1- m4_pattern_allow([^ac_ct_DUMPBIN$]) m4trace:configure.ac:28: -1- AC_SUBST([DUMPBIN]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([DUMPBIN]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DUMPBIN$]) m4trace:configure.ac:28: -1- AC_SUBST([NM]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([NM]) m4trace:configure.ac:28: -1- m4_pattern_allow([^NM$]) m4trace:configure.ac:28: -1- AC_SUBST([LN_S], [$as_ln_s]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([LN_S]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LN_S$]) m4trace:configure.ac:28: -1- AC_SUBST([OBJDUMP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([OBJDUMP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OBJDUMP$]) m4trace:configure.ac:28: -1- AC_SUBST([OBJDUMP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([OBJDUMP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OBJDUMP$]) m4trace:configure.ac:28: -1- AC_SUBST([DLLTOOL]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([DLLTOOL]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DLLTOOL$]) m4trace:configure.ac:28: -1- AC_SUBST([DLLTOOL]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([DLLTOOL]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DLLTOOL$]) m4trace:configure.ac:28: -1- AC_SUBST([AR]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([AR]) m4trace:configure.ac:28: -1- m4_pattern_allow([^AR$]) m4trace:configure.ac:28: -1- AC_SUBST([ac_ct_AR]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([ac_ct_AR]) m4trace:configure.ac:28: -1- m4_pattern_allow([^ac_ct_AR$]) m4trace:configure.ac:28: -1- AC_SUBST([STRIP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([STRIP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^STRIP$]) m4trace:configure.ac:28: -1- AC_SUBST([RANLIB]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([RANLIB]) m4trace:configure.ac:28: -1- m4_pattern_allow([^RANLIB$]) m4trace:configure.ac:28: -1- m4_pattern_allow([LT_OBJDIR]) m4trace:configure.ac:28: -1- AC_DEFINE_TRACE_LITERAL([LT_OBJDIR]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LT_OBJDIR$]) m4trace:configure.ac:28: -1- AH_OUTPUT([LT_OBJDIR], [/* Define to the sub-directory in which libtool stores uninstalled libraries. */ @%:@undef LT_OBJDIR]) m4trace:configure.ac:28: -1- LT_SUPPORTED_TAG([CC]) m4trace:configure.ac:28: -1- AC_SUBST([MANIFEST_TOOL]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([MANIFEST_TOOL]) m4trace:configure.ac:28: -1- m4_pattern_allow([^MANIFEST_TOOL$]) m4trace:configure.ac:28: -1- AC_SUBST([DSYMUTIL]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([DSYMUTIL]) m4trace:configure.ac:28: -1- m4_pattern_allow([^DSYMUTIL$]) m4trace:configure.ac:28: -1- AC_SUBST([NMEDIT]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([NMEDIT]) m4trace:configure.ac:28: -1- m4_pattern_allow([^NMEDIT$]) m4trace:configure.ac:28: -1- AC_SUBST([LIPO]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([LIPO]) m4trace:configure.ac:28: -1- m4_pattern_allow([^LIPO$]) m4trace:configure.ac:28: -1- AC_SUBST([OTOOL]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([OTOOL]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OTOOL$]) m4trace:configure.ac:28: -1- AC_SUBST([OTOOL64]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([OTOOL64]) m4trace:configure.ac:28: -1- m4_pattern_allow([^OTOOL64$]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_DLFCN_H]) m4trace:configure.ac:28: -1- AC_SUBST([CPP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CPP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^CPP$]) m4trace:configure.ac:28: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CPPFLAGS]) m4trace:configure.ac:28: -1- m4_pattern_allow([^CPPFLAGS$]) m4trace:configure.ac:28: -1- AC_SUBST([CPP]) m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CPP]) m4trace:configure.ac:28: -1- m4_pattern_allow([^CPP$]) m4trace:configure.ac:28: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) m4trace:configure.ac:28: -1- m4_pattern_allow([^STDC_HEADERS$]) m4trace:configure.ac:28: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ @%:@undef STDC_HEADERS]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_TYPES_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_STAT_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDLIB_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STRING_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_MEMORY_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STRINGS_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_INTTYPES_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDINT_H]) m4trace:configure.ac:28: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_UNISTD_H]) m4trace:configure.ac:28: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DLFCN_H]) m4trace:configure.ac:28: -1- m4_pattern_allow([^HAVE_DLFCN_H$]) m4trace:configure.ac:29: -1- AC_SUBST([PERL]) m4trace:configure.ac:29: -1- AC_SUBST_TRACE([PERL]) m4trace:configure.ac:29: -1- m4_pattern_allow([^PERL$]) m4trace:configure.ac:30: -1- AC_SUBST([PYTHON]) m4trace:configure.ac:30: -1- AC_SUBST_TRACE([PYTHON]) m4trace:configure.ac:30: -1- m4_pattern_allow([^PYTHON$]) m4trace:configure.ac:34: -1- LT_INIT m4trace:configure.ac:35: -1- AC_SUBST([LIBTOOL_DEPS]) m4trace:configure.ac:35: -1- AC_SUBST_TRACE([LIBTOOL_DEPS]) m4trace:configure.ac:35: -1- m4_pattern_allow([^LIBTOOL_DEPS$]) m4trace:configure.ac:36: -1- AC_SUBST([PERL]) m4trace:configure.ac:36: -1- AC_SUBST_TRACE([PERL]) m4trace:configure.ac:36: -1- m4_pattern_allow([^PERL$]) m4trace:configure.ac:37: -1- AC_SUBST([PYTHON]) m4trace:configure.ac:37: -1- AC_SUBST_TRACE([PYTHON]) m4trace:configure.ac:37: -1- m4_pattern_allow([^PYTHON$]) m4trace:configure.ac:40: -1- AC_CANONICAL_HOST m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([size_t]) m4trace:configure.ac:63: -1- m4_pattern_allow([^size_t$]) m4trace:configure.ac:63: -1- AH_OUTPUT([size_t], [/* Define to `unsigned int\' if does not define. */ @%:@undef size_t]) m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA_H]) m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_ALLOCA_H$]) m4trace:configure.ac:63: -1- AH_OUTPUT([HAVE_ALLOCA_H], [/* Define to 1 if you have and it should be used (not on Ultrix). */ @%:@undef HAVE_ALLOCA_H]) m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA]) m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_ALLOCA$]) m4trace:configure.ac:63: -1- AH_OUTPUT([HAVE_ALLOCA], [/* Define to 1 if you have `alloca\', as a function or macro. */ @%:@undef HAVE_ALLOCA]) m4trace:configure.ac:63: -1- AC_LIBSOURCE([alloca.c]) m4trace:configure.ac:63: -1- AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext]) m4trace:configure.ac:63: -1- AC_SUBST_TRACE([ALLOCA]) m4trace:configure.ac:63: -1- m4_pattern_allow([^ALLOCA$]) m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([C_ALLOCA]) m4trace:configure.ac:63: -1- m4_pattern_allow([^C_ALLOCA$]) m4trace:configure.ac:63: -1- AH_OUTPUT([C_ALLOCA], [/* Define to 1 if using `alloca.c\'. */ @%:@undef C_ALLOCA]) m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([CRAY_STACKSEG_END]) m4trace:configure.ac:63: -1- m4_pattern_allow([^CRAY_STACKSEG_END$]) m4trace:configure.ac:63: -1- AH_OUTPUT([CRAY_STACKSEG_END], [/* Define to one of `_getb67\', `GETB67\', `getb67\' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c\' support on those systems. */ @%:@undef CRAY_STACKSEG_END]) m4trace:configure.ac:63: -1- AH_OUTPUT([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @%:@undef STACK_DIRECTION]) m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([STACK_DIRECTION]) m4trace:configure.ac:63: -1- m4_pattern_allow([^STACK_DIRECTION$]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_ARPA_INET_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_ARPA_INET_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_FCNTL_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_FLOAT_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_FLOAT_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_INTTYPES_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_LIBINTL_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_LIBINTL_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_LIMITS_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_LIMITS_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_LOCALE_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_LOCALE_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_MALLOC_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_MALLOC_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_MEMORY_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_NETDB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_NETDB_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_NETINET_IN_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_STDDEF_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDDEF_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDINT_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDLIB_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STRING_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STRINGS_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_IOCTL_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_PARAM_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_SOCKET_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_TIME_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SYS_TIMEB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_TIMEB_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SYSLOG_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYSLOG_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_UNISTD_H]) m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_WCHAR_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_WCHAR_H]) m4trace:configure.ac:67: -1- AC_DEFINE_TRACE_LITERAL([HAVE__BOOL]) m4trace:configure.ac:67: -1- m4_pattern_allow([^HAVE__BOOL$]) m4trace:configure.ac:67: -1- AH_OUTPUT([HAVE__BOOL], [/* Define to 1 if the system has the type `_Bool\'. */ @%:@undef HAVE__BOOL]) m4trace:configure.ac:67: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STDBOOL_H]) m4trace:configure.ac:67: -1- m4_pattern_allow([^HAVE_STDBOOL_H$]) m4trace:configure.ac:67: -1- AH_OUTPUT([HAVE_STDBOOL_H], [/* Define to 1 if stdbool.h conforms to C99. */ @%:@undef HAVE_STDBOOL_H]) m4trace:configure.ac:68: -1- AC_DEFINE_TRACE_LITERAL([uid_t]) m4trace:configure.ac:68: -1- m4_pattern_allow([^uid_t$]) m4trace:configure.ac:68: -1- AH_OUTPUT([uid_t], [/* Define to `int\' if doesn\'t define. */ @%:@undef uid_t]) m4trace:configure.ac:68: -1- AC_DEFINE_TRACE_LITERAL([gid_t]) m4trace:configure.ac:68: -1- m4_pattern_allow([^gid_t$]) m4trace:configure.ac:68: -1- AH_OUTPUT([gid_t], [/* Define to `int\' if doesn\'t define. */ @%:@undef gid_t]) m4trace:configure.ac:69: -1- AH_OUTPUT([inline], [/* Define to `__inline__\' or `__inline\' if that\'s what the C compiler calls it, or to nothing if \'inline\' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif]) m4trace:configure.ac:70: -1- AC_DEFINE_TRACE_LITERAL([int16_t]) m4trace:configure.ac:70: -1- m4_pattern_allow([^int16_t$]) m4trace:configure.ac:70: -1- AH_OUTPUT([int16_t], [/* Define to the type of a signed integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ @%:@undef int16_t]) m4trace:configure.ac:71: -1- AC_DEFINE_TRACE_LITERAL([int32_t]) m4trace:configure.ac:71: -1- m4_pattern_allow([^int32_t$]) m4trace:configure.ac:71: -1- AH_OUTPUT([int32_t], [/* Define to the type of a signed integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ @%:@undef int32_t]) m4trace:configure.ac:72: -1- AC_DEFINE_TRACE_LITERAL([int64_t]) m4trace:configure.ac:72: -1- m4_pattern_allow([^int64_t$]) m4trace:configure.ac:72: -1- AH_OUTPUT([int64_t], [/* Define to the type of a signed integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ @%:@undef int64_t]) m4trace:configure.ac:73: -1- AC_DEFINE_TRACE_LITERAL([int8_t]) m4trace:configure.ac:73: -1- m4_pattern_allow([^int8_t$]) m4trace:configure.ac:73: -1- AH_OUTPUT([int8_t], [/* Define to the type of a signed integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ @%:@undef int8_t]) m4trace:configure.ac:74: -1- AC_DEFINE_TRACE_LITERAL([mode_t]) m4trace:configure.ac:74: -1- m4_pattern_allow([^mode_t$]) m4trace:configure.ac:74: -1- AH_OUTPUT([mode_t], [/* Define to `int\' if does not define. */ @%:@undef mode_t]) m4trace:configure.ac:75: -1- AH_OUTPUT([restrict], [/* Define to the equivalent of the C99 \'restrict\' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict /* Work around a bug in Sun C++: it does not support _Restrict or __restrict__, even though the corresponding Sun C compiler ends up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. Perhaps some future version of Sun C++ will work with restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict # define __restrict__ #endif]) m4trace:configure.ac:75: -1- AC_DEFINE_TRACE_LITERAL([restrict]) m4trace:configure.ac:75: -1- m4_pattern_allow([^restrict$]) m4trace:configure.ac:75: -1- AC_DEFINE_TRACE_LITERAL([restrict]) m4trace:configure.ac:75: -1- m4_pattern_allow([^restrict$]) m4trace:configure.ac:76: -1- AC_DEFINE_TRACE_LITERAL([size_t]) m4trace:configure.ac:76: -1- m4_pattern_allow([^size_t$]) m4trace:configure.ac:76: -1- AH_OUTPUT([size_t], [/* Define to `unsigned int\' if does not define. */ @%:@undef size_t]) m4trace:configure.ac:77: -1- AC_DEFINE_TRACE_LITERAL([ssize_t]) m4trace:configure.ac:77: -1- m4_pattern_allow([^ssize_t$]) m4trace:configure.ac:77: -1- AH_OUTPUT([ssize_t], [/* Define to `int\' if does not define. */ @%:@undef ssize_t]) m4trace:configure.ac:78: -1- AC_DEFINE_TRACE_LITERAL([uint16_t]) m4trace:configure.ac:78: -1- m4_pattern_allow([^uint16_t$]) m4trace:configure.ac:78: -1- AH_OUTPUT([uint16_t], [/* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ @%:@undef uint16_t]) m4trace:configure.ac:79: -1- AC_DEFINE_TRACE_LITERAL([_UINT32_T]) m4trace:configure.ac:79: -1- m4_pattern_allow([^_UINT32_T$]) m4trace:configure.ac:79: -1- AH_OUTPUT([_UINT32_T], [/* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the @%:@define below would cause a syntax error. */ @%:@undef _UINT32_T]) m4trace:configure.ac:79: -1- AC_DEFINE_TRACE_LITERAL([uint32_t]) m4trace:configure.ac:79: -1- m4_pattern_allow([^uint32_t$]) m4trace:configure.ac:79: -1- AH_OUTPUT([uint32_t], [/* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ @%:@undef uint32_t]) m4trace:configure.ac:80: -1- AC_DEFINE_TRACE_LITERAL([_UINT64_T]) m4trace:configure.ac:80: -1- m4_pattern_allow([^_UINT64_T$]) m4trace:configure.ac:80: -1- AH_OUTPUT([_UINT64_T], [/* Define for Solaris 2.5.1 so the uint64_t typedef from , , or is not used. If the typedef were allowed, the @%:@define below would cause a syntax error. */ @%:@undef _UINT64_T]) m4trace:configure.ac:80: -1- AC_DEFINE_TRACE_LITERAL([uint64_t]) m4trace:configure.ac:80: -1- m4_pattern_allow([^uint64_t$]) m4trace:configure.ac:80: -1- AH_OUTPUT([uint64_t], [/* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ @%:@undef uint64_t]) m4trace:configure.ac:81: -1- AC_DEFINE_TRACE_LITERAL([_UINT8_T]) m4trace:configure.ac:81: -1- m4_pattern_allow([^_UINT8_T$]) m4trace:configure.ac:81: -1- AH_OUTPUT([_UINT8_T], [/* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the @%:@define below would cause a syntax error. */ @%:@undef _UINT8_T]) m4trace:configure.ac:81: -1- AC_DEFINE_TRACE_LITERAL([uint8_t]) m4trace:configure.ac:81: -1- m4_pattern_allow([^uint8_t$]) m4trace:configure.ac:81: -1- AH_OUTPUT([uint8_t], [/* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ @%:@undef uint8_t]) m4trace:configure.ac:86: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDLIB_H]) m4trace:configure.ac:86: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STDLIB_H]) m4trace:configure.ac:86: -1- m4_pattern_allow([^HAVE_STDLIB_H$]) m4trace:configure.ac:86: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MALLOC]) m4trace:configure.ac:86: -1- m4_pattern_allow([^HAVE_MALLOC$]) m4trace:configure.ac:86: -1- AH_OUTPUT([HAVE_MALLOC], [/* Define to 1 if your system has a GNU libc compatible `malloc\' function, and to 0 otherwise. */ @%:@undef HAVE_MALLOC]) m4trace:configure.ac:86: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MALLOC]) m4trace:configure.ac:86: -1- m4_pattern_allow([^HAVE_MALLOC$]) m4trace:configure.ac:86: -1- AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS malloc.$ac_objext"]) m4trace:configure.ac:86: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) m4trace:configure.ac:86: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.ac:86: -1- AC_LIBSOURCE([malloc.c]) m4trace:configure.ac:86: -1- AC_DEFINE_TRACE_LITERAL([malloc]) m4trace:configure.ac:86: -1- m4_pattern_allow([^malloc$]) m4trace:configure.ac:86: -1- AH_OUTPUT([malloc], [/* Define to rpl_malloc if the replacement function should be used. */ @%:@undef malloc]) m4trace:configure.ac:87: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDLIB_H]) m4trace:configure.ac:87: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_UNISTD_H]) m4trace:configure.ac:87: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_PARAM_H]) m4trace:configure.ac:87: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ @%:@undef HAVE_GETPAGESIZE]) m4trace:configure.ac:87: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPAGESIZE]) m4trace:configure.ac:87: -1- m4_pattern_allow([^HAVE_GETPAGESIZE$]) m4trace:configure.ac:87: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MMAP]) m4trace:configure.ac:87: -1- m4_pattern_allow([^HAVE_MMAP$]) m4trace:configure.ac:87: -1- AH_OUTPUT([HAVE_MMAP], [/* Define to 1 if you have a working `mmap\' system call. */ @%:@undef HAVE_MMAP]) m4trace:configure.ac:88: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDLIB_H]) m4trace:configure.ac:88: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STDLIB_H]) m4trace:configure.ac:88: -1- m4_pattern_allow([^HAVE_STDLIB_H$]) m4trace:configure.ac:88: -1- AC_DEFINE_TRACE_LITERAL([HAVE_REALLOC]) m4trace:configure.ac:88: -1- m4_pattern_allow([^HAVE_REALLOC$]) m4trace:configure.ac:88: -1- AH_OUTPUT([HAVE_REALLOC], [/* Define to 1 if your system has a GNU libc compatible `realloc\' function, and to 0 otherwise. */ @%:@undef HAVE_REALLOC]) m4trace:configure.ac:88: -1- AC_DEFINE_TRACE_LITERAL([HAVE_REALLOC]) m4trace:configure.ac:88: -1- m4_pattern_allow([^HAVE_REALLOC$]) m4trace:configure.ac:88: -1- AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS realloc.$ac_objext"]) m4trace:configure.ac:88: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) m4trace:configure.ac:88: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.ac:88: -1- AC_LIBSOURCE([realloc.c]) m4trace:configure.ac:88: -1- AC_DEFINE_TRACE_LITERAL([realloc]) m4trace:configure.ac:88: -1- m4_pattern_allow([^realloc$]) m4trace:configure.ac:88: -1- AH_OUTPUT([realloc], [/* Define to rpl_realloc if the replacement function should be used. */ @%:@undef realloc]) m4trace:configure.ac:89: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRERROR_R]) m4trace:configure.ac:89: -1- m4_pattern_allow([^HAVE_DECL_STRERROR_R$]) m4trace:configure.ac:89: -1- AH_OUTPUT([HAVE_DECL_STRERROR_R], [/* Define to 1 if you have the declaration of `strerror_r\', and to 0 if you don\'t. */ @%:@undef HAVE_DECL_STRERROR_R]) m4trace:configure.ac:89: -1- AH_OUTPUT([HAVE_STRERROR_R], [/* Define to 1 if you have the `strerror_r\' function. */ @%:@undef HAVE_STRERROR_R]) m4trace:configure.ac:89: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRERROR_R]) m4trace:configure.ac:89: -1- m4_pattern_allow([^HAVE_STRERROR_R$]) m4trace:configure.ac:89: -1- AC_DEFINE_TRACE_LITERAL([STRERROR_R_CHAR_P]) m4trace:configure.ac:89: -1- m4_pattern_allow([^STRERROR_R_CHAR_P$]) m4trace:configure.ac:89: -1- AH_OUTPUT([STRERROR_R_CHAR_P], [/* Define to 1 if strerror_r returns char *. */ @%:@undef STRERROR_R_CHAR_P]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_ATEXIT], [/* Define to 1 if you have the `atexit\' function. */ @%:@undef HAVE_ATEXIT]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_CLOCK_GETTIME], [/* Define to 1 if you have the `clock_gettime\' function. */ @%:@undef HAVE_CLOCK_GETTIME]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_FLOOR], [/* Define to 1 if you have the `floor\' function. */ @%:@undef HAVE_FLOOR]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_FTIME], [/* Define to 1 if you have the `ftime\' function. */ @%:@undef HAVE_FTIME]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_GETHOSTBYADDR], [/* Define to 1 if you have the `gethostbyaddr\' function. */ @%:@undef HAVE_GETHOSTBYADDR]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_GETHOSTBYNAME], [/* Define to 1 if you have the `gethostbyname\' function. */ @%:@undef HAVE_GETHOSTBYNAME]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_GETHOSTNAME], [/* Define to 1 if you have the `gethostname\' function. */ @%:@undef HAVE_GETHOSTNAME]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_GETTIMEOFDAY], [/* Define to 1 if you have the `gettimeofday\' function. */ @%:@undef HAVE_GETTIMEOFDAY]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_INET_NTOA], [/* Define to 1 if you have the `inet_ntoa\' function. */ @%:@undef HAVE_INET_NTOA]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_MEMMOVE], [/* Define to 1 if you have the `memmove\' function. */ @%:@undef HAVE_MEMMOVE]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the `memset\' function. */ @%:@undef HAVE_MEMSET]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_REGCOMP], [/* Define to 1 if you have the `regcomp\' function. */ @%:@undef HAVE_REGCOMP]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_SELECT], [/* Define to 1 if you have the `select\' function. */ @%:@undef HAVE_SELECT]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_SETENV], [/* Define to 1 if you have the `setenv\' function. */ @%:@undef HAVE_SETENV]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_SETLOCALE], [/* Define to 1 if you have the `setlocale\' function. */ @%:@undef HAVE_SETLOCALE]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_SOCKET], [/* Define to 1 if you have the `socket\' function. */ @%:@undef HAVE_SOCKET]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_SQRT], [/* Define to 1 if you have the `sqrt\' function. */ @%:@undef HAVE_SQRT]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STPCPY], [/* Define to 1 if you have the `stpcpy\' function. */ @%:@undef HAVE_STPCPY]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRCASECMP], [/* Define to 1 if you have the `strcasecmp\' function. */ @%:@undef HAVE_STRCASECMP]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRCHR], [/* Define to 1 if you have the `strchr\' function. */ @%:@undef HAVE_STRCHR]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRDUP], [/* Define to 1 if you have the `strdup\' function. */ @%:@undef HAVE_STRDUP]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRERROR], [/* Define to 1 if you have the `strerror\' function. */ @%:@undef HAVE_STRERROR]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRNCASECMP], [/* Define to 1 if you have the `strncasecmp\' function. */ @%:@undef HAVE_STRNCASECMP]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRPBRK], [/* Define to 1 if you have the `strpbrk\' function. */ @%:@undef HAVE_STRPBRK]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRRCHR], [/* Define to 1 if you have the `strrchr\' function. */ @%:@undef HAVE_STRRCHR]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRSTR], [/* Define to 1 if you have the `strstr\' function. */ @%:@undef HAVE_STRSTR]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRTOL], [/* Define to 1 if you have the `strtol\' function. */ @%:@undef HAVE_STRTOL]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRTOUL], [/* Define to 1 if you have the `strtoul\' function. */ @%:@undef HAVE_STRTOUL]) m4trace:configure.ac:90: -1- AH_OUTPUT([HAVE_STRTOULL], [/* Define to 1 if you have the `strtoull\' function. */ @%:@undef HAVE_STRTOULL]) m4trace:configure.ac:149: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [../../lib/autoconf/general.m4:2778: AC_CHECK_FILE is expanded from... configure.ac:149: the top level]) m4trace:configure.ac:157: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [../../lib/autoconf/general.m4:2778: AC_CHECK_FILE is expanded from... configure.ac:157: the top level]) m4trace:configure.ac:173: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [../../lib/autoconf/general.m4:2778: AC_CHECK_FILE is expanded from... configure.ac:173: the top level]) m4trace:configure.ac:276: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from... configure.ac:276: the top level]) m4trace:configure.ac:307: -1- AC_CONFIG_FILES([Makefile openpgm-${RELEASE_INFO}.pc openpgm.spec]) m4trace:configure.ac:308: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) m4trace:configure.ac:308: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.ac:308: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([LTLIBOBJS]) m4trace:configure.ac:308: -1- m4_pattern_allow([^LTLIBOBJS$]) m4trace:configure.ac:308: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) m4trace:configure.ac:308: -1- AC_SUBST([am__EXEEXT_TRUE]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([am__EXEEXT_TRUE]) m4trace:configure.ac:308: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) m4trace:configure.ac:308: -1- AC_SUBST([am__EXEEXT_FALSE]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([am__EXEEXT_FALSE]) m4trace:configure.ac:308: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) m4trace:configure.ac:308: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) m4trace:configure.ac:308: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([top_builddir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([top_build_prefix]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([srcdir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([abs_srcdir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([top_srcdir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([abs_top_srcdir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([builddir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([abs_builddir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([abs_top_builddir]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([INSTALL]) m4trace:configure.ac:308: -1- AC_SUBST_TRACE([MKDIR_P]) m4trace:configure.ac:308: -1- AC_REQUIRE_AUX_FILE([ltmain.sh]) libpgm-5.1.118-1~dfsg/openpgm/pgm/autom4te.cache/requests0000644000175000017500000003320211644640134022144 0ustar locallocal# This file was generated by Autom4te Sat Apr 9 10:01:39 PDT 2011. # It contains the lists of macros which have been traced. # It can be safely removed. @request = ( bless( [ '0', 1, [ '/usr/share/autoconf' ], [ '/usr/share/autoconf/autoconf/autoconf.m4f', '/usr/share/aclocal/argz.m4', '/usr/share/aclocal/libtool.m4', '/usr/share/aclocal/ltdl.m4', '/usr/share/aclocal/ltoptions.m4', '/usr/share/aclocal/ltsugar.m4', '/usr/share/aclocal/ltversion.m4', '/usr/share/aclocal/lt~obsolete.m4', '/usr/share/aclocal-1.11/amversion.m4', '/usr/share/aclocal-1.11/auxdir.m4', '/usr/share/aclocal-1.11/cond.m4', '/usr/share/aclocal-1.11/depend.m4', '/usr/share/aclocal-1.11/depout.m4', '/usr/share/aclocal-1.11/init.m4', '/usr/share/aclocal-1.11/install-sh.m4', '/usr/share/aclocal-1.11/lead-dot.m4', '/usr/share/aclocal-1.11/make.m4', '/usr/share/aclocal-1.11/missing.m4', '/usr/share/aclocal-1.11/mkdirp.m4', '/usr/share/aclocal-1.11/options.m4', '/usr/share/aclocal-1.11/runlog.m4', '/usr/share/aclocal-1.11/sanity.m4', '/usr/share/aclocal-1.11/silent.m4', '/usr/share/aclocal-1.11/strip.m4', '/usr/share/aclocal-1.11/substnot.m4', '/usr/share/aclocal-1.11/tar.m4', 'configure.ac' ], { 'AM_ENABLE_STATIC' => 1, 'AC_LIBTOOL_LANG_RC_CONFIG' => 1, '_LT_AC_SHELL_INIT' => 1, 'AC_DEFUN' => 1, 'AC_PROG_LIBTOOL' => 1, '_LT_AC_LANG_CXX_CONFIG' => 1, 'AM_PROG_MKDIR_P' => 1, 'AM_AUTOMAKE_VERSION' => 1, 'AM_SUBST_NOTMAKE' => 1, 'AM_MISSING_PROG' => 1, 'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1, '_LT_AC_LANG_C_CONFIG' => 1, 'AM_PROG_INSTALL_STRIP' => 1, '_m4_warn' => 1, 'AC_LIBTOOL_OBJDIR' => 1, 'gl_FUNC_ARGZ' => 1, 'AM_SANITY_CHECK' => 1, 'LTOBSOLETE_VERSION' => 1, 'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1, 'AC_LIBTOOL_PROG_COMPILER_PIC' => 1, 'LT_LIB_M' => 1, '_LT_AC_CHECK_DLFCN' => 1, 'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1, 'LTSUGAR_VERSION' => 1, '_LT_PROG_LTMAIN' => 1, 'LT_SYS_SYMBOL_USCORE' => 1, '_AM_PROG_TAR' => 1, 'AC_LIBTOOL_GCJ' => 1, '_LT_WITH_SYSROOT' => 1, 'LT_SYS_DLOPEN_DEPLIBS' => 1, 'LT_FUNC_DLSYM_USCORE' => 1, '_LT_AC_LANG_F77' => 1, 'AC_LIBTOOL_CONFIG' => 1, 'AC_LTDL_DLLIB' => 1, '_AM_SUBST_NOTMAKE' => 1, '_AM_AUTOCONF_VERSION' => 1, 'AM_DISABLE_SHARED' => 1, '_LT_PROG_ECHO_BACKSLASH' => 1, '_LTDL_SETUP' => 1, 'AM_PROG_LIBTOOL' => 1, '_LT_AC_LANG_CXX' => 1, 'AM_PROG_LD' => 1, '_LT_AC_FILE_LTDLL_C' => 1, 'AC_LIB_LTDL' => 1, 'AU_DEFUN' => 1, 'AC_PROG_NM' => 1, 'AC_LIBTOOL_DLOPEN' => 1, 'AC_PROG_LD' => 1, 'AC_PROG_LD_GNU' => 1, 'AC_ENABLE_FAST_INSTALL' => 1, 'AC_LIBTOOL_FC' => 1, 'LTDL_CONVENIENCE' => 1, '_AM_SET_OPTION' => 1, 'AC_LTDL_PREOPEN' => 1, '_LT_LINKER_BOILERPLATE' => 1, '_LT_PREPARE_SED_QUOTE_VARS' => 1, 'AC_LIBTOOL_LANG_CXX_CONFIG' => 1, 'AC_LIBTOOL_PROG_CC_C_O' => 1, 'gl_PREREQ_ARGZ' => 1, 'LT_SUPPORTED_TAG' => 1, 'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, 'LT_PROG_RC' => 1, 'LT_SYS_MODULE_EXT' => 1, 'AC_DEFUN_ONCE' => 1, '_LT_AC_LANG_GCJ' => 1, 'AC_LTDL_OBJDIR' => 1, '_LT_PATH_TOOL_PREFIX' => 1, 'AC_LIBTOOL_RC' => 1, '_LT_AC_PROG_ECHO_BACKSLASH' => 1, 'AC_DISABLE_FAST_INSTALL' => 1, 'AM_SILENT_RULES' => 1, 'include' => 1, '_LT_AC_TRY_DLOPEN_SELF' => 1, '_LT_AC_SYS_LIBPATH_AIX' => 1, 'LT_AC_PROG_SED' => 1, 'AM_ENABLE_SHARED' => 1, 'LTDL_INSTALLABLE' => 1, '_LT_AC_LANG_GCJ_CONFIG' => 1, 'AC_ENABLE_SHARED' => 1, '_LT_REQUIRED_DARWIN_CHECKS' => 1, 'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1, 'AC_ENABLE_STATIC' => 1, '_LT_AC_TAGVAR' => 1, 'AC_LIBTOOL_LANG_F77_CONFIG' => 1, 'AM_CONDITIONAL' => 1, 'LT_LIB_DLLOAD' => 1, 'LTVERSION_VERSION' => 1, '_LT_PROG_CXX' => 1, '_LT_PROG_F77' => 1, 'LTDL_INIT' => 1, 'm4_include' => 1, 'AM_PROG_INSTALL_SH' => 1, 'AC_PROG_EGREP' => 1, 'AC_PATH_MAGIC' => 1, '_AC_AM_CONFIG_HEADER_HOOK' => 1, 'AC_LTDL_SYSSEARCHPATH' => 1, 'AM_MAKE_INCLUDE' => 1, 'LT_CMD_MAX_LEN' => 1, '_LT_AC_TAGCONFIG' => 1, 'm4_pattern_forbid' => 1, '_LT_LINKER_OPTION' => 1, 'AC_LIBTOOL_COMPILER_OPTION' => 1, 'AC_DISABLE_SHARED' => 1, '_LT_COMPILER_BOILERPLATE' => 1, 'AC_LIBTOOL_WIN32_DLL' => 1, 'AC_LIBTOOL_SETUP' => 1, 'AC_PROG_LD_RELOAD_FLAG' => 1, 'AC_LTDL_DLSYM_USCORE' => 1, 'AM_MISSING_HAS_RUN' => 1, 'LT_LANG' => 1, 'LT_SYS_DLSEARCH_PATH' => 1, 'LT_CONFIG_LTDL_DIR' => 1, 'AC_LIBTOOL_DLOPEN_SELF' => 1, 'LT_OUTPUT' => 1, 'AC_LIBTOOL_PROG_LD_SHLIBS' => 1, 'AC_WITH_LTDL' => 1, 'AC_LIBTOOL_LINKER_OPTION' => 1, 'LT_AC_PROG_RC' => 1, 'AC_LIBTOOL_CXX' => 1, 'LT_INIT' => 1, 'LT_AC_PROG_GCJ' => 1, 'LT_SYS_DLOPEN_SELF' => 1, 'AM_DEP_TRACK' => 1, 'AM_DISABLE_STATIC' => 1, '_LT_AC_PROG_CXXCPP' => 1, '_AC_PROG_LIBTOOL' => 1, '_AM_IF_OPTION' => 1, 'AC_PATH_TOOL_PREFIX' => 1, 'm4_pattern_allow' => 1, 'AC_LIBTOOL_F77' => 1, 'AM_SET_LEADING_DOT' => 1, '_LT_PROG_FC' => 1, 'LT_AC_PROG_EGREP' => 1, '_AM_DEPENDENCIES' => 1, 'AC_LIBTOOL_LANG_C_CONFIG' => 1, 'LTOPTIONS_VERSION' => 1, '_LT_AC_SYS_COMPILER' => 1, 'AM_PROG_NM' => 1, 'AC_LIBLTDL_CONVENIENCE' => 1, 'AC_DEPLIBS_CHECK_METHOD' => 1, 'AC_LIBLTDL_INSTALLABLE' => 1, 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, 'AC_LTDL_ENABLE_INSTALL' => 1, 'LT_PROG_GCJ' => 1, 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1, 'AM_INIT_AUTOMAKE' => 1, 'AC_DISABLE_STATIC' => 1, 'LT_PATH_NM' => 1, 'AC_LTDL_SHLIBEXT' => 1, '_LT_AC_LOCK' => 1, '_LT_AC_LANG_RC_CONFIG' => 1, 'LT_SYS_MODULE_PATH' => 1, 'LT_WITH_LTDL' => 1, 'AC_LIBTOOL_POSTDEP_PREDEP' => 1, 'AC_LTDL_SHLIBPATH' => 1, 'AM_AUX_DIR_EXPAND' => 1, 'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1, '_LT_AC_LANG_F77_CONFIG' => 1, '_LT_COMPILER_OPTION' => 1, '_AM_SET_OPTIONS' => 1, 'AM_RUN_LOG' => 1, '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, 'AC_LIBTOOL_PICMODE' => 1, 'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1, 'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1, 'AC_CHECK_LIBM' => 1, 'LT_PATH_LD' => 1, 'AC_LIBTOOL_SYS_LIB_STRIP' => 1, '_AM_MANGLE_OPTION' => 1, 'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1, 'AC_LTDL_SYMBOL_USCORE' => 1, 'AM_SET_DEPDIR' => 1, '_LT_CC_BASENAME' => 1, '_LT_LIBOBJ' => 1 } ], 'Autom4te::Request' ), bless( [ '1', 1, [ '/usr/share/autoconf' ], [ '/usr/share/autoconf/autoconf/autoconf.m4f', 'aclocal.m4', 'configure.ac' ], { '_LT_AC_TAGCONFIG' => 1, 'AM_PROG_F77_C_O' => 1, 'AC_INIT' => 1, 'm4_pattern_forbid' => 1, 'AC_CANONICAL_TARGET' => 1, '_AM_COND_IF' => 1, 'AC_CONFIG_LIBOBJ_DIR' => 1, 'AC_SUBST' => 1, 'AC_CANONICAL_HOST' => 1, 'AC_FC_SRCEXT' => 1, 'AC_PROG_LIBTOOL' => 1, 'AM_INIT_AUTOMAKE' => 1, 'AC_CONFIG_SUBDIRS' => 1, 'AM_PATH_GUILE' => 1, 'AM_AUTOMAKE_VERSION' => 1, 'LT_CONFIG_LTDL_DIR' => 1, 'AC_CONFIG_LINKS' => 1, 'AC_REQUIRE_AUX_FILE' => 1, 'm4_sinclude' => 1, 'LT_SUPPORTED_TAG' => 1, 'AM_MAINTAINER_MODE' => 1, 'AM_NLS' => 1, 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, '_m4_warn' => 1, 'AM_MAKEFILE_INCLUDE' => 1, 'AM_PROG_CXX_C_O' => 1, '_AM_COND_ENDIF' => 1, '_AM_MAKEFILE_INCLUDE' => 1, 'AM_ENABLE_MULTILIB' => 1, 'AM_PROG_MOC' => 1, 'AM_SILENT_RULES' => 1, 'AC_CONFIG_FILES' => 1, 'include' => 1, 'LT_INIT' => 1, 'AM_GNU_GETTEXT' => 1, 'AM_PROG_AR' => 1, 'AC_LIBSOURCE' => 1, 'AC_CANONICAL_BUILD' => 1, 'AM_PROG_FC_C_O' => 1, 'AC_FC_FREEFORM' => 1, 'AH_OUTPUT' => 1, 'AC_CONFIG_AUX_DIR' => 1, '_AM_SUBST_NOTMAKE' => 1, 'AM_PROG_CC_C_O' => 1, 'sinclude' => 1, 'm4_pattern_allow' => 1, 'AM_CONDITIONAL' => 1, 'AC_CANONICAL_SYSTEM' => 1, 'AM_XGETTEXT_OPTION' => 1, 'AC_CONFIG_HEADERS' => 1, 'AC_DEFINE_TRACE_LITERAL' => 1, 'AM_POT_TOOLS' => 1, 'm4_include' => 1, '_AM_COND_ELSE' => 1, 'AC_SUBST_TRACE' => 1 } ], 'Autom4te::Request' ) ); libpgm-5.1.118-1~dfsg/openpgm/pgm/math.c.c89.patch0000644000175000017500000000060711640407354020343 0ustar locallocal--- math.c 2010-05-21 11:32:22.000000000 +0800 +++ math.c89 2010-10-06 17:37:25.000000000 +0800 @@ -66,9 +66,12 @@ unsigned pgm_spaced_primes_closest (unsigned num) { - for (unsigned i = 0; i < PGM_N_ELEMENTS(primes); i++) + { + unsigned i; + for (i = 0; i < PGM_N_ELEMENTS(primes); i++) if (primes[i] > num) return primes[i]; + } return primes[PGM_N_ELEMENTS(primes) - 1]; } libpgm-5.1.118-1~dfsg/openpgm/pgm/getifaddrs_unittest.c0000644000175000017500000001377211640407354021774 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for portable getifaddrs implementation. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* IFF_UP */ #define _BSD_SOURCE 1 #include #include #include #include #include #include #ifndef _WIN32 # include # include #endif #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ #define GETIFADDRS_DEBUG #include "getifaddrs.c" /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } char* ifflags_string ( unsigned int flags ) { static char s[1024]; s[0] = '\0'; if (flags & IFF_UP) strcat (s, "IFF_UP"); #define IFF(flag) \ do { \ if (flags & flag) { \ strcat (s, s[0] ? ("|" #flag) : (#flag)); \ } \ } while (0) #ifdef IFF_BROADCAST IFF(IFF_BROADCAST); #endif #ifdef IFF_DEBUG IFF(IFF_DEBUG); #endif #ifdef IFF_LOOPBACK IFF(IFF_LOOPBACK); #endif #ifdef IFF_POINTOPOINT IFF(IFF_POINTOPOINT); #endif #ifdef IFF_RUNNING IFF(IFF_RUNNING); #endif #ifdef IFF_NOARP IFF(IFF_NOARP); #endif #ifdef IFF_PROMISC IFF(IFF_PROMISC); #endif #ifdef IFF_NOTRAILERS IFF(IFF_NOTRAILERS); #endif #ifdef IFF_ALLMULTI IFF(IFF_ALLMULTI); #endif #ifdef IFF_MASTER IFF(IFF_MASTER); #endif #ifdef IFF_SLAVE IFF(IFF_SLAVE); #endif #ifdef IFF_MULTICAST IFF(IFF_MULTICAST); #endif #ifdef IFF_PORTSEL IFF(IFF_PORTSEL); #endif #ifdef IFF_AUTOMEDIA IFF(IFF_AUTOMEDIA); #endif #ifdef IFF_DYNAMIC IFF(IFF_DYNAMIC); #endif #ifdef IFF_LOWER_UP IFF(IFF_LOWER_UP); #endif #ifdef IFF_DORMANT IFF(IFF_DORMANT); #endif #ifdef IFF_ECHO IFF(IFF_ECHO); #endif if (!s[0]) { if (flags) sprintf (s, "0x%x", flags); else strcpy (s, "(null)"); } return s; } /* target: * bool * pgm_getifaddrs ( * struct pgm_ifaddrs_t**restrict ifap, * pgm_error_t**restrict error * ) */ START_TEST (test_getifaddrs_pass_001) { char saddr[INET6_ADDRSTRLEN], snetmask[INET6_ADDRSTRLEN]; struct pgm_ifaddrs_t *ifap = NULL, *ifa; pgm_error_t* err = NULL; fail_unless (TRUE == pgm_getifaddrs (&ifap, &err), "getifaddrs failed"); for (ifa = ifap; ifa; ifa = ifa->ifa_next) { fail_unless (NULL != ifa, "invalid address"); if (ifa->ifa_addr) { if (AF_INET == ifa->ifa_addr->sa_family || AF_INET6 == ifa->ifa_addr->sa_family) pgm_sockaddr_ntop (ifa->ifa_addr, saddr, sizeof(saddr)); #ifdef AF_PACKET else if (AF_PACKET == ifa->ifa_addr->sa_family) strcpy (saddr, "(AF_PACKET)"); #endif else sprintf (saddr, "(AF = %d)", ifa->ifa_addr->sa_family); } else strcpy (saddr, "(null)"); if (ifa->ifa_netmask) { if (AF_INET == ifa->ifa_addr->sa_family || AF_INET6 == ifa->ifa_addr->sa_family) pgm_sockaddr_ntop (ifa->ifa_netmask, snetmask, sizeof(snetmask)); #ifdef AF_PACKET else if (AF_PACKET == ifa->ifa_addr->sa_family) strcpy (snetmask, "(AF_PACKET)"); #endif else sprintf (snetmask, "(AF = %d)", ifa->ifa_addr->sa_family); } else strcpy (snetmask, "(null)"); g_message ("ifa = {" "ifa_next = %p, " "ifa_name = %s%s%s, " "ifa_flags = %s, " "ifa_addr = %s, " "ifa_netmask = %s" "}", ifa->ifa_next, ifa->ifa_name ? "\"" : "", ifa->ifa_name ? ifa->ifa_name : "(null)", ifa->ifa_name ? "\"" : "", ifflags_string (ifa->ifa_flags), saddr, snetmask); } } END_TEST START_TEST (test_getifaddrs_fail_001) { fail_unless (FALSE == pgm_getifaddrs (NULL, NULL), "getifaddrs failed"); g_message ("errno:%d", errno); } END_TEST /* target: * void * pgm_freeifaddrs ( * struct pgm_ifaddrs* ifa * ) */ START_TEST (test_freeifaddrs_pass_001) { struct pgm_ifaddrs_t* ifap = NULL; pgm_error_t* err = NULL; fail_unless (TRUE == pgm_getifaddrs (&ifap, &err), "getifaddrs failed"); pgm_freeifaddrs (ifap); } END_TEST /* silent failure */ START_TEST (test_freeifaddrs_pass_002) { pgm_freeifaddrs (NULL); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_getifaddrs = tcase_create ("getifaddrs"); suite_add_tcase (s, tc_getifaddrs); tcase_add_test (tc_getifaddrs, test_getifaddrs_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_getifaddrs, test_getifaddrs_fail_001, SIGABRT); #endif TCase* tc_freeifaddrs = tcase_create ("freeifaddrs"); suite_add_tcase (s, tc_freeifaddrs); tcase_add_test (tc_freeifaddrs, test_freeifaddrs_pass_001); tcase_add_test (tc_freeifaddrs, test_freeifaddrs_pass_002); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/log.c0000644000175000017500000001071011640407354016467 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * basic logging. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* MSVC secure CRT */ #define _CRT_SECURE_NO_WARNINGS 1 #include #include #include #ifndef G_OS_WIN32 # include # include # include # include #else # define WIN32_LEAN_AND_MEAN # include # include #endif #include #include "pgm/log.h" /* globals */ #define TIME_FORMAT "%Y-%m-%d %H:%M:%S " static int log_timezone PGM_GNUC_READ_MOSTLY = 0; static char log_hostname[NI_MAXHOST + 1] PGM_GNUC_READ_MOSTLY; static void glib_log_handler (const gchar*, GLogLevelFlags, const gchar*, gpointer); static void pgm_log_handler (const int, const char*restrict, void*restrict); /* calculate time zone offset in seconds */ bool log_init ( void ) { /* time zone offset */ time_t t; struct tm sgmt, *gmt = &sgmt, *loc; int dir; t = time (NULL); *gmt = *gmtime (&t); loc = localtime (&t); log_timezone = (loc->tm_hour - gmt->tm_hour) * 60 * 60 + (loc->tm_min - gmt->tm_min) * 60; dir = loc->tm_year - gmt->tm_year; if (!dir) dir = loc->tm_yday - gmt->tm_yday; log_timezone += dir * 24 * 60 * 60; // printf ("timezone offset %u seconds.\n", log_timezone); gethostname (log_hostname, sizeof(log_hostname)); g_log_set_handler ("Pgm", G_LOG_LEVEL_MASK, glib_log_handler, NULL); g_log_set_handler ("Pgm-Http", G_LOG_LEVEL_MASK, glib_log_handler, NULL); g_log_set_handler ("Pgm-Snmp", G_LOG_LEVEL_MASK, glib_log_handler, NULL); g_log_set_handler (NULL, G_LOG_LEVEL_MASK, glib_log_handler, NULL); pgm_log_set_handler (pgm_log_handler, NULL); return 0; } /* log callback */ static void glib_log_handler ( const gchar* log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, const gchar* message, G_GNUC_UNUSED gpointer unused_data ) { time_t now; struct tm* time_ptr; char tbuf[1024]; #ifdef G_OS_UNIX struct iovec iov[7]; struct iovec* v = iov; time (&now); time_ptr = localtime (&now); strftime (tbuf, sizeof (tbuf), TIME_FORMAT, time_ptr); v->iov_base = tbuf; v->iov_len = strlen (tbuf); v++; v->iov_base = log_hostname; v->iov_len = strlen (log_hostname); v++; if (log_domain) { v->iov_base = " "; v->iov_len = 1; v++; v->iov_base = log_domain; v->iov_len = strlen (log_domain); v++; } v->iov_base = ": "; v->iov_len = 2; v++; v->iov_base = message; v->iov_len = strlen (message); v++; v->iov_base = "\n"; v->iov_len = 1; v++; writev (STDOUT_FILENO, iov, v - iov); #else const int stdout_fileno = _fileno (stdout); time (&now); time_ptr = localtime (&now); strftime (tbuf, sizeof (tbuf), TIME_FORMAT, time_ptr); _write (stdout_fileno, tbuf, strlen (tbuf)); _write (stdout_fileno, log_hostname, strlen (log_hostname)); if (log_domain) { _write (stdout_fileno, " ", 1); _write (stdout_fileno, log_domain, strlen (log_domain)); } _write (stdout_fileno, ": ", 2); _write (stdout_fileno, message, strlen (message)); _write (stdout_fileno, "\n", 1); #endif } static void pgm_log_handler ( const int pgm_log_level, const char* restrict message, G_GNUC_UNUSED void*restrict closure ) { GLogLevelFlags glib_log_level; switch (pgm_log_level) { case PGM_LOG_LEVEL_DEBUG: glib_log_level = G_LOG_LEVEL_DEBUG; break; case PGM_LOG_LEVEL_TRACE: glib_log_level = G_LOG_LEVEL_DEBUG; break; case PGM_LOG_LEVEL_MINOR: glib_log_level = G_LOG_LEVEL_INFO; break; case PGM_LOG_LEVEL_NORMAL: glib_log_level = G_LOG_LEVEL_MESSAGE; break; case PGM_LOG_LEVEL_WARNING: glib_log_level = G_LOG_LEVEL_WARNING; break; case PGM_LOG_LEVEL_ERROR: glib_log_level = G_LOG_LEVEL_CRITICAL; break; case PGM_LOG_LEVEL_FATAL: glib_log_level = G_LOG_LEVEL_ERROR; break; } g_log ("Pgm", glib_log_level, message, NULL); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/getifaddrs.c0000644000175000017500000006376211640407354020041 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable getifaddrs implementation. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #ifdef CONFIG_HAVE_GETIFADDRS # include # include #endif #if defined( __sun ) # include #endif #if defined( _WIN32 ) # include # include #endif #include #include //#define GETIFADDRS_DEBUG /* locals */ struct _pgm_ifaddrs_t { struct pgm_ifaddrs_t _ifa; char _name[IF_NAMESIZE]; struct sockaddr_storage _addr; struct sockaddr_storage _netmask; }; /* Number of attempts to try enumerating the interface list */ #define MAX_TRIES 3 #define DEFAULT_BUFFER_SIZE 4096 /* returns TRUE on success setting ifap to a linked list of system interfaces, * returns FALSE on failure and sets error appropriately. */ #ifdef SIOCGLIFCONF static bool _pgm_getlifaddrs ( struct pgm_ifaddrs_t** restrict ifap, pgm_error_t** restrict error ) { const SOCKET sock = socket (AF_INET, SOCK_DGRAM, 0); if (SOCKET_ERROR == sock) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Opening IPv4 datagram socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); return FALSE; } /* process IPv6 interfaces */ const SOCKET sock6 = socket (AF_INET6, SOCK_DGRAM, 0); if (SOCKET_ERROR == sock6) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Opening IPv6 datagram socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); return FALSE; } struct lifnum lifn; again: lifn.lifn_family = AF_INET; lifn.lifn_flags = 0; if (SOCKET_ERROR == ioctlsocket (sock, SIOCGLIFNUM, &lifn)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("SIOCGLIFNUM failed on IPv4 socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); closesocket (sock6); return FALSE; } unsigned if_count = lifn.lifn_count; pgm_debug ("ioctl(AF_INET, SIOCGLIFNUM) = %d", lifn.lifn_count); /* nb: Sun and Apple code likes to pad the interface count here in case interfaces * are coming up between calls, */ lifn.lifn_count += 4; /* process all interfaces with family-agnostic ioctl, unfortunately it still * must be called on each family socket despite what if_tcp(7P) says. */ struct lifconf lifc, lifc6; lifc.lifc_family = AF_INET; lifc.lifc_flags = 0; lifc.lifc_len = lifn.lifn_count * sizeof(struct lifreq); lifc.lifc_buf = alloca (lifc.lifc_len); if (SOCKET_ERROR == ioctlsocket (sock, SIOCGLIFCONF, &lifc)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("SIOCGLIFCONF failed on IPv4 socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); closesocket (sock6); return FALSE; } pgm_debug ("ioctl(AF_INET, SIOCGLIFCONF) = %d (%d)", lifc.lifc_len, (int)(lifc.lifc_len / sizeof(struct lifreq))); /* repeat everything for IPv6 */ lifn.lifn_family = AF_INET6; lifn.lifn_flags = 0; if (SOCKET_ERROR == ioctlsocket (sock6, SIOCGLIFNUM, &lifn)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("SIOCGLIFNUM failed on IPv6 socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); closesocket (sock6); return FALSE; } if_count += lifn.lifn_count; pgm_debug ("ioctl(AF_INET6, SIOCGLIFNUM) = %d", lifn.lifn_count); lifn.lifn_count += 4; lifc6.lifc_family = AF_INET6; lifc6.lifc_flags = 0; lifc6.lifc_len = lifn.lifn_count * sizeof(struct lifreq); lifc6.lifc_buf = alloca (lifc6.lifc_len); if (SOCKET_ERROR == ioctlsocket (sock6, SIOCGLIFCONF, &lifc6)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("SIOCGLIFCONF failed on IPv6 socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); closesocket (sock6); return FALSE; } pgm_debug ("ioctl(AF_INET6, SIOCGLIFCONF) = %d (%d)", lifc6.lifc_len, (int)(lifc6.lifc_len / sizeof(struct lifreq))); unsigned nlifr = (lifc.lifc_len + lifc6.lifc_len) / sizeof(struct lifreq); if (nlifr > if_count) goto again; /* alloc a contiguous block for entire list */ struct _pgm_ifaddrs_t* ifa = calloc (nlifr, sizeof (struct _pgm_ifaddrs_t)); pgm_assert (NULL != ifa); struct _pgm_ifaddrs_t* ift = ifa; struct lifreq* lifr = lifc.lifc_req; struct lifreq* lifr_end = (struct lifreq *)&lifc.lifc_buf[lifc.lifc_len]; pgm_assert_cmpuint (IF_NAMESIZE, >=, LIFNAMSIZ); while (lifr < lifr_end) { /* name */ pgm_debug ("AF_INET/name: %s", lifr->lifr_name ? lifr->lifr_name : "(null)"); ift->_ifa.ifa_name = ift->_name; pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, lifr->lifr_name, _TRUNCATE); /* flags */ if (SOCKET_ERROR != ioctlsocket (sock, SIOCGLIFFLAGS, lifr)) { ift->_ifa.ifa_flags = lifr->lifr_flags; } else { pgm_warn (_("SIOCGLIFFLAGS failed on interface %s%s%s"), lifr->lifr_name ? "\"" : "", lifr->lifr_name ? lifr->lifr_name : "(null)", lifr->lifr_name ? "\"" : ""); } /* address */ if (SOCKET_ERROR != ioctlsocket (sock, SIOCGLIFADDR, lifr)) { ift->_ifa.ifa_addr = (void*)&ift->_addr; memcpy (ift->_ifa.ifa_addr, &lifr->lifr_addr, pgm_sockaddr_len((struct sockaddr*)&lifr->lifr_addr)); } else { pgm_warn (_("SIOCGLIFADDR failed on interface %s%s%s"), lifr->lifr_name ? "\"" : "", lifr->lifr_name ? lifr->lifr_name : "(null)", lifr->lifr_name ? "\"" : ""); } /* netmask */ if (SOCKET_ERROR != ioctlsocket (sock, SIOCGLIFNETMASK, lifr)) { ift->_ifa.ifa_netmask = (void*)&ift->_netmask; # ifdef CONFIG_HAVE_IFR_NETMASK memcpy (ift->_ifa.ifa_netmask, &lifr->lifr_netmask, pgm_sockaddr_len((struct sockaddr*)&lifr->lifr_netmask)); # else memcpy (ift->_ifa.ifa_netmask, &lifr->lifr_addr, pgm_sockaddr_len((struct sockaddr*)&lifr->lifr_addr)); # endif } else { pgm_warn (_("SIOCGLIFNETMASK failed on interface %s%s%s"), lifr->lifr_name ? "\"" : "", lifr->lifr_name ? lifr->lifr_name : "(null)", lifr->lifr_name ? "\"" : ""); } ++lifr; if (lifr < lifr_end) { ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } } /* repeat everything for IPv6 */ lifr = lifc6.lifc_req; lifr_end = (struct lifreq *)&lifc6.lifc_buf[lifc6.lifc_len]; while (lifr < lifr_end) { if (ift != ifa) { ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } /* name */ pgm_debug ("AF_INET6/name: %s", lifr->lifr_name ? lifr->lifr_name : "(null)"); ift->_ifa.ifa_name = ift->_name; pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, lifr->lifr_name, _TRUNCATE); /* flags */ if (SOCKET_ERROR != ioctlsocket (sock6, SIOCGLIFFLAGS, lifr)) { ift->_ifa.ifa_flags = lifr->lifr_flags; } else { pgm_warn (_("SIOCGLIFFLAGS failed on interface %s%s%s"), lifr->lifr_name ? "\"" : "", lifr->lifr_name ? lifr->lifr_name : "(null)", lifr->lifr_name ? "\"" : ""); } /* address */ if (SOCKET_ERROR != ioctlsocket (sock6, SIOCGLIFADDR, lifr)) { ift->_ifa.ifa_addr = (void*)&ift->_addr; memcpy (ift->_ifa.ifa_addr, &lifr->lifr_addr, pgm_sockaddr_len((struct sockaddr*)&lifr->lifr_addr)); } else { pgm_warn (_("SIOCGLIFADDR failed on interface %s%s%s"), lifr->lifr_name ? "\"" : "", lifr->lifr_name ? lifr->lifr_name : "(null)", lifr->lifr_name ? "\"" : ""); } /* netmask */ if (SOCKET_ERROR != ioctlsocket (sock6, SIOCGLIFNETMASK, lifr)) { ift->_ifa.ifa_netmask = (void*)&ift->_netmask; # ifdef CONFIG_HAVE_IFR_NETMASK memcpy (ift->_ifa.ifa_netmask, &lifr->lifr_netmask, pgm_sockaddr_len((struct sockaddr*)&lifr->lifr_netmask)); # else memcpy (ift->_ifa.ifa_netmask, &lifr->lifr_addr, pgm_sockaddr_len((struct sockaddr*)&lifr->lifr_addr)); # endif } else { pgm_warn (_("SIOCGLIFNETMASK failed on interface %s%s%s"), lifr->lifr_name ? "\"" : "", lifr->lifr_name ? lifr->lifr_name : "(null)", lifr->lifr_name ? "\"" : ""); } ++lifr; } if (SOCKET_ERROR == closesocket (sock6)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Closing IPv6 socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } if (SOCKET_ERROR == closesocket (sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Closing IPv4 socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } *ifap = (struct pgm_ifaddrs_t*)ifa; return TRUE; } #endif /* SIOCGLIFCONF */ #ifdef SIOCGIFCONF static bool _pgm_getifaddrs ( struct pgm_ifaddrs_t** restrict ifap, pgm_error_t** restrict error ) { const SOCKET sock = socket (AF_INET, SOCK_DGRAM, 0); if (SOCKET_ERROR == sock) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Opening IPv4 datagram socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); return FALSE; } /* process IPv4 interfaces */ char buf[ DEFAULT_BUFFER_SIZE ]; struct ifconf ifc; ifc.ifc_buf = buf; ifc.ifc_len = sizeof(buf); if (SOCKET_ERROR == ioctlsocket (sock, SIOCGIFCONF, &ifc)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("SIOCGIFCONF failed on IPv4 socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); return FALSE; } int if_count = ifc.ifc_len / sizeof(struct ifreq); # ifdef CONFIG_HAVE_IPV6_SIOCGIFADDR /* process IPv6 interfaces */ const SOCKET sock6 = socket (AF_INET6, SOCK_DGRAM, 0); if (SOCKET_ERROR == sock6) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Opening IPv6 datagram socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); return FALSE; } char buf6[1024]; struct ifconf ifc6; ifc6.ifc_buf = buf6; ifc6.ifc_len = sizeof(buf6); if (SOCKET_ERROR == ioctlsocket (sock6, SIOCGIFCONF, &ifc6)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("SIOCGIFCONF failed on IPv6 socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); closesocket (sock); closesocket (sock6); return FALSE; } if_count += ifc6.ifc_len / sizeof(struct ifreq); # endif /* CONFIG_HAVE_IPV6_SIOCGIFADDR */ /* alloc a contiguous block for entire list */ struct _pgm_ifaddrs_t* ifa = pgm_new0 (struct _pgm_ifaddrs_t, if_count); struct _pgm_ifaddrs_t* ift = ifa; struct ifreq *ifr = ifc.ifc_req; struct ifreq *ifr_end = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len]; pgm_assert_cmpuint (IF_NAMESIZE, >=, sizeof(ifr->ifr_name)); while (ifr < ifr_end) { /* name */ pgm_debug ("AF_INET/name:%s", ifr->ifr_name ? ifr->ifr_name : "(null)"); ift->_ifa.ifa_name = ift->_name; pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, ifr->ifr_name, _TRUNCATE); /* flags */ if (SOCKET_ERROR != ioctlsocket (sock, SIOCGIFFLAGS, ifr)) { ift->_ifa.ifa_flags = ifr->ifr_flags; } else { pgm_warn (_("SIOCGIFFLAGS failed on interface %s%s%s"), ifr->ifr_name ? "\"" : "", ifr->ifr_name ? ifr->ifr_name : "(null)", ifr->ifr_name ? "\"" : ""); } /* address */ if (SOCKET_ERROR != ioctlsocket (sock, SIOCGIFADDR, ifr)) { ift->_ifa.ifa_addr = (void*)&ift->_addr; memcpy (ift->_ifa.ifa_addr, &ifr->ifr_addr, pgm_sockaddr_len(&ifr->ifr_addr)); } else { pgm_warn (_("SIOCGIFADDR failed on interface %s%s%s"), ifr->ifr_name ? "\"" : "", ifr->ifr_name ? ifr->ifr_name : "(null)", ifr->ifr_name ? "\"" : ""); } /* netmask */ if (SOCKET_ERROR != ioctlsocket (sock, SIOCGIFNETMASK, ifr)) { ift->_ifa.ifa_netmask = (void*)&ift->_netmask; # ifdef CONFIG_HAVE_IFR_NETMASK memcpy (ift->_ifa.ifa_netmask, &ifr->ifr_netmask, pgm_sockaddr_len(&ifr->ifr_netmask)); # else memcpy (ift->_ifa.ifa_netmask, &ifr->ifr_addr, pgm_sockaddr_len(&ifr->ifr_addr)); # endif } else { pgm_warn (_("SIOCGIFNETMASK failed on interface %s%s%s"), ifr->ifr_name ? "\"" : "", ifr->ifr_name ? ifr->ifr_name : "(null)", ifr->ifr_name ? "\"" : ""); } ++ifr; if (ifr < ifr_end) { ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } } # ifdef CONFIG_HAVE_IPV6_SIOCGIFADDR /* repeat everything for IPv6 */ ifr = ifc6.ifc_req; ifr_end = (struct ifreq *)&ifc6.ifc_buf[ifc6.ifc_len]; while (ifr < ifr_end) { if (ift != ifa) { ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } /* name */ pgm_debug ("AF_INET6/name:%s", ifr->ifr_name ? ifr->ifr_name : "(null)"); ift->_ifa.ifa_name = ift->_name; pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, ifr->ifr_name, _TRUNCATE); /* flags */ if (SOCKET_ERROR != ioctlsocket (sock6, SIOCGIFFLAGS, ifr)) { ift->_ifa.ifa_flags = ifr->ifr_flags; } else { pgm_warn (_("SIOCGIFFLAGS failed on interface %s%s%s"), ifr->ifr_name ? "\"" : "", ifr->ifr_name ? ifr->ifr_name : "(null)", ifr->ifr_name ? "\"" : ""); } /* address, note this does not work on Linux as struct ifreq is too small for an IPv6 address */ if (SOCKET_ERROR != ioctlsocket (sock6, SIOCGIFADDR, ifr)) { ift->_ifa.ifa_addr = (void*)&ift->_addr; memcpy (ift->_ifa.ifa_addr, &ifr->ifr_addr, pgm_sockaddr_len(&ifr->ifr_addr)); } else { pgm_warn (_("SIOCGIFADDR failed on interface %s%s%s"), ifr->ifr_name ? "\"" : "", ifr->ifr_name ? ifr->ifr_name : "(null)", ifr->ifr_name ? "\"" : ""); } /* netmask */ if (SOCKET_ERROR != ioctlsocket (sock6, SIOCGIFNETMASK, ifr)) { ift->_ifa.ifa_netmask = (void*)&ift->_netmask; # ifdef CONFIG_HAVE_IFR_NETMASK memcpy (ift->_ifa.ifa_netmask, &ifr->ifr_netmask, pgm_sockaddr_len(&ifr->ifr_netmask)); # else memcpy (ift->_ifa.ifa_netmask, &ifr->ifr_addr, pgm_sockaddr_len(&ifr->ifr_addr)); # endif } else { pgm_warn (_("SIOCGIFNETMASK failed on interface %s%s%s"), ifr->ifr_name ? "\"" : "", ifr->ifr_name ? ifr->ifr_name : "(null)", ifr->ifr_name ? "\"" : ""); } ++ifr; } if (SOCKET_ERROR == closesocket (sock6)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Closing IPv6 socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); } # endif /* CONFIG_HAVE_IPV6_SIOCGIFADDR */ if (SOCKET_ERROR == closesocket (sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Closing IPv4 socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); } *ifap = (struct pgm_ifaddrs_t*)ifa; return TRUE; } #endif /* SIOCLIFCONF */ #if defined(_WIN32) static inline void* _pgm_heap_alloc ( const size_t n_bytes ) { # ifdef CONFIG_USE_HEAPALLOC /* Does not appear very safe with re-entrant calls on XP */ return HeapAlloc (GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, n_bytes); # else return pgm_malloc (n_bytes); # endif } static inline void _pgm_heap_free ( void* mem ) { # ifdef CONFIG_USE_HEAPALLOC HeapFree (GetProcessHeap(), 0, mem); # else pgm_free (mem); # endif } /* NB: IP_ADAPTER_INFO size varies size due to sizeof (time_t), the API assumes * 4-byte datatype whilst compiler uses an 8-byte datatype. Size can be forced * with -D_USE_32BIT_TIME_T with side effects to everything else. */ static bool _pgm_getadaptersinfo ( struct pgm_ifaddrs_t** restrict ifap, pgm_error_t** restrict error ) { DWORD dwRet; ULONG ulOutBufLen = DEFAULT_BUFFER_SIZE; PIP_ADAPTER_INFO pAdapterInfo = NULL; PIP_ADAPTER_INFO pAdapter = NULL; /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ for (unsigned i = MAX_TRIES; i; i--) { pgm_debug ("IP_ADAPTER_INFO buffer length %lu bytes.", ulOutBufLen); pAdapterInfo = (IP_ADAPTER_INFO*)_pgm_heap_alloc (ulOutBufLen); dwRet = GetAdaptersInfo (pAdapterInfo, &ulOutBufLen); if (ERROR_BUFFER_OVERFLOW == dwRet) { _pgm_heap_free (pAdapterInfo); pAdapterInfo = NULL; } else { break; } } switch (dwRet) { case ERROR_SUCCESS: /* NO_ERROR */ break; case ERROR_BUFFER_OVERFLOW: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NOBUFS, _("GetAdaptersInfo repeatedly failed with ERROR_BUFFER_OVERFLOW.")); if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); return FALSE; default: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_win_errno (dwRet), _("GetAdaptersInfo failed: %s"), pgm_adapter_strerror (dwRet)); if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); return FALSE; } /* count valid adapters */ int n = 0, k = 0; for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { for (IP_ADDR_STRING *pIPAddr = &pAdapter->IpAddressList; pIPAddr; pIPAddr = pIPAddr->Next) { /* skip null adapters */ if (strlen (pIPAddr->IpAddress.String) == 0) continue; ++n; } } pgm_debug ("GetAdaptersInfo() discovered %d interfaces.", n); /* contiguous block for adapter list */ struct _pgm_ifaddrs_t* ifa = pgm_new0 (struct _pgm_ifaddrs_t, n); struct _pgm_ifaddrs_t* ift = ifa; /* now populate list */ for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { for (IP_ADDR_STRING *pIPAddr = &pAdapter->IpAddressList; pIPAddr; pIPAddr = pIPAddr->Next) { /* skip null adapters */ if (strlen (pIPAddr->IpAddress.String) == 0) continue; /* address */ ift->_ifa.ifa_addr = (void*)&ift->_addr; pgm_assert (1 == pgm_sockaddr_pton (pIPAddr->IpAddress.String, ift->_ifa.ifa_addr)); /* name */ pgm_debug ("name:%s IPv4 index:%lu", pAdapter->AdapterName, pAdapter->Index); ift->_ifa.ifa_name = ift->_name; pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, pAdapter->AdapterName, _TRUNCATE); /* flags: assume up, broadcast and multicast */ ift->_ifa.ifa_flags = IFF_UP | IFF_BROADCAST | IFF_MULTICAST; if (pAdapter->Type == MIB_IF_TYPE_LOOPBACK) ift->_ifa.ifa_flags |= IFF_LOOPBACK; /* netmask */ ift->_ifa.ifa_netmask = (void*)&ift->_netmask; pgm_assert (1 == pgm_sockaddr_pton (pIPAddr->IpMask.String, ift->_ifa.ifa_netmask)); /* next */ if (k++ < (n - 1)) { ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } } } if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); *ifap = (struct pgm_ifaddrs_t*)ifa; return TRUE; } static bool _pgm_getadaptersaddresses ( struct pgm_ifaddrs_t** restrict ifap, pgm_error_t** restrict error ) { DWORD dwSize = DEFAULT_BUFFER_SIZE, dwRet; IP_ADAPTER_ADDRESSES *pAdapterAddresses = NULL, *adapter; /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ for (unsigned i = MAX_TRIES; i; i--) { pgm_debug ("IP_ADAPTER_ADDRESSES buffer length %lu bytes.", dwSize); pAdapterAddresses = (IP_ADAPTER_ADDRESSES*)_pgm_heap_alloc (dwSize); dwRet = GetAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_MULTICAST, NULL, pAdapterAddresses, &dwSize); if (ERROR_BUFFER_OVERFLOW == dwRet) { _pgm_heap_free (pAdapterAddresses); pAdapterAddresses = NULL; } else { break; } } switch (dwRet) { case ERROR_SUCCESS: break; case ERROR_BUFFER_OVERFLOW: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NOBUFS, _("GetAdaptersAddresses repeatedly failed with ERROR_BUFFER_OVERFLOW.")); if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); return FALSE; default: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_win_errno (dwRet), _("GetAdaptersAddresses failed: %s"), pgm_adapter_strerror (dwRet)); if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); return FALSE; } /* count valid adapters */ int n = 0, k = 0; for (adapter = pAdapterAddresses; adapter; adapter = adapter->Next) { for (IP_ADAPTER_UNICAST_ADDRESS *unicast = adapter->FirstUnicastAddress; unicast; unicast = unicast->Next) { /* ensure IP adapter */ if (AF_INET != unicast->Address.lpSockaddr->sa_family && AF_INET6 != unicast->Address.lpSockaddr->sa_family) { continue; } ++n; } } /* contiguous block for adapter list */ struct _pgm_ifaddrs_t* ifa = pgm_new0 (struct _pgm_ifaddrs_t, n); struct _pgm_ifaddrs_t* ift = ifa; /* now populate list */ for (adapter = pAdapterAddresses; adapter; adapter = adapter->Next) { int unicastIndex = 0; for (IP_ADAPTER_UNICAST_ADDRESS *unicast = adapter->FirstUnicastAddress; unicast; unicast = unicast->Next, ++unicastIndex) { /* ensure IP adapter */ if (AF_INET != unicast->Address.lpSockaddr->sa_family && AF_INET6 != unicast->Address.lpSockaddr->sa_family) { continue; } /* address */ ift->_ifa.ifa_addr = (void*)&ift->_addr; memcpy (ift->_ifa.ifa_addr, unicast->Address.lpSockaddr, unicast->Address.iSockaddrLength); /* name */ pgm_debug ("name:%s IPv4 index:%lu IPv6 index:%lu", adapter->AdapterName, adapter->IfIndex, adapter->Ipv6IfIndex); ift->_ifa.ifa_name = ift->_name; pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, adapter->AdapterName, _TRUNCATE); /* flags */ ift->_ifa.ifa_flags = 0; if (IfOperStatusUp == adapter->OperStatus) ift->_ifa.ifa_flags |= IFF_UP; if (IF_TYPE_SOFTWARE_LOOPBACK == adapter->IfType) ift->_ifa.ifa_flags |= IFF_LOOPBACK; if (!(adapter->Flags & IP_ADAPTER_NO_MULTICAST)) ift->_ifa.ifa_flags |= IFF_MULTICAST; /* netmask */ ift->_ifa.ifa_netmask = (void*)&ift->_netmask; /* pre-Vista must hunt for matching prefix in linked list, otherwise use OnLinkPrefixLength */ int prefixIndex = 0; ULONG prefixLength = 0; for (IP_ADAPTER_PREFIX *prefix = adapter->FirstPrefix; prefix; prefix = prefix->Next, ++prefixIndex) { if (prefixIndex == unicastIndex) { prefixLength = prefix->PrefixLength; break; } } /* map prefix to netmask */ ift->_ifa.ifa_netmask->sa_family = unicast->Address.lpSockaddr->sa_family; switch (unicast->Address.lpSockaddr->sa_family) { case AF_INET: if (0 == prefixLength) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("IPv4 adapter %s prefix length is 0, overriding to 32."), adapter->AdapterName); prefixLength = 32; } ((struct sockaddr_in*)ift->_ifa.ifa_netmask)->sin_addr.s_addr = htonl( 0xffffffffU << ( 32 - prefixLength ) ); break; case AF_INET6: if (0 == prefixLength) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("IPv6 adapter %s prefix length is 0, overriding to 128."), adapter->AdapterName); prefixLength = 128; } for (ULONG i = prefixLength, j = 0; i > 0; i -= 8, ++j) { ((struct sockaddr_in6*)ift->_ifa.ifa_netmask)->sin6_addr.s6_addr[ j ] = i >= 8 ? 0xff : (ULONG)(( 0xffU << ( 8 - i ) ) & 0xffU ); } break; } /* next */ if (k++ < (n - 1)) { ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } } } if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); *ifap = (struct pgm_ifaddrs_t*)ifa; return TRUE; } #endif /* _WIN32 */ /* returns TRUE on success setting ifap to a linked list of system interfaces, * returns FALSE on failure and sets error appropriately. */ bool pgm_getifaddrs ( struct pgm_ifaddrs_t** restrict ifap, pgm_error_t** restrict error ) { pgm_assert (NULL != ifap); pgm_debug ("pgm_getifaddrs (ifap:%p error:%p)", (void*)ifap, (void*)error); #ifdef CONFIG_HAVE_GETIFADDRS const int e = getifaddrs ((struct ifaddrs**)ifap); if (-1 == e) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_errno (errno), _("getifaddrs failed: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); return FALSE; } return TRUE; #elif defined(CONFIG_TARGET_WINE) return _pgm_getadaptersinfo (ifap, error); #elif defined(_WIN32) return _pgm_getadaptersaddresses (ifap, error); #elif defined(SIOCGLIFCONF) return _pgm_getlifaddrs (ifap, error); #elif defined(SIOCGIFCONF) return _pgm_getifaddrs (ifap, error); #else # error "Unsupported interface enumeration on this platform." #endif /* !CONFIG_HAVE_GETIFADDRS */ } void pgm_freeifaddrs ( struct pgm_ifaddrs_t* ifa ) { pgm_return_if_fail (NULL != ifa); #ifdef CONFIG_HAVE_GETIFADDRS freeifaddrs ((struct ifaddrs*)ifa); #else pgm_free (ifa); #endif } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/indextoname.c.c89.patch0000644000175000017500000000106011640407354021717 0ustar locallocal--- indextoname.c 2011-03-12 10:12:42.000000000 +0800 +++ indextoname.c89.c 2011-03-12 10:40:35.000000000 +0800 @@ -40,12 +40,20 @@ #else pgm_return_val_if_fail (NULL != ifname, NULL); - MIB_IFROW ifRow = { .dwIndex = ifindex }; + { + MIB_IFROW ifRow; + ifRow.dwIndex = ifindex; + { const DWORD dwRetval = GetIfEntry (&ifRow); if (NO_ERROR != dwRetval) return NULL; - strcpy (ifname, (char*)ifRow.wszName); + { + size_t i; + pgm_wcstombs_s (&i, ifname, IF_NAMESIZE, ifRow.wszName, _TRUNCATE); + } return ifname; + } + } #endif /* _WIN32 */ } libpgm-5.1.118-1~dfsg/openpgm/pgm/plan.txt0000644000175000017500000001341211640407354017237 0ustar locallocalpgmdump ------- View all packets like tcpdump, but updated to full spec and allow dump of payload. pgmtop ------ Dump realtime packet statistics in a ncurses display, mix of top/htop/netop. basic_send ---------- Send an ODATA packet and terminate. Accept string payload and network parameters on command line. Send to multicast or send to unicast AFI. IPv4/6. Define optional session start, late join tags. spm_idle -------- Idle in an event loop sending out SPM packets. stream_send ----------- Send a constant stream of ODATA and SPM packets. basic_http ---------- Simple embedded web server basic_recv ---------- Listen to packets indicating data loss, view details through web interface. basic_container --------------- Test performance of glib containers for fast allocating for a dynamic transmit window. basic_txw --------- Test performance of a basic transmit window implementation. nak_txw ------- Test performance of random access to packets inside the window. stream_send_with_nak -------------------- Respond to NAK's with RDATA. basic_recv_with_nak ------------------- Listen to packets and send NAK's to rebuild data. dumpif ------ Display all IP based interfaces and basic details. testif ------ Test various combinations of network specification. sw_calc ------- Basic calculation tests of wrap-around sliding windows and a leading edge. basic_recv_with_rxw ------------------- Listen to packets buffered with a receive window. test_cpu_timers --------------- Calculate drift between processors, cores, and hyper-threads. pgmsend -------- basic_send updated to use transmit window. pgmrecv -------- basic_recv_with_rxw without web interface, primary displays messages from pgmsend. syncrecv -------- pgmrecv implemented outside GLib with a synchronous coding paradigm. pgmping ------- Dual mode: one to send fixed messages like pgmsend and listen for response, two to listen for messages and reply. block_send ---------- Send APDUs over ODATA. (pgmrecv can receive APDUs) test_rs ------- Test 8-bit symbol Reed Solomon encoding and decoding with errors & erasures. test_fec -------- Test fec creation and recovery. send_with_fec -------------------- Send APDUs over ODATA with FEC. Scenarios to reproduce ********************** - Packet loss in stream causing NAK generation. - Link saturation in sending causing API feedback. - Link peak stable speed. - Maxium NAK generation to determine NCF/RDATA throughput. - Corrupt packets with invalid IP checksum (? generate IP HDR in sender) - Corrupt packets with invalid PGM checksum. - Invalid packet values. - NAK to NCF latency. - NAK to RDATA latency. - Publish bandwidth: total, per packet type, payload, per recipient (?) - Subscribe bandwidth: total, per packet type, payload, per publisher (?) - Restarting a session with similar or dissimilar sequence numbering. Outstanding questions ********************* - Is it faster to use chunks containing multiple packets instead of one MTU per packet. Does aligning with system page size matter? - Can g_timers be dropped easily for gettimeofday and avoid floating point math? Possible to pass timer upstream with contiguous data for easy access. - Can time evaluation be dropped to at most once per main loop event? - Does code work 32 bit and is it optimal? - Should trash stacks be monitored and controlled externally? For example, clearing up after bursts or administrative control. - Should trash stacks have a upper limit to then free to the slice allocator? - Should lost packets be managed as ranges or individual sequence numbers, how does each method affect performance? * The initial draft of PGM included OPT_RANGE option for NAKs to specify a range of lost packets, this was replaced in the final draft with NAK lists. Some research hints that ranges are suitable: http://www.isoc.org/inet2001/CD_proceedings/T54/T54.htm http://tools.ietf.org/html/draft-speakman-pgm-spec-01 - Are place holders necessary? Can state timeouts be managed without a per sequence number object? For example by the next data object, or an extra object for an ncf extended window: note that nak packet generation should easily dwarfs time spent unless advantage is taken of the additional 62 naks in a opt_nak_list. Caution has to be taken with the cost of splitting a range when a packet is inserted in the middle, although idealy it should be sequential from the trailing edge. - Is it better to have send sockets per transport, or shared, bound to each interface? - Cost of sharing state helper lists between receive windows? On culling a peer the lists have to be purged. Saves iterating the hash list of receivers. - Encapsulated UDP lists two ports, 3305 for broadcast, 3306 for unicast, how is this supposed to map to regular PGM, and why the split? Basic TODO list *************** - Ensure standardised error handling and status reporting. - Implement mechanism for data-loss feedback. - OPT_SYN & OPT_FIN on sending side. - Shared trash stacks between multiple receive windows (contexts). - Shared trash stacks between transmit and receive windows. - FEC: compatibility with SmartPGM FEC, MS FEC? - NAK backoff learning. - Full conformance testing. (nak backoffs remaining) - Unit testing. - System testing with valgrind. - Performance testing with oprofile. - Basic DLR. - Implement PGM sender (only) support thread? - eventfd instead of pipes for recent Linux kernels. Optionals ********* - Some form of broadcast statistics for passive monitoring. - (fix) BCH Reed-Solomon codec as possibly faster alternative, albeit incompatible with Microsoft. - Recommendations as per the RMT working group of the IETF for AL-FEC codecs: Raptor codes, LDPC- staircase and LDPC-triangle codes. - XDR based messaging format as example of binary encoded messaging. libpgm-5.1.118-1~dfsg/openpgm/pgm/include/0000755000175000017500000000000011640407424017164 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/0000755000175000017500000000000011640407424017747 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/log.h0000644000175000017500000000205211640407352020700 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * basic logging. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_LOG_H__ #define __PGM_LOG_H__ #include PGM_BEGIN_DECLS bool log_init (void); PGM_END_DECLS #endif /* __PGM_LOG_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/msgv.h0000644000175000017500000000301011640407352021066 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Vector message container * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_MSGV_H__ #define __PGM_MSGV_H__ struct pgm_iovec; struct pgm_msgv_t; #include #include #include PGM_BEGIN_DECLS /* struct for scatter/gather I/O */ struct pgm_iovec { #ifndef _WIN32 /* match struct iovec */ void* iov_base; size_t iov_len; /* size of iov_base */ #else /* match WSABUF */ u_long iov_len; char* iov_base; #endif /* _WIN32 */ }; struct pgm_msgv_t { uint32_t msgv_len; /* number of elements in skb */ struct pgm_sk_buff_t* msgv_skb[PGM_MAX_FRAGMENTS]; /* PGM socket buffer array */ }; PGM_END_DECLS #endif /* __PGM_MSGV_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/atomic.h0000644000175000017500000001234011640407352021374 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * 32-bit atomic operations. * * NB: XADD requires 80486 microprocessor. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_ATOMIC_H__ #define __PGM_ATOMIC_H__ #if defined( __sun ) # include #elif defined( __APPLE__ ) # include #elif defined( _MSC_VER ) /* not implemented in MinGW */ # include #endif #include /* 32-bit word addition returning original atomic value. * * uint32_t tmp = *atomic; * *atomic += val; * return tmp; */ static inline uint32_t pgm_atomic_exchange_and_add32 ( volatile uint32_t* atomic, const uint32_t val ) { #if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) uint32_t result; __asm__ volatile ("lock; xaddl %0, %1" : "=r" (result), "=m" (*atomic) : "0" (val), "m" (*atomic) : "memory", "cc" ); return result; #elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && (defined( __i386 ) || defined( __amd64 )) uint32_t result = val; __asm__ volatile ("lock; xaddl %0, %1" :: "r" (result), "m" (*atomic) ); return result; #elif defined( __sun ) /* Solaris intrinsic */ const uint32_t nv = atomic_add_32_nv (atomic, (int32_t)val); return nv - val; #elif defined( __APPLE__ ) /* Darwin intrinsic */ const uint32_t nv = OSAtomicAdd32Barrier ((int32_t)val, (volatile int32_t*)atomic); return nv - val; #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* GCC 4.0.1 intrinsic */ return __sync_fetch_and_add (atomic, val); #elif defined( _WIN32 ) /* Windows intrinsic */ return _InterlockedExchangeAdd ((volatile LONG*)atomic, val); #else # error "No supported atomic operations for this platform." #endif } /* 32-bit word addition. * * *atomic += val; */ static inline void pgm_atomic_add32 ( volatile uint32_t* atomic, const uint32_t val ) { #if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) __asm__ volatile ("lock; addl %1, %0" : "=m" (*atomic) : "ir" (val), "m" (*atomic) : "memory", "cc" ); #elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && (defined( __i386 ) || defined( __amd64 )) __asm__ volatile ("lock; addl %1, %0" :: "r" (val), "m" (*atomic) ); #elif defined( __sun ) atomic_add_32 (atomic, (int32_t)val); #elif defined( __APPLE__ ) OSAtomicAdd32Barrier ((int32_t)val, (volatile int32_t*)atomic); #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* interchangable with __sync_fetch_and_add () */ __sync_add_and_fetch (atomic, val); #elif defined( _WIN32 ) _InterlockedExchangeAdd ((volatile LONG*)atomic, val); #endif } /* 32-bit word increment. * * *atomic++; */ static inline void pgm_atomic_inc32 ( volatile uint32_t* atomic ) { #if defined( __GNUC__ ) && (defined( __i386__ ) || defined( __x86_64__ )) __asm__ volatile ("lock; incl %0" : "+m" (*atomic) : : "memory", "cc" ); #elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && (defined( __i386 ) || defined( __amd64 )) __asm__ volatile ("lock; incl %0" :: "m" (*atomic) ); #elif defined( __sun ) atomic_inc_32 (atomic); #elif defined( __APPLE__ ) OSAtomicIncrement32Barrier ((volatile int32_t*)atomic); #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) pgm_atomic_add32 (atomic, 1); #elif defined( _WIN32 ) _InterlockedIncrement ((volatile LONG*)atomic); #endif } /* 32-bit word decrement. * * *atomic--; */ static inline void pgm_atomic_dec32 ( volatile uint32_t* atomic ) { #if defined( __GNUC__ ) && (defined( __i386__ ) || defined( __x86_64__ )) __asm__ volatile ("lock; decl %0" : "+m" (*atomic) : : "memory", "cc" ); #elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && (defined( __i386 ) || defined( __amd64 )) __asm__ volatile ("lock\n\t" "decl %0" :: "m" (*atomic) ); #elif defined( __sun ) atomic_dec_32 (atomic); #elif defined( __APPLE__ ) OSAtomicDecrement32Barrier ((volatile int32_t*)atomic); #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) pgm_atomic_add32 (atomic, (uint32_t)-1); #elif defined( _WIN32 ) _InterlockedDecrement ((volatile LONG*)atomic); #endif } /* 32-bit word load */ static inline uint32_t pgm_atomic_read32 ( const volatile uint32_t* atomic ) { return *atomic; } /* 32-bit word store */ static inline void pgm_atomic_write32 ( volatile uint32_t* atomic, const uint32_t val ) { *atomic = val; } #endif /* __PGM_ATOMIC_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/tsi.h0000644000175000017500000000326211640407352020722 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * transport session ID helper functions * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_TSI_H__ #define __PGM_TSI_H__ typedef struct pgm_tsi_t pgm_tsi_t; #include #include PGM_BEGIN_DECLS /* maximum length of TSI as a string */ #define PGM_TSISTRLEN (sizeof("000.000.000.000.000.000.00000")) #define PGM_TSI_INIT { PGM_GSI_INIT, 0 } struct pgm_tsi_t { pgm_gsi_t gsi; /* global session identifier */ uint16_t sport; /* source port: a random number to help detect session re-starts */ }; PGM_STATIC_ASSERT(sizeof(struct pgm_tsi_t) == 8); char* pgm_tsi_print (const pgm_tsi_t*) PGM_GNUC_WARN_UNUSED_RESULT; int pgm_tsi_print_r (const pgm_tsi_t*restrict, char*restrict, size_t); bool pgm_tsi_equal (const void*restrict, const void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_TSI_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/version.h0000644000175000017500000000253011640407352021605 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * OpenPGM version. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_VERSION_H__ #define __PGM_VERSION_H__ #include PGM_BEGIN_DECLS extern const unsigned pgm_major_version; extern const unsigned pgm_minor_version; extern const unsigned pgm_micro_version; extern const char* pgm_build_date; extern const char* pgm_build_time; extern const char* pgm_build_system; extern const char* pgm_build_machine; extern const char* pgm_build_revision; PGM_END_DECLS #endif /* __PGM_VERSION_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/packet.h0000644000175000017500000003430011640407352021367 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM packet formats, RFC 3208. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_PACKET_H__ #define __PGM_PACKET_H__ #ifndef _WIN32 # include # include # include #endif #include PGM_BEGIN_DECLS /* protocol number assigned by IANA */ #ifndef IPPROTO_PGM # define IPPROTO_PGM 113 #endif /* read from /etc/protocols if available */ extern int pgm_ipproto_pgm; /* address family indicator, rfc 1700 (ADDRESS FAMILY NUMBERS) */ #ifndef AFI_IP # define AFI_IP 1 /* IP (IP version 4) */ # define AFI_IP6 2 /* IP6 (IP version 6) */ #endif /* UDP ports for UDP encapsulation, as per IBM WebSphere MQ */ #define DEFAULT_UDP_ENCAP_UCAST_PORT 3055 #define DEFAULT_UDP_ENCAP_MCAST_PORT 3056 /* PGM default ports */ #define DEFAULT_DATA_DESTINATION_PORT 7500 #define DEFAULT_DATA_SOURCE_PORT 0 /* random */ /* DoS limitation to protocol (MS08-036, KB950762) */ #ifndef PGM_MAX_APDU # define PGM_MAX_APDU UINT16_MAX #endif /* Cisco default: 24 (max 8200), Juniper & H3C default: 16, SmartPGM: 64 */ #ifndef PGM_MAX_FRAGMENTS # define PGM_MAX_FRAGMENTS 16 #endif enum pgm_type_e { PGM_SPM = 0x00, /* 8.1: source path message */ PGM_POLL = 0x01, /* 14.7.1: poll request */ PGM_POLR = 0x02, /* 14.7.2: poll response */ PGM_ODATA = 0x04, /* 8.2: original data */ PGM_RDATA = 0x05, /* 8.2: repair data */ PGM_NAK = 0x08, /* 8.3: NAK or negative acknowledgement */ PGM_NNAK = 0x09, /* 8.3: N-NAK or null negative acknowledgement */ PGM_NCF = 0x0a, /* 8.3: NCF or NAK confirmation */ PGM_SPMR = 0x0c, /* 13.6: SPM request */ PGM_ACK = 0x0d, /* PGMCC: congestion control ACK */ PGM_MAX = 0xff }; #define PGM_OPT_LENGTH 0x00 /* options length */ #define PGM_OPT_FRAGMENT 0x01 /* fragmentation */ #define PGM_OPT_NAK_LIST 0x02 /* list of nak entries */ #define PGM_OPT_JOIN 0x03 /* late joining */ #define PGM_OPT_REDIRECT 0x07 /* redirect */ #define PGM_OPT_SYN 0x0d /* synchronisation */ #define PGM_OPT_FIN 0x0e /* session end */ #define PGM_OPT_RST 0x0f /* session reset */ #define PGM_OPT_PARITY_PRM 0x08 /* forward error correction parameters */ #define PGM_OPT_PARITY_GRP 0x09 /* group number */ #define PGM_OPT_CURR_TGSIZE 0x0a /* group size */ #define PGM_OPT_CR 0x10 /* congestion report */ #define PGM_OPT_CRQST 0x11 /* congestion report request */ #define PGM_OPT_PGMCC_DATA 0x12 #define PGM_OPT_PGMCC_FEEDBACK 0x13 #define PGM_OPT_NAK_BO_IVL 0x04 /* nak back-off interval */ #define PGM_OPT_NAK_BO_RNG 0x05 /* nak back-off range */ #define PGM_OPT_NBR_UNREACH 0x0b /* neighbour unreachable */ #define PGM_OPT_PATH_NLA 0x0c /* path nla */ #define PGM_OPT_INVALID 0x7f /* option invalidated */ /* byte alignment for packet memory maps */ #if defined( __GNUC__ ) && !defined( __sun ) # pragma pack(push) #endif #pragma pack(1) /* 8. PGM header */ struct pgm_header { uint16_t pgm_sport; /* source port: tsi::sport or UDP port depending on direction */ uint16_t pgm_dport; /* destination port */ uint8_t pgm_type; /* version / packet type */ uint8_t pgm_options; /* options */ #define PGM_OPT_PARITY 0x80 /* parity packet */ #define PGM_OPT_VAR_PKTLEN 0x40 /* + variable sized packets */ #define PGM_OPT_NETWORK 0x02 /* network-significant: must be interpreted by network elements */ #define PGM_OPT_PRESENT 0x01 /* option extension are present */ uint16_t pgm_checksum; /* checksum */ uint8_t pgm_gsi[6]; /* global source id */ uint16_t pgm_tsdu_length; /* tsdu length */ /* tpdu length = th length (header + options) + tsdu length */ }; /* 8.1. Source Path Messages (SPM) */ struct pgm_spm { uint32_t spm_sqn; /* spm sequence number */ uint32_t spm_trail; /* trailing edge sequence number */ uint32_t spm_lead; /* leading edge sequence number */ uint16_t spm_nla_afi; /* nla afi */ uint16_t spm_reserved; /* reserved */ struct in_addr spm_nla; /* path nla */ /* ... option extensions */ }; struct pgm_spm6 { uint32_t spm6_sqn; /* spm sequence number */ uint32_t spm6_trail; /* trailing edge sequence number */ uint32_t spm6_lead; /* leading edge sequence number */ uint16_t spm6_nla_afi; /* nla afi */ uint16_t spm6_reserved; /* reserved */ struct in6_addr spm6_nla; /* path nla */ /* ... option extensions */ }; /* 8.2. Data Packet */ struct pgm_data { uint32_t data_sqn; /* data packet sequence number */ uint32_t data_trail; /* trailing edge sequence number */ /* ... option extensions */ /* ... data */ }; /* 8.3. Negative Acknowledgments and Confirmations (NAK, N-NAK, & NCF) */ struct pgm_nak { uint32_t nak_sqn; /* requested sequence number */ uint16_t nak_src_nla_afi; /* nla afi */ uint16_t nak_reserved; /* reserved */ struct in_addr nak_src_nla; /* source nla */ uint16_t nak_grp_nla_afi; /* nla afi */ uint16_t nak_reserved2; /* reserved */ struct in_addr nak_grp_nla; /* multicast group nla */ /* ... option extension */ }; struct pgm_nak6 { uint32_t nak6_sqn; /* requested sequence number */ uint16_t nak6_src_nla_afi; /* nla afi */ uint16_t nak6_reserved; /* reserved */ struct in6_addr nak6_src_nla; /* source nla */ uint16_t nak6_grp_nla_afi; /* nla afi */ uint16_t nak6_reserved2; /* reserved */ struct in6_addr nak6_grp_nla; /* multicast group nla */ /* ... option extension */ }; /* 9. Option header (max 16 per packet) */ struct pgm_opt_header { uint8_t opt_type; /* option type */ #define PGM_OPT_MASK 0x7f #define PGM_OPT_END 0x80 /* end of options flag */ uint8_t opt_length; /* option length */ uint8_t opt_reserved; #define PGM_OP_ENCODED 0x8 /* F-bit */ #define PGM_OPX_MASK 0x3 #define PGM_OPX_IGNORE 0x0 /* extensibility bits */ #define PGM_OPX_INVALIDATE 0x1 #define PGM_OPX_DISCARD 0x2 #define PGM_OP_ENCODED_NULL 0x80 /* U-bit */ }; /* 9.1. Option extension length - OPT_LENGTH */ struct pgm_opt_length { uint8_t opt_type; /* include header as total length overwrites reserved/OPX bits */ uint8_t opt_length; uint16_t opt_total_length; /* total length of all options */ }; /* 9.2. Option fragment - OPT_FRAGMENT */ struct pgm_opt_fragment { uint8_t opt_reserved; /* reserved */ uint32_t opt_sqn; /* first sequence number */ uint32_t opt_frag_off; /* offset */ uint32_t opt_frag_len; /* length */ }; /* 9.3.5. Option NAK List - OPT_NAK_LIST * * GNU C allows opt_sqn[0], ISO C89 requireqs opt_sqn[1], ISO C99 permits opt_sqn[] */ struct pgm_opt_nak_list { uint8_t opt_reserved; /* reserved */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 flexible array, sizeof() invalid */ uint32_t opt_sqn[]; /* requested sequence number [62] */ #elif !defined(__STDC_VERSION__) || defined(__cplusplus) /* C90 and older */ uint32_t opt_sqn[1]; #else /* GNU C variable-length object */ uint32_t opt_sqn[0]; #endif }; /* 9.4.2. Option Join - OPT_JOIN */ struct pgm_opt_join { uint8_t opt_reserved; /* reserved */ uint32_t opt_join_min; /* minimum sequence number */ }; /* 9.5.5. Option Redirect - OPT_REDIRECT */ struct pgm_opt_redirect { uint8_t opt_reserved; /* reserved */ uint16_t opt_nla_afi; /* nla afi */ uint16_t opt_reserved2; /* reserved */ struct in_addr opt_nla; /* dlr nla */ }; struct pgm_opt6_redirect { uint8_t opt6_reserved; /* reserved */ uint16_t opt6_nla_afi; /* nla afi */ uint16_t opt6_reserved2; /* reserved */ struct in6_addr opt6_nla; /* dlr nla */ }; /* 9.6.2. Option Sources - OPT_SYN */ struct pgm_opt_syn { uint8_t opt_reserved; /* reserved */ }; /* 9.7.4. Option End Session - OPT_FIN */ struct pgm_opt_fin { uint8_t opt_reserved; /* reserved */ }; /* 9.8.4. Option Reset - OPT_RST */ struct pgm_opt_rst { uint8_t opt_reserved; /* reserved */ }; /* * Forward Error Correction - FEC */ /* 11.8.1. Option Parity - OPT_PARITY_PRM */ struct pgm_opt_parity_prm { uint8_t opt_reserved; /* reserved */ #define PGM_PARITY_PRM_MASK 0x3 #define PGM_PARITY_PRM_PRO 0x1 /* source provides pro-active parity packets */ #define PGM_PARITY_PRM_OND 0x2 /* on-demand parity packets */ uint32_t parity_prm_tgs; /* transmission group size */ }; /* 11.8.2. Option Parity Group - OPT_PARITY_GRP */ struct pgm_opt_parity_grp { uint8_t opt_reserved; /* reserved */ uint32_t prm_group; /* parity group number */ }; /* 11.8.3. Option Current Transmission Group Size - OPT_CURR_TGSIZE */ struct pgm_opt_curr_tgsize { uint8_t opt_reserved; /* reserved */ uint32_t prm_atgsize; /* actual transmission group size */ }; /* * Congestion Control */ /* 12.7.1. Option Congestion Report - OPT_CR */ struct pgm_opt_cr { uint8_t opt_reserved; /* reserved */ #define PGM_OPT_CR_NEL 0x0 /* OPT_CR_NE_WL report */ #define PGM_OPT_CR_NEP 0x1 /* OPT_CR_NE_WP report */ #define PGM_OPT_CR_RXP 0x2 /* OPT_CR_RX_WP report */ uint32_t opt_cr_lead; /* congestion report reference sqn */ uint16_t opt_cr_ne_wl; /* ne worst link */ uint16_t opt_cr_ne_wp; /* ne worst path */ uint16_t opt_cr_rx_wp; /* rcvr worst path */ uint16_t opt_reserved2; /* reserved */ uint16_t opt_nla_afi; /* nla afi */ uint16_t opt_reserved3; /* reserved */ uint32_t opt_cr_rcvr; /* worst receivers nla */ }; /* 12.7.2. Option Congestion Report Request - OPT_CRQST */ struct pgm_opt_crqst { uint8_t opt_reserved; /* reserved */ #define PGM_OPT_CRQST_NEL 0x0 /* request OPT_CR_NE_WL report */ #define PGM_OPT_CRQST_NEP 0x1 /* request OPT_CR_NE_WP report */ #define PGM_OPT_CRQST_RXP 0x2 /* request OPT_CR_RX_WP report */ }; /* PGMCC. ACK Packet */ struct pgm_ack { uint32_t ack_rx_max; /* RX_MAX */ uint32_t ack_bitmap; /* received packets */ /* ... option extensions */ }; /* PGMCC Options */ struct pgm_opt_pgmcc_data { uint8_t opt_reserved; /* reserved */ uint32_t opt_tstamp; /* timestamp */ uint16_t opt_nla_afi; /* nla afi */ uint16_t opt_reserved2; /* reserved */ struct in_addr opt_nla; /* ACKER nla */ }; struct pgm_opt6_pgmcc_data { uint8_t opt6_reserved; /* reserved */ uint32_t opt6_tstamp; /* timestamp */ uint16_t opt6_nla_afi; /* nla afi */ uint16_t opt6_reserved2; /* reserved */ struct in6_addr opt6_nla; /* ACKER nla */ }; struct pgm_opt_pgmcc_feedback { uint8_t opt_reserved; /* reserved */ uint32_t opt_tstamp; /* timestamp */ uint16_t opt_nla_afi; /* nla afi */ uint16_t opt_loss_rate; /* loss rate */ struct in_addr opt_nla; /* ACKER nla */ }; struct pgm_opt6_pgmcc_feedback { uint8_t opt6_reserved; /* reserved */ uint32_t opt6_tstamp; /* timestamp */ uint16_t opt6_nla_afi; /* nla afi */ uint16_t opt6_loss_rate; /* loss rate */ struct in6_addr opt6_nla; /* ACKER nla */ }; /* * SPM Requests */ /* 13.6. SPM Requests */ #if 0 struct pgm_spmr { /* ... option extensions */ }; #endif /* * Poll Mechanism */ /* 14.7.1. Poll Request */ struct pgm_poll { uint32_t poll_sqn; /* poll sequence number */ uint16_t poll_round; /* poll round */ uint16_t poll_s_type; /* poll sub-type */ #define PGM_POLL_GENERAL 0x0 /* general poll */ #define PGM_POLL_DLR 0x1 /* DLR poll */ uint16_t poll_nla_afi; /* nla afi */ uint16_t poll_reserved; /* reserved */ struct in_addr poll_nla; /* path nla */ uint32_t poll_bo_ivl; /* poll back-off interval */ char poll_rand[4]; /* random string */ uint32_t poll_mask; /* matching bit-mask */ /* ... option extensions */ }; struct pgm_poll6 { uint32_t poll6_sqn; /* poll sequence number */ uint16_t poll6_round; /* poll round */ uint16_t poll6_s_type; /* poll sub-type */ uint16_t poll6_nla_afi; /* nla afi */ uint16_t poll6_reserved; /* reserved */ struct in6_addr poll6_nla; /* path nla */ uint32_t poll6_bo_ivl; /* poll back-off interval */ char poll6_rand[4]; /* random string */ uint32_t poll6_mask; /* matching bit-mask */ /* ... option extensions */ }; /* 14.7.2. Poll Response */ struct pgm_polr { uint32_t polr_sqn; /* polr sequence number */ uint16_t polr_round; /* polr round */ uint16_t polr_reserved; /* reserved */ /* ... option extensions */ }; /* * Implosion Prevention */ /* 15.4.1. Option NAK Back-Off Interval - OPT_NAK_BO_IVL */ struct pgm_opt_nak_bo_ivl { uint8_t opt_reserved; /* reserved */ uint32_t opt_nak_bo_ivl; /* nak back-off interval */ uint32_t opt_nak_bo_ivl_sqn; /* nak back-off interval sqn */ }; /* 15.4.2. Option NAK Back-Off Range - OPT_NAK_BO_RNG */ struct pgm_opt_nak_bo_rng { uint8_t opt_reserved; /* reserved */ uint32_t opt_nak_max_bo_ivl; /* maximum nak back-off interval */ uint32_t opt_nak_min_bo_ivl; /* minimum nak back-off interval */ }; /* 15.4.3. Option Neighbour Unreachable - OPT_NBR_UNREACH */ struct pgm_opt_nbr_unreach { uint8_t opt_reserved; /* reserved */ }; /* 15.4.4. Option Path - OPT_PATH_NLA */ struct pgm_opt_path_nla { uint8_t opt_reserved; /* reserved */ struct in_addr opt_path_nla; /* path nla */ }; struct pgm_opt6_path_nla { uint8_t opt6_reserved; /* reserved */ struct in6_addr opt6_path_nla; /* path nla */ }; #if defined( __GNUC__ ) && !defined( __sun ) # pragma pack(pop) #else # pragma pack() #endif #define PGM_IS_UPSTREAM(t) \ ((t) == PGM_NAK /* unicast */ \ || (t) == PGM_NNAK /* unicast */ \ || (t) == PGM_SPMR /* multicast + unicast */ \ || (t) == PGM_POLR /* unicast */ \ || (t) == PGM_ACK) /* unicast */ #define PGM_IS_PEER(t) \ ((t) == PGM_SPMR) /* multicast */ #define PGM_IS_DOWNSTREAM(t) \ ((t) == PGM_SPM /* all types are multicast */ \ || (t) == PGM_ODATA \ || (t) == PGM_RDATA \ || (t) == PGM_POLL \ || (t) == PGM_NCF) PGM_END_DECLS #endif /* __PGM_PACKET_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/error.h0000644000175000017500000000627011640407352021256 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable error reporting. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_ERROR_H__ #define __PGM_ERROR_H__ typedef struct pgm_error_t pgm_error_t; #include PGM_BEGIN_DECLS /* error domains */ enum { PGM_ERROR_DOMAIN_IF, /* interface and host */ PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_DOMAIN_RECV, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_DOMAIN_ENGINE, PGM_ERROR_DOMAIN_HTTP, PGM_ERROR_DOMAIN_SNMP }; /* error codes */ enum { /* Derived from errno, eai_errno, etc */ PGM_ERROR_ADDRFAMILY, /* EAI_ADDRFAMILY */ PGM_ERROR_AFNOSUPPORT, /* EAI_FAMILY */ PGM_ERROR_AGAIN, PGM_ERROR_BADE, /* ERROR_INVALID_DATA */ PGM_ERROR_BADF, PGM_ERROR_BOUNDS, /* sequence out-of-bounds */ PGM_ERROR_CKSUM, /* pkt cksum incorrect */ PGM_ERROR_CONNRESET, PGM_ERROR_FAIL, /* EAI_FAIL */ PGM_ERROR_FAULT, PGM_ERROR_INPROGRESS, /* WSAEINPROGRESS */ PGM_ERROR_INTR, PGM_ERROR_INVAL, PGM_ERROR_MFILE, PGM_ERROR_NFILE, PGM_ERROR_NOBUFS, /* ERROR_BUFFER_OVERFLOW */ PGM_ERROR_NODATA, /* EAI_NODATA */ PGM_ERROR_NODEV, PGM_ERROR_NOENT, PGM_ERROR_NOMEM, PGM_ERROR_NONAME, /* EAI_NONAME */ PGM_ERROR_NONET, PGM_ERROR_NOPROTOOPT, PGM_ERROR_NOSYS, /* ERROR_NOT_SUPPORTED */ PGM_ERROR_NOTUNIQ, PGM_ERROR_NXIO, PGM_ERROR_PERM, PGM_ERROR_PROCLIM, /* WSAEPROCLIM */ PGM_ERROR_PROTO, PGM_ERROR_RANGE, PGM_ERROR_SERVICE, /* EAI_SERVICE */ PGM_ERROR_SOCKTNOSUPPORT, /* EAI_SOCKTYPE */ PGM_ERROR_SYSNOTAREADY, /* WSASYSNOTAREADY */ PGM_ERROR_SYSTEM, /* EAI_SYSTEM */ PGM_ERROR_VERNOTSUPPORTED, /* WSAVERNOTSUPPORTED */ PGM_ERROR_XDEV, PGM_ERROR_FAILED /* generic error */ }; struct pgm_error_t { int domain; int code; char* message; }; void pgm_error_free (pgm_error_t*); void pgm_set_error (pgm_error_t**restrict, const int, const int, const char*restrict, ...) PGM_GNUC_PRINTF (4, 5); void pgm_propagate_error (pgm_error_t**restrict, pgm_error_t*restrict); void pgm_clear_error (pgm_error_t**); void pgm_prefix_error (pgm_error_t**restrict, const char*restrict, ...) PGM_GNUC_PRINTF (2, 3); int pgm_error_from_errno (const int) PGM_GNUC_CONST; int pgm_error_from_h_errno (const int) PGM_GNUC_CONST; int pgm_error_from_eai_errno (const int, const int) PGM_GNUC_CONST; int pgm_error_from_wsa_errno (const int) PGM_GNUC_CONST; int pgm_error_from_win_errno (const int) PGM_GNUC_CONST; PGM_END_DECLS #endif /* __PGM_ERROR_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/in.h0000644000175000017500000000275011640407352020532 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Sections 5 and 8.2 of RFC 3768: Multicast group request * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IN_H__ #define __PGM_IN_H__ #include #include #include /* sections 5 and 8.2 of RFC 3768: Multicast group request */ struct group_req { uint32_t gr_interface; /* interface index */ struct sockaddr_storage gr_group; /* group address */ }; struct group_source_req { uint32_t gsr_interface; /* interface index */ struct sockaddr_storage gsr_group; /* group address */ struct sockaddr_storage gsr_source; /* group source */ }; PGM_BEGIN_DECLS /* nc */ PGM_END_DECLS #endif /* __PGM_IN_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/gsi.h0000644000175000017500000000351111640407352020702 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * global session ID helper functions * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_GSI_H__ #define __PGM_GSI_H__ typedef struct pgm_gsi_t pgm_gsi_t; #include #include PGM_BEGIN_DECLS #define PGM_GSISTRLEN (sizeof("000.000.000.000.000.000")) #define PGM_GSI_INIT {{ 0, 0, 0, 0, 0, 0 }} struct pgm_gsi_t { uint8_t identifier[6]; }; PGM_STATIC_ASSERT(sizeof(struct pgm_gsi_t) == 6); bool pgm_gsi_create_from_hostname (pgm_gsi_t*restrict, pgm_error_t**restrict); bool pgm_gsi_create_from_addr (pgm_gsi_t*restrict, pgm_error_t**restrict); bool pgm_gsi_create_from_data (pgm_gsi_t*restrict, const uint8_t*restrict, const size_t); bool pgm_gsi_create_from_string (pgm_gsi_t*restrict, const char*restrict, ssize_t); int pgm_gsi_print_r (const pgm_gsi_t*restrict, char*restrict, const size_t); char* pgm_gsi_print (const pgm_gsi_t*); bool pgm_gsi_equal (const void*restrict, const void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_GSI_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/socket.h0000644000175000017500000001476611640407352021426 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM socket. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_SOCKET_H__ #define __PGM_SOCKET_H__ typedef struct pgm_sock_t pgm_sock_t; struct pgm_sockaddr_t; struct pgm_addrinfo_t; struct pgm_fecinto_t; #ifdef CONFIG_HAVE_POLL # include #endif #ifdef CONFIG_HAVE_EPOLL # include #endif #ifndef _WIN32 # include # include #endif #include #include #include #include PGM_BEGIN_DECLS struct pgm_sockaddr_t { uint16_t sa_port; /* data-destination port */ pgm_tsi_t sa_addr; }; struct pgm_addrinfo_t { sa_family_t ai_family; uint32_t ai_recv_addrs_len; struct group_source_req* restrict ai_recv_addrs; uint32_t ai_send_addrs_len; struct group_source_req* restrict ai_send_addrs; }; struct pgm_interface_req_t { uint32_t ir_interface; uint32_t ir_scope_id; }; struct pgm_fecinfo_t { uint8_t block_size; uint8_t proactive_packets; uint8_t group_size; bool ondemand_parity_enabled; bool var_pktlen_enabled; }; struct pgm_pgmccinfo_t { uint32_t ack_bo_ivl; uint32_t ack_c; uint32_t ack_c_p; }; /* socket options */ enum { PGM_SEND_SOCK = 0x2000, PGM_RECV_SOCK, PGM_REPAIR_SOCK, PGM_PENDING_SOCK, PGM_ACK_SOCK, PGM_TIME_REMAIN, PGM_RATE_REMAIN, PGM_IP_ROUTER_ALERT, PGM_MTU, PGM_MSSS, PGM_MSS, PGM_PDU, PGM_MULTICAST_LOOP, PGM_MULTICAST_HOPS, PGM_TOS, PGM_AMBIENT_SPM, PGM_HEARTBEAT_SPM, PGM_TXW_BYTES, PGM_TXW_SQNS, PGM_TXW_SECS, PGM_TXW_MAX_RTE, PGM_PEER_EXPIRY, PGM_SPMR_EXPIRY, PGM_RXW_BYTES, PGM_RXW_SQNS, PGM_RXW_SECS, PGM_RXW_MAX_RTE, PGM_NAK_BO_IVL, PGM_NAK_RPT_IVL, PGM_NAK_RDATA_IVL, PGM_NAK_DATA_RETRIES, PGM_NAK_NCF_RETRIES, PGM_USE_FEC, PGM_USE_CR, PGM_USE_PGMCC, PGM_SEND_ONLY, PGM_RECV_ONLY, PGM_PASSIVE, PGM_ABORT_ON_RESET, PGM_NOBLOCK, PGM_SEND_GROUP, PGM_JOIN_GROUP, PGM_LEAVE_GROUP, PGM_BLOCK_SOURCE, PGM_UNBLOCK_SOURCE, PGM_JOIN_SOURCE_GROUP, PGM_LEAVE_SOURCE_GROUP, PGM_MSFILTER, PGM_UDP_ENCAP_UCAST_PORT, PGM_UDP_ENCAP_MCAST_PORT, PGM_UNCONTROLLED_ODATA, PGM_UNCONTROLLED_RDATA, PGM_ODATA_MAX_RTE, PGM_RDATA_MAX_RTE }; /* IO status */ enum { PGM_IO_STATUS_ERROR, /* an error occurred */ PGM_IO_STATUS_NORMAL, /* success */ PGM_IO_STATUS_RESET, /* session reset */ PGM_IO_STATUS_FIN, /* session finished */ PGM_IO_STATUS_EOF, /* socket closed */ PGM_IO_STATUS_WOULD_BLOCK, /* resource temporarily unavailable */ PGM_IO_STATUS_RATE_LIMITED, /* would-block on rate limit, check timer */ PGM_IO_STATUS_TIMER_PENDING, /* would-block with pending timer */ PGM_IO_STATUS_CONGESTION /* would-block waiting on ACK or timeout */ }; /* Socket count for event handlers */ #define PGM_SEND_SOCKET_READ_COUNT 3 #define PGM_SEND_SOCKET_WRITE_COUNT 1 #define PGM_RECV_SOCKET_READ_COUNT 2 #define PGM_RECV_SOCKET_WRITE_COUNT 0 #define PGM_BUS_SOCKET_READ_COUNT PGM_SEND_SOCKET_READ_COUNT #define PGM_BUS_SOCKET_WRITE_COUNT PGM_SEND_SOCKET_WRITE_COUNT bool pgm_socket (pgm_sock_t**restrict, const sa_family_t, const int, const int, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_bind (pgm_sock_t*restrict, const struct pgm_sockaddr_t*const restrict, const socklen_t, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_bind3 (pgm_sock_t*restrict, const struct pgm_sockaddr_t*const restrict, const socklen_t, const struct pgm_interface_req_t*const, const socklen_t, const struct pgm_interface_req_t*const, const socklen_t, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_connect (pgm_sock_t*restrict, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_close (pgm_sock_t*, bool); bool pgm_setsockopt (pgm_sock_t*const restrict, const int, const int, const void*restrict, const socklen_t); bool pgm_getsockopt (pgm_sock_t*const restrict, const int, const int, void*restrict, socklen_t*restrict); bool pgm_getaddrinfo (const char*restrict, const struct pgm_addrinfo_t*const restrict, struct pgm_addrinfo_t**restrict, pgm_error_t**restrict); void pgm_freeaddrinfo (struct pgm_addrinfo_t*); int pgm_send (pgm_sock_t*const restrict, const void*restrict, const size_t, size_t*restrict); int pgm_sendv (pgm_sock_t*const restrict, const struct pgm_iovec*const restrict, const unsigned, const bool, size_t*restrict); int pgm_send_skbv (pgm_sock_t*const restrict, struct pgm_sk_buff_t**const restrict, const unsigned, const bool, size_t*restrict); int pgm_recvmsg (pgm_sock_t*const restrict, struct pgm_msgv_t*const restrict, const int, size_t*restrict, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; int pgm_recvmsgv (pgm_sock_t*const restrict, struct pgm_msgv_t*const restrict, const size_t, const int, size_t*restrict, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; int pgm_recv (pgm_sock_t*const restrict, void*restrict, const size_t, const int, size_t*const restrict, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; int pgm_recvfrom (pgm_sock_t*const restrict, void*restrict, const size_t, const int, size_t*restrict, struct pgm_sockaddr_t*restrict, socklen_t*restrict, pgm_error_t**restrict) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_getsockname (pgm_sock_t*const restrict, struct pgm_sockaddr_t*restrict, socklen_t*restrict); int pgm_select_info (pgm_sock_t*const restrict, fd_set*const restrict, fd_set*const restrict, int*const restrict); #ifdef CONFIG_HAVE_POLL int pgm_poll_info (pgm_sock_t*const restrict, struct pollfd*const restrict, int*const restrict, const short); #elif defined(CONFIG_HAVE_WSAPOLL) int pgm_poll_info (pgm_sock_t*const restrict, WSAPOLLFD*const restrict, ULONG*const restrict, const short); #endif #ifdef CONFIG_HAVE_EPOLL int pgm_epoll_ctl (pgm_sock_t*const, const int, const int, const int); #endif PGM_END_DECLS #endif /* __PGM_SOCKET_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/signal.h0000644000175000017500000000225511640407352021401 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Re-entrant safe signal handling. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_SIGNAL_H__ #define __PGM_SIGNAL_H__ #include #include typedef void (*pgm_sighandler_t)(int, gpointer); G_BEGIN_DECLS gboolean pgm_signal_install (int, pgm_sighandler_t, gpointer); G_END_DECLS #endif /* __PGM_SIGNAL_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/macros.h0000644000175000017500000001271711640407352021414 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Pre-processor macros for cross-platform, cross-compiler ice cream. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_MACROS_H__ #define __PGM_MACROS_H__ /* NULL, ptrdiff_t, and size_t */ #include /* GCC function attributes * http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html */ #if !defined(__APPLE__) && ((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) /* No side-effects except return value, may follow pointers and read globals */ # define PGM_GNUC_PURE __attribute__((__pure__)) /* Returns new memory like malloc() */ # define PGM_GNUC_MALLOC __attribute__((__malloc__)) # define PGM_GNUC_CACHELINE_ALIGNED __attribute__((__aligned__(SMP_CACHE_BYTES), \ __section__((".data.cacheline_aligned"))) # define PGM_GNUC_READ_MOSTLY __attribute__((__section__(".data.read_mostly"))) #else # define PGM_GNUC_PURE # define PGM_GNUC_MALLOC # define PGM_GNUC_CACHELINE_ALIGNED # define PGM_GNUC_READ_MOSTLY #endif #if (__GNUC__ >= 4) /* Variable argument function with NULL terminated list */ # define PGM_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) #else # define PGM_GNUC_NULL_TERMINATED #endif #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) /* malloc() with xth parameter being size */ # define PGM_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) /* malloc() with xth*yth parameters being size */ # define PGM_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) #else # define PGM_GNUC_ALLOC_SIZE(x) # define PGM_GNUC_ALLOC_SIZE2(x,y) #endif #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) /* printf() like function */ # define PGM_GNUC_PRINTF(format, args) __attribute__((__format__ (__printf__, format, args))) # define PGM_GNUC_SCANF(format, args) __attribute__((__format__ (__scanf__, format, args))) # define PGM_GNUC_FORMAT(format) __attribute__((__format_arg__ (format))) /* Function will never return */ # define PGM_GNUC_NORETURN __attribute__((__noreturn__)) /* No side-effects except return value, must not follow pointers or read globals */ # define PGM_GNUC_CONST __attribute__((__const__)) /* Unused function */ # define PGM_GNUC_UNUSED __attribute__((__unused__)) #else /* !__GNUC__ */ # define PGM_GNUC_PRINTF(format, args) # define PGM_GNUC_SCANF(format, args) # define PGM_GNUC_FORMAT(format) # define PGM_GNUC_NORETURN # define PGM_GNUC_CONST # define PGM_GNUC_UNUSED #endif /* !__GNUC__ */ #if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) /* Raise compiler warning if caller ignores return value */ # define PGM_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) # ifdef CONFIG_HAVE_DSO_VISIBILITY /* Hidden visibility */ # define PGM_GNUC_INTERNAL __attribute__((visibility("hidden"))) # else # define PGM_GNUC_INTERNAL # endif #else /* !__GNUC__ */ # define PGM_GNUC_WARN_UNUSED_RESULT # if ((defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)) || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x550))) && defined(CONFIG_HAVE_DSO_VISIBILITY) # define PGM_GNUC_INTERNAL __hidden # else # define PGM_GNUC_INTERNAL # endif #endif /* __GNUC__ */ /* Compiler time assertions, must be on unique lines in the project */ #define PGM_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2 #define PGM_PASTE(identifier1,identifier2) PGM_PASTE_ARGS (identifier1, identifier2) #define PGM_STATIC_ASSERT(expr) typedef struct { char compile_time_assertion[(expr) ? 1 : -1]; } PGM_PASTE (_pgm_static_assert_, __LINE__) /* Function declaration wrappers for C++ */ #ifdef __cplusplus # define PGM_BEGIN_DECLS extern "C" { # define PGM_END_DECLS } #else # define PGM_BEGIN_DECLS # define PGM_END_DECLS #endif /* Surprisingly still not defined in C99 */ #ifndef FALSE # define FALSE (0) #endif #ifndef TRUE # define TRUE (!FALSE) #endif #undef MAX #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #undef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #undef ABS #define ABS(a) (((a) < 0) ? -(a) : (a)) #undef CLAMP #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) /* Number of elements */ #define PGM_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) /* Structure offsets */ #if defined(__GNUC__) && __GNUC__ >= 4 # define PGM_OFFSETOF(struct_type, member) (offsetof (struct_type, member)) #else # define PGM_OFFSETOF(struct_type, member) ((size_t)((char*)&((struct_type*) 0)->member)) #endif /* Branch prediction hint */ #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) # define PGM_LIKELY(expr) __builtin_expect ((expr), 1) # define PGM_UNLIKELY(expr) __builtin_expect ((expr), 0) #else # define PGM_LIKELY(expr) (expr) # define PGM_UNLIKELY(expr) (expr) #endif #endif /* __PGM_MACROS_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/skbuff.h0000644000175000017500000001556111640407352021410 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM socket buffers * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_SKBUFF_H__ #define __PGM_SKBUFF_H__ #include struct pgm_sk_buff_t; #include #include #include #include #include #include #include #include PGM_BEGIN_DECLS struct pgm_sk_buff_t { pgm_list_t link_; pgm_sock_t* restrict sock; pgm_time_t tstamp; pgm_tsi_t tsi; uint32_t sequence; uint32_t __padding; /* push alignment of pgm_sk_buff_t::cb to 8 bytes */ char cb[48]; /* control buffer */ uint16_t len; /* actual data */ unsigned zero_padded:1; unsigned __padding2:31; /* fix bit field */ struct pgm_header* pgm_header; struct pgm_opt_fragment* pgm_opt_fragment; #define of_apdu_first_sqn pgm_opt_fragment->opt_sqn #define of_frag_offset pgm_opt_fragment->opt_frag_off #define of_apdu_len pgm_opt_fragment->opt_frag_len struct pgm_opt_pgmcc_data* pgm_opt_pgmcc_data; struct pgm_data* pgm_data; void *head, /* all may-alias */ *data, *tail, *end; uint32_t truesize; volatile uint32_t users; /* atomic */ }; void pgm_skb_over_panic (const struct pgm_sk_buff_t*const, const uint16_t) PGM_GNUC_NORETURN; void pgm_skb_under_panic (const struct pgm_sk_buff_t*const, const uint16_t) PGM_GNUC_NORETURN; bool pgm_skb_is_valid (const struct pgm_sk_buff_t*const) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; /* attribute __pure__ only valid for platforms with atomic ops. * attribute __malloc__ not used as only part of the memory should be aliased. * attribute __alloc_size__ does not allow headroom. */ static inline struct pgm_sk_buff_t* pgm_alloc_skb (const uint16_t) PGM_GNUC_WARN_UNUSED_RESULT; static inline struct pgm_sk_buff_t* pgm_alloc_skb ( const uint16_t size ) { struct pgm_sk_buff_t* skb; skb = (struct pgm_sk_buff_t*)pgm_malloc (size + sizeof(struct pgm_sk_buff_t)); /* Requires fast FSB to test pgm_prefetchw (skb); */ if (PGM_UNLIKELY(pgm_mem_gc_friendly)) { memset (skb, 0, size + sizeof(struct pgm_sk_buff_t)); skb->zero_padded = 1; } else { memset (skb, 0, sizeof(struct pgm_sk_buff_t)); } skb->truesize = size + sizeof(struct pgm_sk_buff_t); pgm_atomic_write32 (&skb->users, 1); skb->head = skb + 1; skb->data = skb->tail = skb->head; skb->end = (char*)skb->data + size; return skb; } /* increase reference count */ static inline struct pgm_sk_buff_t* pgm_skb_get ( struct pgm_sk_buff_t*const skb ) { pgm_atomic_inc32 (&skb->users); return skb; } static inline void pgm_free_skb ( struct pgm_sk_buff_t*const skb ) { if (pgm_atomic_exchange_and_add32 (&skb->users, (uint32_t)-1) == 1) pgm_free (skb); } /* add data */ static inline void* pgm_skb_put ( struct pgm_sk_buff_t* const skb, const uint16_t len ) { void* tmp = skb->tail; skb->tail = (char*)skb->tail + len; skb->len += len; if (PGM_UNLIKELY(skb->tail > skb->end)) pgm_skb_over_panic (skb, len); return tmp; } static inline void* __pgm_skb_pull ( struct pgm_sk_buff_t*const skb, const uint16_t len ) { skb->len -= len; return skb->data = (char*)skb->data + len; } /* remove data from start of buffer */ static inline void* pgm_skb_pull ( struct pgm_sk_buff_t*const skb, const uint16_t len ) { return PGM_UNLIKELY(len > skb->len) ? NULL : __pgm_skb_pull (skb, len); } static inline uint16_t pgm_skb_headroom (const struct pgm_sk_buff_t*const) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; static inline uint16_t pgm_skb_tailroom (const struct pgm_sk_buff_t*const) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; static inline uint16_t pgm_skb_headroom ( const struct pgm_sk_buff_t*const skb ) { return (uint16_t)((char*)skb->data - (char*)skb->head); } static inline uint16_t pgm_skb_tailroom ( const struct pgm_sk_buff_t*const skb ) { return (uint16_t)((char*)skb->end - (char*)skb->tail); } /* reserve space to add data */ static inline void pgm_skb_reserve ( struct pgm_sk_buff_t*const skb, const uint16_t len ) { skb->data = (char*)skb->data + len; skb->tail = (char*)skb->tail + len; if (PGM_UNLIKELY(skb->tail > skb->end)) pgm_skb_over_panic (skb, len); if (PGM_UNLIKELY(skb->data < skb->head)) pgm_skb_under_panic (skb, len); } static inline struct pgm_sk_buff_t* pgm_skb_copy (const struct pgm_sk_buff_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline struct pgm_sk_buff_t* pgm_skb_copy ( const struct pgm_sk_buff_t* const skb ) { struct pgm_sk_buff_t* newskb; newskb = (struct pgm_sk_buff_t*)pgm_malloc (skb->truesize); memcpy (newskb, skb, PGM_OFFSETOF(struct pgm_sk_buff_t, pgm_header)); newskb->zero_padded = 0; newskb->truesize = skb->truesize; pgm_atomic_write32 (&newskb->users, 1); newskb->head = newskb + 1; newskb->end = (char*)newskb->head + ((char*)skb->end - (char*)skb->head); newskb->data = (char*)newskb->head + ((char*)skb->data - (char*)skb->head); newskb->tail = (char*)newskb->head + ((char*)skb->tail - (char*)skb->head); newskb->pgm_header = skb->pgm_header ? (struct pgm_header*)((char*)newskb->head + ((char*)skb->pgm_header - (char*)skb->head)) : skb->pgm_header; newskb->pgm_opt_fragment = skb->pgm_opt_fragment ? (struct pgm_opt_fragment*)((char*)newskb->head + ((char*)skb->pgm_opt_fragment - (char*)skb->head)) : skb->pgm_opt_fragment; newskb->pgm_data = skb->pgm_data ? (struct pgm_data*)((char*)newskb->head + ((char*)skb->pgm_data - (char*)skb->head)) : skb->pgm_data; memcpy (newskb->head, skb->head, (char*)skb->end - (char*)skb->head); return newskb; } static inline void pgm_skb_zero_pad ( struct pgm_sk_buff_t* const skb, const uint16_t len ) { #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 version */ if (skb->zero_padded) return; const uint16_t tailroom = MIN(pgm_skb_tailroom (skb), len); if (tailroom > 0) memset (skb->tail, 0, tailroom); skb->zero_padded = 1; #else /* C89 version */ const uint16_t tailroom = MIN(pgm_skb_tailroom (skb), len); if (skb->zero_padded) return; if (tailroom > 0) memset (skb->tail, 0, tailroom); skb->zero_padded = 1; #endif } PGM_END_DECLS #endif /* __PGM_SKBUFF_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/wininttypes.h0000644000175000017500000001303711640407352022521 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * inttypes.h for Win32 & Win64 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_WININTTYPES_H__ #define __PGM_WININTTYPES_H__ #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) /* 7.8.1 Macros for format specifiers * * MS runtime does not yet understand C9x standard "ll" * length specifier. It appears to treat "ll" as "l". * The non-standard I64 length specifier causes warning in GCC, * but understood by MS runtime functions. */ /* fprintf macros for signed types */ #define PRId8 "d" #define PRId16 "hd" #define PRId32 "I32d" #define PRId64 "I64d" #define PRIdLEAST8 "d" #define PRIdLEAST16 "hd" #define PRIdLEAST32 "I32d" #define PRIdLEAST64 "I64d" #define PRIdFAST8 "d" #define PRIdFAST16 "hd" #define PRIdFAST32 "I32d" #define PRIdFAST64 "I64d" #define PRIdMAX "I64d" #define PRIi8 "i" #define PRIi16 "hi" #define PRIi32 "i" #define PRIi64 "I64i" #define PRIiLEAST8 "i" #define PRIiLEAST16 "hi" #define PRIiLEAST32 "I32i" #define PRIiLEAST64 "I64i" #define PRIiFAST8 "i" #define PRIiFAST16 "hi" #define PRIiFAST32 "I32i" #define PRIiFAST64 "I64i" #define PRIiMAX "I64i" #define PRIo8 "o" #define PRIo16 "ho" #define PRIo32 "I32o" #define PRIo64 "I64o" #define PRIoLEAST8 "o" #define PRIoLEAST16 "ho" #define PRIoLEAST32 "I32o" #define PRIoLEAST64 "I64o" #define PRIoFAST8 "o" #define PRIoFAST16 "ho" #define PRIoFAST32 "o" #define PRIoFAST64 "I64o" #define PRIoMAX "I64o" /* fprintf macros for unsigned types */ #define PRIu8 "u" #define PRIu16 "hu" #define PRIu32 "I32u" #define PRIu64 "I64u" #define PRIuLEAST8 "u" #define PRIuLEAST16 "hu" #define PRIuLEAST32 "I32u" #define PRIuLEAST64 "I64u" #define PRIuFAST8 "u" #define PRIuFAST16 "hu" #define PRIuFAST32 "I32u" #define PRIuFAST64 "I64u" #define PRIuMAX "I64u" #define PRIx8 "x" #define PRIx16 "hx" #define PRIx32 "I32x" #define PRIx64 "I64x" #define PRIxLEAST8 "x" #define PRIxLEAST16 "hx" #define PRIxLEAST32 "I32x" #define PRIxLEAST64 "I64x" #define PRIxFAST8 "x" #define PRIxFAST16 "hx" #define PRIxFAST32 "I32x" #define PRIxFAST64 "I64x" #define PRIxMAX "I64x" #define PRIX8 "X" #define PRIX16 "hX" #define PRIX32 "I32X" #define PRIX64 "I64X" #define PRIXLEAST8 "X" #define PRIXLEAST16 "hX" #define PRIXLEAST32 "I32X" #define PRIXLEAST64 "I64X" #define PRIXFAST8 "X" #define PRIXFAST16 "hX" #define PRIXFAST32 "I32X" #define PRIXFAST64 "I64X" #define PRIXMAX "I64X" /* fscanf macros for signed int types */ #define SCNd8 "hhd" #define SCNd16 "hd" #define SCNd32 "ld" #define SCNd64 "I64d" #define SCNdLEAST8 "hhd" #define SCNdLEAST16 "hd" #define SCNdLEAST32 "ld" #define SCNdLEAST64 "I64d" #define SCNdFAST8 "hhd" #define SCNdFAST16 "hd" #define SCNdFAST32 "ld" #define SCNdFAST64 "I64d" #define SCNdMAX "I64d" #define SCNi8 "hhi" #define SCNi16 "hi" #define SCNi32 "li" #define SCNi64 "I64i" #define SCNiLEAST8 "hhi" #define SCNiLEAST16 "hi" #define SCNiLEAST32 "li" #define SCNiLEAST64 "I64i" #define SCNiFAST8 "hhi" #define SCNiFAST16 "hi" #define SCNiFAST32 "li" #define SCNiFAST64 "I64i" #define SCNiMAX "I64i" #define SCNo8 "hho" #define SCNo16 "ho" #define SCNo32 "lo" #define SCNo64 "I64o" #define SCNoLEAST8 "hho" #define SCNoLEAST16 "ho" #define SCNoLEAST32 "lo" #define SCNoLEAST64 "I64o" #define SCNoFAST8 "hho" #define SCNoFAST16 "ho" #define SCNoFAST32 "lo" #define SCNoFAST64 "I64o" #define SCNoMAX "I64o" #define SCNx8 "hhx" #define SCNx16 "hx" #define SCNx32 "lx" #define SCNx64 "I64x" #define SCNxLEAST8 "hhx" #define SCNxLEAST16 "hx" #define SCNxLEAST32 "lx" #define SCNxLEAST64 "I64x" #define SCNxFAST8 "hhx" #define SCNxFAST16 "hx" #define SCNxFAST32 "lx" #define SCNxFAST64 "I64x" #define SCNxMAX "I64x" /* fscanf macros for unsigned int types */ #define SCNu8 "hhu" #define SCNu16 "hu" #define SCNu32 "lu" #define SCNu64 "I64u" #define SCNuLEAST8 "hhu" #define SCNuLEAST16 "hu" #define SCNuLEAST32 "lu" #define SCNuLEAST64 "I64u" #define SCNuFAST8 "hhu" #define SCNuFAST16 "hu" #define SCNuFAST32 "lu" #define SCNuFAST64 "I64u" #define SCNuMAX "I64u" #ifdef _WIN64 # define PRIdPTR "I64d" # define PRIiPTR "I64i" # define PRIoPTR "I64o" # define PRIuPTR "I64u" # define PRIxPTR "I64x" # define PRIXPTR "I64X" # define SCNdPTR "I64d" # define SCNiPTR "I64i" # define SCNoPTR "I64o" # define SCNxPTR "I64x" # define SCNuPTR "I64u" #else # define PRIdPTR "ld" # define PRIiPTR "li" # define PRIoPTR "lo" # define PRIuPTR "lu" # define PRIxPTR "lx" # define PRIXPTR "lX" # define SCNdPTR "ld" # define SCNiPTR "li" # define SCNoPTR "lo" # define SCNxPTR "lx" # define SCNuPTR "lu" #endif #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ #endif /* __PGM_WININTTYPES_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/snmp.h0000644000175000017500000000215411640407352021077 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * SNMP * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_SNMP_H__ #define __PGM_SNMP_H__ #include PGM_BEGIN_DECLS bool pgm_snmp_init (pgm_error_t**) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_snmp_shutdown (void); PGM_END_DECLS #endif /* __PGM_SNMP_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/list.h0000644000175000017500000000224111640407352021072 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable doubly-linked list. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_LIST_H__ #define __PGM_LIST_H__ typedef struct pgm_list_t pgm_list_t; #include PGM_BEGIN_DECLS struct pgm_list_t { void* data; struct pgm_list_t* next; struct pgm_list_t* prev; }; PGM_END_DECLS #endif /* __PGM_LIST_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/messages.h0000644000175000017500000000365711640407352021742 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * basic message reporting. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_MESSAGES_H__ #define __PGM_MESSAGES_H__ #include PGM_BEGIN_DECLS /* Set bitmask of log roles in environmental variable PGM_LOG_MASK, * borrowed from SmartPGM. */ enum { PGM_LOG_ROLE_MEMORY = 0x001, PGM_LOG_ROLE_NETWORK = 0x002, PGM_LOG_ROLE_CONFIGURATION = 0x004, PGM_LOG_ROLE_SESSION = 0x010, PGM_LOG_ROLE_NAK = 0x020, PGM_LOG_ROLE_RATE_CONTROL = 0x040, PGM_LOG_ROLE_TX_WINDOW = 0x080, PGM_LOG_ROLE_RX_WINDOW = 0x100, PGM_LOG_ROLE_FEC = 0x400, PGM_LOG_ROLE_CONGESTION_CONTROL = 0x800 }; enum { PGM_LOG_LEVEL_DEBUG = 0, PGM_LOG_LEVEL_TRACE = 1, PGM_LOG_LEVEL_MINOR = 2, PGM_LOG_LEVEL_NORMAL = 3, PGM_LOG_LEVEL_WARNING = 4, PGM_LOG_LEVEL_ERROR = 5, PGM_LOG_LEVEL_FATAL = 6 }; extern int pgm_log_mask; extern int pgm_min_log_level; typedef void (*pgm_log_func_t) (const int, const char*restrict, void*restrict); pgm_log_func_t pgm_log_set_handler (pgm_log_func_t, void*); void pgm_messages_init (void); void pgm_messages_shutdown (void); PGM_END_DECLS #endif /* __PGM_MESSAGES_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/engine.h0000644000175000017500000000232111640407352021363 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM engine. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_ENGINE_H__ #define __PGM_ENGINE_H__ #include #include PGM_BEGIN_DECLS bool pgm_init (pgm_error_t**); bool pgm_supported (void) PGM_GNUC_WARN_UNUSED_RESULT PGM_GNUC_PURE; bool pgm_shutdown (void); void pgm_drop_superuser (void); PGM_END_DECLS #endif /* __PGM_ENGINE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/mem.h0000644000175000017500000000421511640407352020700 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable fail fast memory allocation. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_MEM_H__ #define __PGM_MEM_H__ #ifdef CONFIG_HAVE_ALLOCA_H # include #elif defined(_WIN32) # include #else # include #endif #include PGM_BEGIN_DECLS extern bool pgm_mem_gc_friendly; void* pgm_malloc (const size_t) PGM_GNUC_MALLOC PGM_GNUC_ALLOC_SIZE(1); void* pgm_malloc_n (const size_t, const size_t) PGM_GNUC_MALLOC PGM_GNUC_ALLOC_SIZE2(1, 2); void* pgm_malloc0 (const size_t) PGM_GNUC_MALLOC PGM_GNUC_ALLOC_SIZE(1); void* pgm_malloc0_n (const size_t, const size_t) PGM_GNUC_MALLOC PGM_GNUC_ALLOC_SIZE2(1, 2); void* pgm_memdup (const void*, const size_t) PGM_GNUC_MALLOC; void* pgm_realloc (void*, const size_t) PGM_GNUC_WARN_UNUSED_RESULT; void pgm_free (void*); /* Convenience memory allocators that wont work well above 32-bit sizes */ #define pgm_new(struct_type, n_structs) \ ((struct_type*)pgm_malloc_n ((size_t)sizeof(struct_type), (size_t)(n_structs))) #define pgm_new0(struct_type, n_structs) \ ((struct_type*)pgm_malloc0_n ((size_t)sizeof(struct_type), (size_t)(n_structs))) #define pgm_alloca(size) \ alloca (size) #define pgm_newa(struct_type, n_structs) \ ((struct_type*) pgm_alloca (sizeof(struct_type) * (size_t)(n_structs))) PGM_END_DECLS #endif /* __PGM_MEM_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/retypes.h0000644000175000017500000000162211640407352021614 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Redo data types. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined( PGM_BOOL_DEFINED ) # define bool pgm_bool_t #endif libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/pgm_socket.hh0000644000175000017500000001036711640407352022432 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM socket * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGM_SOCKET_HH__ #define __PGM_SOCKET_HH__ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include #ifndef _WIN32 # include # include #else # include #endif namespace cpgm { #define restrict #include }; template class pgm_socket { public: /// The protocol type. typedef Protocol protocol_type; /// The endpoint type. typedef typename Protocol::endpoint endpoint_type; /// The native socket type. typedef struct cpgm::pgm_sock_t* native_type; /// Construct a pgm_socket without opening it. pgm_socket() { } // Open a new PGM socket implementation. bool open (::sa_family_t family, int sock_type, int protocol, cpgm::pgm_error_t** error) { return cpgm::pgm_socket (&this->native_type_, family, sock_type, protocol, error); } /// Close a PGM socket implementation. bool close (bool flush) { return pgm_close (this->native_type_, flush); } /// Get the native socket implementation. native_type native (void) { return this->native_type_; } // Bind the datagram socket to the specified local endpoint. bool bind (const endpoint_type& addr, cpgm::pgm_error_t** error) { return pgm_bind (this->native_type_, addr.data(), sizeof(addr.data()), error); } /// Connect the PGM socket to the specified endpoint. bool connect (cpgm::pgm_error_t** error) { return pgm_connect (this->native_type_, error); } /// Set a socket option. bool set_option (int level, int optname, const void* optval, ::socklen_t optlen) { return pgm_setsockopt (this->native_type_, level, optname, optval, optlen); } /// Get a socket option. bool get_option (int level, int optname, void* optval, ::socklen_t* optlen) { return pgm_getsockopt (this->native_type_, level, optname, optval, optlen); } /// Get the local endpoint. endpoint_type local_endpoint() const { endpoint_type endpoint; pgm_getsockname (this->native_type_, &endpoint); return endpoint; } /// Disable sends or receives on the socket. bool shutdown (int what) { int optname, v = 1; #ifndef _WIN32 if (SHUT_RD == what) optname = cpgm::PGM_SEND_ONLY; else if (SHUT_WR == what) optname = cpgm::PGM_RECV_ONLY; #else if (SD_RECEIVE == what) optname = cpgm::PGM_SEND_ONLY; else if (SD_SEND == what) optname = cpgm::PGM_RECV_ONLY; #endif else { errno = EINVAL; return false; } return pgm_setsockopt (this->native_type_, IPPROTO_PGM, optname, &v, sizeof(v)); } /// Send some data on a connected socket. int send (const void* buf, std::size_t len, std::size_t* bytes_sent) { return pgm_send (this->native_type_, buf, len, bytes_sent); } /// Receive some data from the peer. int receive (void* buf, std::size_t len, int flags, std::size_t* bytes_read, cpgm::pgm_error_t** error) { return pgm_recv (this->native_type_, buf, len, flags, bytes_read, error); } /// Receive a datagram with the endpoint of the sender. int receive_from (void* buf, std::size_t len, int flags, std::size_t* bytes_read, endpoint_type* from, cpgm::pgm_error_t** error) { int ec; struct cpgm::pgm_sockaddr_t addr; socklen_t addrlen = sizeof (addr); ec = pgm_recvfrom (this->native_type_, buf, len, flags, bytes_read, &addr, &addrlen, error); from->port (addr.sa_port); from->address (addr.sa_addr); /* TODO: set data-destination port */ return ec; } private: native_type native_type_; }; #endif /* __PGM_SOCKET_HH__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/if.h0000644000175000017500000000207611640407352020523 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * network interface handling. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IF_H__ #define __PGM_IF_H__ #include PGM_BEGIN_DECLS void pgm_if_print_all (void); PGM_END_DECLS #endif /* __PGM_IF_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/types.h0000644000175000017500000000527211640407352021272 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Cross-platform data types. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_TYPES_H__ #define __PGM_TYPES_H__ #ifndef _MSC_VER # include #endif #include #ifdef _WIN32 # include # include # if !defined( PGM_SA_FAMILY_T_DEFINED ) # if defined( _MSC_VER ) # define sa_family_t ADDRESS_FAMILY # else # define sa_family_t USHORT # endif # define PGM_SA_FAMILY_T_DEFINED # endif # if !defined( PGM_IN_PORT_T_DEFINED ) # define in_port_t uint16_t # define PGM_IN_PORT_T_DEFINED # endif #endif #ifdef _MSC_VER # if !defined( PGM_BOOL_DEFINED ) && !defined( __cplusplus ) /* type BOOL causes linkage errors with C++ applications */ # define pgm_bool_t unsigned char # define bool pgm_bool_t # define PGM_BOOL_DEFINED # endif # include # if !defined( PGM_SSIZE_T_DEFINED ) # define ssize_t SSIZE_T # define PGM_SSIZE_T_DEFINED # endif # if !defined( PGM_INLINE_DEFINED ) # define inline __inline # define PGM_INLINE_DEFINED # endif # if !defined( PGM_RESTRICT_DEFINED ) # define restrict __restrict # define PGM_RESTRICT_DEFINED # endif #else # if (defined( __GNUC__ ) && ( __GNUC__ >= 4 )) || defined( __SUNPRO_C ) /* g++ v4 handles C99 headers without complaints */ # include # elif !defined( PGM_BOOL_DEFINED ) && !defined( __cplusplus ) /* g++ v3 and other ancient compilers, should match target platform C++ bool size */ # define pgm_bool_t int # define bool pgm_bool_t # define PGM_BOOL_DEFINED # endif # include #endif #if !defined( PGM_BOOL_DEFINED ) # define pgm_bool_t bool #endif #if !defined( PGM_RESTRICT_DEFINED ) && (!defined( restrict ) || (defined( __STDC_VERSION__ ) && __STDC_VERSION__ < 199901L)) /* C89 ANSI standard */ # define restrict # define PGM_RESTRICT_DEFINED #endif PGM_BEGIN_DECLS /* nc */ PGM_END_DECLS #endif /* __PGM_TYPES_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/time.h0000644000175000017500000000352011640407352021056 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * high resolution timers. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_TIME_H__ #define __PGM_TIME_H__ #include PGM_BEGIN_DECLS typedef uint64_t pgm_time_t; typedef void (*pgm_time_since_epoch_func)(const pgm_time_t*const restrict, time_t*restrict); #define pgm_to_secs(t) ((uint64_t)( (t) / 1000000UL )) #define pgm_to_msecs(t) ((uint64_t)( (t) / 1000UL )) #define pgm_to_usecs(t) ( (t) ) #define pgm_to_nsecs(t) ((uint64_t)( (t) * 1000UL )) #define pgm_to_secsf(t) ( (double)(t) / 1000000.0 ) #define pgm_to_msecsf(t) ( (double)(t) / 1000.0 ) #define pgm_to_usecsf(t) ( (double)(t) ) #define pgm_to_nsecsf(t) ( (double)(t) * 1000.0 ) #define pgm_secs(t) ((uint64_t)( (uint64_t)(t) * 1000000UL )) #define pgm_msecs(t) ((uint64_t)( (uint64_t)(t) * 1000UL )) #define pgm_usecs(t) ((uint64_t)( (t) )) #define pgm_nsecs(t) ((uint64_t)( (t) / 1000UL )) #define PGM_TIME_FORMAT PRIu64 extern pgm_time_since_epoch_func pgm_time_since_epoch; PGM_END_DECLS #endif /* __PGM_TIME_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/untypes.h0000644000175000017500000000160611640407352021632 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Undo data types. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined( PGM_BOOL_DEFINED ) # undef bool #endif libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/backtrace.h0000644000175000017500000000215111640407352022036 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Dump back trace to stderr and try gdb. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_BACKTRACE_H__ #define __PGM_BACKTRACE_H__ #include PGM_BEGIN_DECLS PGM_GNUC_NORETURN void on_sigsegv (int); PGM_END_DECLS #endif /* __PGM_BACKTRACE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/pgm.h0000644000175000017500000000315311640407352020705 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * OpenPGM, an implementation of the PGM network protocol. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_H__ #define __PGM_H__ #ifdef _MSC_VER /* library dependencies for Visual Studio application builds */ # pragma comment (lib, "libpgm") # pragma comment (lib, "ws2_32") # pragma comment (lib, "iphlpapi") # pragma comment (lib, "winmm") # pragma comment (lib, "advapi32") #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif /* __PGM_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/ip/0000755000175000017500000000000011640407424020357 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/ip/pgm_endpoint.hh0000644000175000017500000001031711640407352023365 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM endpoint * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGM_IP_PGM_ENDPOINT_HH__ #define __PGM_IP_PGM_ENDPOINT_HH__ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) namespace pgm { #define restrict #include } namespace ip { template class pgm_endpoint { public: /// The protocol type associated with the endpoint. typedef InternetProtocol protocol_type; typedef struct cpgm::pgm_sockaddr_t data_type; /// Default constructor. pgm_endpoint() : data_() { data_.sa_port = 0; cpgm::pgm_tsi_t tmp_addr = PGM_TSI_INIT; data_.sa_addr = tmp_addr; } /// Construct an endpoint using a port number, specified in host byte /// order. The GSI will be generated from the node name. /** * @par examples * To initialise a PGM endpoint for port 7500, use: * @code * ip::pgm::endpoint ep (7500); * @endcode */ pgm_endpoint (unsigned short port_num) : data_() { data_.sa_port = port_num; data_.sa_addr.sport = 0; pgm_gsi_create_from_hostname (&data_.sa_addr.gsi, NULL); } /// Construct an endpoint using a port number and a TSI. pgm_endpoint (const cpgm::pgm_tsi_t& tsi, unsigned short port_num) : data_() { data_.sa_port = port_num; data_.sa_addr = tsi; } /// Construct an endpoint using a port number and a memory area. pgm_endpoint (const void* src, std::size_t len, unsigned short port_num) : data_() { data_.sa_port = port_num; data_.sa_addr.sport = 0; pgm_gsi_create_from_data (&data_.sa_addr.gsi, static_cast(src), len); } /// Copy constructor. pgm_endpoint (const pgm_endpoint& other) : data_ (other.data_) { } /// Assign from another endpoint. pgm_endpoint& operator= (const pgm_endpoint& other) { data_ = other.data_; return *this; } /// Get the underlying endpoint in the native type. const data_type* data() const { return &data_; } /// Get the underlying size of the endpoint in the native type. std::size_t size() const { return sizeof(data_type); } /// Get the port associated with the endpoint. The port number is always in /// the host's byte order. unsigned short port() const { return data_.sa_port; } /// Set the port associated with the endpoint. The port number is always in /// the host's byte order. void port (unsigned short port_num) { data_.sa_port = port_num; } /// Get the TSI associated with the endpoint. const cpgm::pgm_tsi_t* address() const { return &data_.sa_addr; } /// Set the TSI associated with the endpoint. void address (cpgm::pgm_tsi_t& addr) { data_.sa_addr = addr; } /// Compare two endpoints for equality. friend bool operator== (const pgm_endpoint& e1, const pgm_endpoint& e2) { return e1.address() == e2.address() && e1.port() == e2.port(); } /// Compare two endpoints for inequality. friend bool operator!= (const pgm_endpoint& e1, const pgm_endpoint& e2) { return e1.address() != e2.address() || e1.port() != e2.port(); } /// Compare endpoints for ordering. friend bool operator<(const pgm_endpoint& e1, const pgm_endpoint& e2) { if (e1.address() < e2.address()) return true; if (e1.address() != e2.address()) return false; return e1.port() < e2.port(); } private: // The underlying PGM socket address. data_type data_; }; } // namespace ip #endif /* __PGM_IP_PGM_ENDPOINT_HH__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/ip/pgm.hh0000644000175000017500000000415711640407352021472 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM protocol * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGM_IP_PGM_HH__ #define __PGM_IP_PGM_HH__ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) namespace pgm { #define restrict #include } namespace ip { class pgm { public: /// The type of a PGM endpoint. typedef pgm_endpoint endpoint; /// Construct to represent PGM over IPv4. static pgm v4() { return pgm (PF_INET); } /// Construct to represent PGM over IPv6. static pgm v6() { return pgm (PF_INET6); } /// Obtain an identifier for the type of the protocol. int type() const { return SOCK_SEQPACKET; } /// Obtain an identifier for the protocol. int protocol() const { return IPPROTO_PGM; } /// Obtain an identifier for the protocol family. int family() const { return family_; } /// The PGM socket type. typedef pgm_socket socket; /// Compare two protocols for equality. friend bool operator== (const pgm& p1, const pgm& p2) { return p1.family_ == p2.family_; } /// Compare two protocols for inequality. friend bool operator!= (const pgm& p1, const pgm& p2) { return p1.family_ != p2.family_; } private: // Construct with a specific family. explicit pgm (int family) : family_ (family) { } int family_; }; } // namespace ip #endif /* __PGM_IP_PGM_HH__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/winint.h0000644000175000017500000001410611640407352021432 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * stdint.h for Win32 & Win64 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_WININT_H__ #define __PGM_WININT_H__ #include /* 7.18.1.1 Exact-width integer types */ typedef signed __int8 int8_t; typedef unsigned __int8 uint8_t; typedef signed __int16 int16_t; typedef unsigned __int16 uint16_t; typedef signed __int32 int32_t; typedef unsigned __int32 uint32_t; typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; /* 7.18.1.2 Minimum-width integer types */ typedef int8_t int_least8_t; typedef uint8_t uint_least8_t; typedef int16_t int_least16_t; typedef uint16_t uint_least16_t; typedef int32_t int_least32_t; typedef uint32_t uint_least32_t; typedef int64_t int_least64_t; typedef uint64_t uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types * Not actually guaranteed to be fastest for all purposes * Here we use the exact-width types for 8 and 16-bit ints. */ typedef int8_t int_fast8_t; typedef uint8_t uint_fast8_t; typedef int16_t int_fast16_t; typedef uint16_t uint_fast16_t; typedef int32_t int_fast32_t; typedef uint32_t uint_fast32_t; typedef int64_t int_fast64_t; typedef uint64_t uint_fast64_t; /* 7.18.1.5 Greatest-width integer types */ typedef int64_t intmax_t; typedef uint64_t uintmax_t; /* 7.18.2 Limits of specified-width integer types */ #if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) /* 7.18.2.1 Limits of exact-width integer types */ #define INT8_MIN ((int8_t)_I8_MIN) #define INT8_MAX _I8_MAX #define INT16_MIN ((int16_t)_I16_MIN) #define INT16_MAX _I16_MAX #define INT32_MIN ((int32_t)_I32_MIN) #define INT32_MAX _I32_MAX #define INT64_MIN ((int64_t)_I64_MIN) #define INT64_MAX _I64_MAX #define UINT8_MAX _UI8_MAX #define UINT16_MAX _UI16_MAX #define UINT32_MAX _UI32_MAX #define UINT64_MAX _UI64_MAX /* 7.18.2.2 Limits of minimum-width integer types */ #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST64_MIN INT64_MIN #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MAX INT64_MAX #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX /* 7.18.2.3 Limits of fastest minimum-width integer types */ #define INT_FAST8_MIN INT8_MIN #define INT_FAST16_MIN INT16_MIN #define INT_FAST32_MIN INT32_MIN #define INT_FAST64_MIN INT64_MIN #define INT_FAST8_MAX INT8_MAX #define INT_FAST16_MAX INT16_MAX #define INT_FAST32_MAX INT32_MAX #define INT_FAST64_MAX INT64_MAX #define UINT_FAST8_MAX UINT8_MAX #define UINT_FAST16_MAX UINT16_MAX #define UINT_FAST32_MAX UINT32_MAX #define UINT_FAST64_MAX UINT64_MAX /* 7.18.2.4 Limits of integer types capable of holding object pointers */ #ifdef _WIN64 # define INTPTR_MIN INT64_MIN # define INTPTR_MAX INT64_MAX # define UINTPTR_MAX UINT64_MAX #else # define INTPTR_MIN INT32_MIN # define INTPTR_MAX INT32_MAX # define UINTPTR_MAX UINT32_MAX #endif /* 7.18.2.5 Limits of greatest-width integer types */ #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX /* 7.18.3 Limits of other integer types */ #ifdef _WIN64 # define PTRDIFF_MIN INT64_MIN # define PTRDIFF_MAX INT64_MAX #else # define PTRDIFF_MIN INT32_MIN # define PTRDIFF_MAX INT32_MAX #endif #define SIG_ATOMIC_MIN INT_MIN #define SIG_ATOMIC_MAX INT_MAX #ifndef SIZE_MAX # ifdef _WIN64 # define SIZE_MAX UINT64_MAX # else # define SIZE_MAX UINT32_MAX # endif #endif #ifndef WCHAR_MIN /* also in wchar.h */ # define WCHAR_MIN 0U # define WCHAR_MAX UINT16_MAX #endif /* * wint_t is unsigned short for compatibility with MS runtime */ #define WINT_MIN 0U #define WINT_MAX UINT16_MAX #endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ /* 7.18.4 Macros for integer constants */ #if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) /* 7.18.4.1 Macros for minimum-width integer constants Accoding to Douglas Gwyn : "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC 9899:1999 as initially published, the expansion was required to be an integer constant of precisely matching type, which is impossible to accomplish for the shorter types on most platforms, because C99 provides no standard way to designate an integer constant with width less than that of type int. TC1 changed this to require just an integer constant *expression* with *promoted* type." The trick used here is from Clive D W Feather. */ #define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) #define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) #define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) /* The 'trick' doesn't work in C89 for long long because, without suffix, (val) will be evaluated as int, not intmax_t */ #define INT64_C(val) val##LL #define UINT8_C(val) (val) #define UINT16_C(val) (val) #define UINT32_C(val) (val##U) #define UINT64_C(val) val##ULL /* 7.18.4.2 Macros for greatest-width integer constants */ #define INTMAX_C(val) val##LL #define UINTMAX_C(val) val##ULL #endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ #endif /* __PGM_WININT_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/pgm.hh0000644000175000017500000000213211640407352021051 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * OpenPGM C++ wrapper. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGM_HH__ #define __PGM_HH__ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include #include #include #endif /* __PGM_HH__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/http.h0000644000175000017500000000227211640407352021102 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * HTTP administrative interface * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_HTTP_H__ #define __PGM_HTTP_H__ #include PGM_BEGIN_DECLS #define PGM_HTTP_DEFAULT_SERVER_PORT 4968 bool pgm_http_init (uint16_t, pgm_error_t**) PGM_GNUC_WARN_UNUSED_RESULT; bool pgm_http_shutdown (void); PGM_END_DECLS #endif /* __PGM_HTTP_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/pgm/zinttypes.h0000644000175000017500000000261111640407352022171 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Supplementary printf format modifiers for size_t & ssize_t. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_ZINTTYPES_H__ #define __PGM_ZINTTYPES_H__ #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) #ifdef _WIN32 # define PRIzd "ld" # define PRIzi "li" # define PRIzo "lo" # define PRIzu "lu" # define PRIzx "lx" # define PRIzX "lX" #else # define PRIzd "zd" # define PRIzi "zi" # define PRIzo "zo" # define PRIzu "zu" # define PRIzx "zx" # define PRIzX "zX" #endif #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ #endif /* __PGM_ZINTTYPES_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/0000755000175000017500000000000011640407424020125 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/processor.h0000644000175000017500000000336011640407352022317 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Processor macros for cross-platform, cross-compiler froyo. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_PROCESSOR_H__ #define __PGM_IMPL_PROCESSOR_H__ /* Memory prefetch */ #if defined( __SUNPRO_C ) || defined( __SUNPRO_CC ) # include # define pgm_prefetch(addr) sun_prefetch_read_many ((void*)addr) # define pgm_prefetchw(addr) sun_prefetch_write_many (addr) #elif defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) # define pgm_prefetch(addr) __builtin_prefetch (addr, 0 /* read */, 0 /* no temporal locality */) # define pgm_prefetchw(addr) __builtin_prefetch (addr, 1 /* write */, 3 /* high temporal */) #else # define pgm_prefetch(addr) (addr) # define pgm_prefetchw(addr) (addr) #endif #endif /* __PGM_IMPL_PROCESSOR_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/inet_network.h0000644000175000017500000000317711640407352023016 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable implementations of inet_network and inet_network6. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_INET_NETWORK_H__ #define __PGM_IMPL_INET_NETWORK_H__ #ifndef _WIN32 # include #endif #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL int pgm_inet_network (const char*restrict, struct in_addr*restrict); PGM_GNUC_INTERNAL int pgm_inet6_network (const char*restrict, struct in6_addr*restrict); PGM_GNUC_INTERNAL int pgm_sa6_network (const char*restrict, struct sockaddr_in6*restrict); PGM_GNUC_INTERNAL struct in_addr pgm_inet_makeaddr (uint32_t, uint32_t); PGM_END_DECLS #endif /* __PGM_IMPL_INET_NETWORK_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/checksum.h0000644000175000017500000000500111640407352022074 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM checksum routines * * Copyright (c) 2006-2008 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_CHECKSUM_H__ #define __PGM_IMPL_CHECKSUM_H__ #include PGM_BEGIN_DECLS uint16_t pgm_inet_checksum (const void*, uint16_t, uint16_t); uint16_t pgm_csum_fold (uint32_t) PGM_GNUC_CONST; uint32_t pgm_csum_block_add (uint32_t, uint32_t, const uint16_t) PGM_GNUC_CONST; uint32_t pgm_compat_csum_partial (const void*, uint16_t, uint32_t); uint32_t pgm_compat_csum_partial_copy (const void*restrict, void*restrict, uint16_t, uint32_t); static inline uint32_t add32_with_carry (uint32_t, uint32_t) PGM_GNUC_CONST; #if defined( __i386__ ) || defined( __i386 ) || defined( __x86_64__ ) || defined( __amd64 ) static inline uint32_t add32_with_carry (uint32_t a, uint32_t b) { __asm__ ( "addl %2, %0 \n\t" "adcl $0, %0" : "=r" (a) /* output operands */ : "0" (a), "r" (b)); /* input operands */ return a; } #elif defined( __sparc__ ) || defined( __sparc ) || defined( __sparcv9 ) static inline uint32_t add32_with_carry (uint32_t a, uint32_t b) { __asm__ ( "addcc %2, %0, %0 \n\t" "addx %0, %%g0, %0" : "=r" (a) /* output operands */ : "0" (a), "r" (b) /* input operands */ : "cc"); /* list of clobbered registers */ return a; } #else static inline uint32_t add32_with_carry (uint32_t a, uint32_t b) { a += b; a = (a >> 16) + (a & 0xffff); return a; } #endif # define pgm_csum_partial pgm_compat_csum_partial # define pgm_csum_partial_copy pgm_compat_csum_partial_copy PGM_END_DECLS #endif /* __PGM_IMPL_CHECKSUM_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/histogram.h0000644000175000017500000000666611640407352022311 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * histograms. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_HISTOGRAM_H__ #define __PGM_IMPL_HISTOGRAM_H__ #include #include #include #include PGM_BEGIN_DECLS typedef int pgm_sample_t; typedef int pgm_count_t; struct pgm_sample_set_t { pgm_count_t* counts; unsigned counts_len; int64_t sum; int64_t square_sum; }; typedef struct pgm_sample_set_t pgm_sample_set_t; struct pgm_histogram_t { const char* restrict histogram_name; unsigned bucket_count; pgm_sample_t declared_min; pgm_sample_t declared_max; pgm_sample_t* restrict ranges; pgm_sample_set_t sample; bool is_registered; pgm_slist_t histograms_link; }; typedef struct pgm_histogram_t pgm_histogram_t; #define PGM_HISTOGRAM_DEFINE(name, minimum, maximum, count) \ static pgm_count_t counts[ (count) ]; \ static pgm_sample_t ranges[ (count) + 1 ]; \ static pgm_histogram_t counter = { \ .histogram_name = (name), \ .bucket_count = (count), \ .declared_min = (minimum), \ .declared_max = (maximum), \ .ranges = ranges, \ .sample = { \ .counts = counts, \ .counts_len = (count), \ .sum = 0, \ .square_sum = 0 \ }, \ .is_registered = FALSE \ } #ifdef CONFIG_HISTOGRAMS # define PGM_HISTOGRAM_TIMES(name, sample) do { \ PGM_HISTOGRAM_DEFINE(name, pgm_msecs(1), pgm_secs(10), 50); \ if (!counter.is_registered) { \ memset (counts, 0, sizeof(counts)); \ memset (ranges, 0, sizeof(ranges)); \ pgm_histogram_init (&counter); \ } \ pgm_histogram_add_time (&counter, sample); \ } while (0) # define PGM_HISTOGRAM_COUNTS(name, sample) do { \ PGM_HISTOGRAM_DEFINE(name, 1, 1000000, 50); \ if (!counter.is_registered) { \ memset (counts, 0, sizeof(counts)); \ memset (ranges, 0, sizeof(ranges)); \ pgm_histogram_init (&counter); \ } \ pgm_histogram_add (&counter, (sample)); \ } while (0) #else /* !CONFIG_HISTOGRAMS */ # define PGM_HISTOGRAM_TIMES(name, sample) # define PGM_HISTOGRAM_COUNTS(name, sample) #endif /* !CONFIG_HISTOGRAMS */ extern pgm_slist_t* pgm_histograms; void pgm_histogram_init (pgm_histogram_t*); void pgm_histogram_add (pgm_histogram_t*, int); void pgm_histogram_write_html_graph_all (pgm_string_t*); static inline void pgm_histogram_add_time ( pgm_histogram_t*const histogram, pgm_time_t sample_time ) { pgm_histogram_add (histogram, (int)pgm_to_msecs (sample_time)); } PGM_END_DECLS #endif /* __PGM_IMPL_HISTOGRAM_H__ */ /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/sqn_list.h0000644000175000017500000000225611640407352022137 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM sequence list. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SQN_LIST_H__ #define __PGM_IMPL_SQN_LIST_H__ struct pgm_sqn_list_t; #include PGM_BEGIN_DECLS struct pgm_sqn_list_t { uint8_t len; uint32_t sqn[63]; /* list of sequence numbers */ }; PGM_END_DECLS #endif /* __PGM_IMPL_SQN_LIST_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/pgmMIB_enums.h0000644000175000017500000000465011640407352022625 0ustar locallocal/* * Note: this file originally auto-generated by mib2c using * : mib2c.column_enums.conf,v 5.2 2003/02/22 04:09:25 hardaker Exp $ */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef PGMMIB_ENUMS_H #define PGMMIB_ENUMS_H /* enums for column pgmNeIfPgmEnable */ #define PGMNEIFPGMENABLE_ENABLE 1 #define PGMNEIFPGMENABLE_DISABLE 2 /* enums for column pgmNeTsiStateBits */ #define PGMNETSISTATEBITS_INITIALISING 0 #define PGMNETSISTATEBITS_SPMSQNSTATEVALID 1 #define PGMNETSISTATEBITS_DLRCANPROVIDEPARITY 2 /* enums for column pgmNeTsiRtxSequenceNumberType */ #define PGMNETSIRTXSEQUENCENUMBERTYPE_SELECTIVE 1 #define PGMNETSIRTXSEQUENCENUMBERTYPE_TG 2 /* enums for column pgmNeTsiRtxStateBits */ #define PGMNETSIRTXSTATEBITS_INITIALISING 0 #define PGMNETSIRTXSTATEBITS_ELIMINATING 1 #define PGMNETSIRTXSTATEBITS_REDIRECTING 2 #define PGMNETSIRTXSTATEBITS_STATECREATEDBYNULLNAK 3 #define PGMNETSIRTXSTATEBITS_LISTNAKENTRY 4 #define PGMNETSIRTXSTATEBITS_PARITYSTATE 5 /* enums for column pgmNeTsiPollType */ #define PGMNETSIPOLLTYPE_GENERAL 1 #define PGMNETSIPOLLTYPE_DLR 2 /* enums for column pgmSourceAdvMode */ #define PGMSOURCEADVMODE_DATA 1 #define PGMSOURCEADVMODE_TIME 2 #define PGMSOURCEADVMODE_APPLCTRL 3 #define PGMSOURCEADVMODE_OTHER 4 /* enums for column pgmSourceLateJoin */ #define PGMSOURCELATEJOIN_ENABLE 1 #define PGMSOURCELATEJOIN_DISABLE 2 /* enums for column pgmSourceFEC */ #define PGMSOURCEFEC_DISABLED 1 #define PGMSOURCEFEC_ENABLEDFIXEDPACKETSIZE 2 #define PGMSOURCEFEC_ENABLEDVARIABLEPACKETSIZE 3 /* enums for column pgmReceiverSendNaks */ #define PGMRECEIVERSENDNAKS_ENABLED 1 #define PGMRECEIVERSENDNAKS_DISABLED 2 /* enums for column pgmReceiverLateJoin */ #define PGMRECEIVERLATEJOIN_ENABLED 1 #define PGMRECEIVERLATEJOIN_DISABLED 2 /* enums for column pgmReceiverDeliveryOrder */ #define PGMRECEIVERDELIVERYORDER_UNORDERED 1 #define PGMRECEIVERDELIVERYORDER_ORDERED 2 /* enums for column pgmReceiverMcastNaks */ #define PGMRECEIVERMCASTNAKS_ENABLED 1 #define PGMRECEIVERMCASTNAKS_DISABLED 2 #endif /* PGMMIB_ENUMS_H */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/packet_test.h0000644000175000017500000000304011640407352022601 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM packet formats, RFC 3208. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_PACKET_TEST_H__ #define __PGM_IMPL_PACKET_TEST_H__ #ifndef _WIN32 # include #endif #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL bool pgm_print_packet (const void*, size_t); PGM_GNUC_INTERNAL const char* pgm_type_string (uint8_t) PGM_GNUC_WARN_UNUSED_RESULT PGM_GNUC_CONST; PGM_GNUC_INTERNAL const char* pgm_udpport_string (in_port_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL const char* pgm_gethostbyaddr (const struct in_addr*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_ipopt_print (const void*, size_t); PGM_END_DECLS #endif /* __PGM_IMPL_PACKET_TEST_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/tsi.h0000644000175000017500000000252411640407352021100 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * transport session ID helper functions * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_TSI_H__ #define __PGM_IMPL_TSI_H__ #include #include #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL pgm_hash_t pgm_tsi_hash (const void*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_IMPL_TSI_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/slist.h0000644000175000017500000000421211640407352021433 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable singly-linked list. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SLIST_H__ #define __PGM_IMPL_SLIST_H__ typedef struct pgm_slist_t pgm_slist_t; #include PGM_BEGIN_DECLS struct pgm_slist_t { void* restrict data; struct pgm_slist_t* restrict next; }; PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_append (pgm_slist_t*restrict, void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_prepend (pgm_slist_t*restrict, void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_prepend_link (pgm_slist_t*restrict, pgm_slist_t*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_remove (pgm_slist_t*restrict, const void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_remove_first (pgm_slist_t*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_slist_free (pgm_slist_t*); PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_last (pgm_slist_t*) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL unsigned pgm_slist_length (pgm_slist_t*) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_IMPL_SLIST_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/indextoname.h0000644000175000017500000000245711640407352022621 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Windows interface index to interface name function. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_INDEXTONAME_H__ #define __PGM_IMPL_INDEXTONAME_H__ #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL char* pgm_if_indextoname (unsigned, char*); PGM_END_DECLS #endif /* __PGM_IMPL_INDEXTONAME_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/pgmMIB.h0000644000175000017500000000165411640407352021417 0ustar locallocal/* * Note: this file originally auto-generated by mib2c using * : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $ */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_MIB_H__ #define __PGM_IMPL_MIB_H__ #include PGM_BEGIN_DECLS /* function declarations */ PGM_GNUC_INTERNAL bool pgm_mib_init (pgm_error_t**); PGM_GNUC_INTERNAL int send_pgmStart_trap(void); PGM_GNUC_INTERNAL int send_pgmStop_trap(void); PGM_GNUC_INTERNAL int send_pgmNewSourceTrap_trap(void); PGM_GNUC_INTERNAL int send_pgmClosedSourceTrap_trap(void); PGM_GNUC_INTERNAL int send_pgmNewReceiverTrap_trap(void); PGM_GNUC_INTERNAL int send_pgmClosedReceiverTrap_trap(void); PGM_GNUC_INTERNAL int send_pgmNakFailuresTrap_trap(void); PGM_GNUC_INTERNAL int send_pgmNewDlrSourceTrap_trap(void); PGM_GNUC_INTERNAL int send_pgmClosedDlrSourceTrap_trap(void); PGM_END_DECLS #endif /* __PGM_IMPL_MIB_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/getnodeaddr.h0000644000175000017500000000322211640407352022555 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable function to return node IP address. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_GETNODEADDR_H__ #define __PGM_IMPL_GETNODEADDR_H__ #ifndef _WIN32 # include # include # include #endif #include #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL bool pgm_getnodeaddr (const sa_family_t, struct addrinfo**restrict, pgm_error_t**restrict); PGM_GNUC_INTERNAL void pgm_freenodeaddr (struct addrinfo*); PGM_GNUC_INTERNAL bool pgm_get_multicast_enabled_node_addr (const sa_family_t, struct sockaddr*restrict, const socklen_t, pgm_error_t**restrict); PGM_END_DECLS #endif /* __PGM_IMPL_GETNODEADDR_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/nametoindex.h0000644000175000017500000000256011640407352022614 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Windows interface name to interface index function. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_NAMETOINDEX_H__ #define __PGM_IMPL_NAMETOINDEX_H__ #ifndef _WIN32 # include #endif #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL unsigned pgm_if_nametoindex (const sa_family_t, const char*); PGM_END_DECLS #endif /* __PGM_IMPL_NAMETOINDEX_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/socket.h0000644000175000017500000001367011640407352021575 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM socket. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SOCKET_H__ #define __PGM_IMPL_SOCKET_H__ struct pgm_sock_t; #include #include #include PGM_BEGIN_DECLS #ifndef IP_MAX_MEMBERSHIPS # define IP_MAX_MEMBERSHIPS 20 #endif struct pgm_sock_t { sa_family_t family; /* communications domain */ int socket_type; int protocol; pgm_tsi_t tsi; in_port_t dport; in_port_t udp_encap_ucast_port; in_port_t udp_encap_mcast_port; uint32_t rand_node_id; /* node identifier */ pgm_rwlock_t lock; /* running / destroyed */ pgm_mutex_t receiver_mutex; /* receiver API */ pgm_mutex_t source_mutex; /* source API */ pgm_spinlock_t txw_spinlock; /* transmit window */ pgm_mutex_t send_mutex; /* non-router alert socket */ pgm_mutex_t timer_mutex; /* next timer expiration */ bool is_bound; bool is_connected; bool is_destroyed; bool is_reset; bool is_abort_on_reset; bool can_send_data; /* and SPMs */ bool can_send_nak; /* muted receiver */ bool can_recv_data; /* send-only */ bool is_edge_triggered_recv; bool is_nonblocking; struct group_source_req send_gsr; /* multicast */ struct sockaddr_storage send_addr; /* unicast nla */ SOCKET send_sock; SOCKET send_with_router_alert_sock; struct group_source_req recv_gsr[IP_MAX_MEMBERSHIPS]; /* sa_family = 0 terminated */ unsigned recv_gsr_len; SOCKET recv_sock; size_t max_apdu; uint16_t max_tpdu; uint16_t max_tsdu; /* excluding optional var_pktlen word */ uint16_t max_tsdu_fragment; size_t iphdr_len; bool use_multicast_loop; /* and reuseaddr for UDP encapsulation */ unsigned hops; unsigned txw_sqns, txw_secs; unsigned rxw_sqns, rxw_secs; ssize_t txw_max_rte, rxw_max_rte; ssize_t odata_max_rte; ssize_t rdata_max_rte; size_t sndbuf, rcvbuf; /* setsockopt (SO_SNDBUF/SO_RCVBUF) */ pgm_txw_t* restrict window; pgm_rate_t rate_control; pgm_rate_t odata_rate_control; pgm_rate_t rdata_rate_control; pgm_time_t adv_ivl; /* advancing with data */ unsigned adv_mode; /* 0 = time, 1 = data */ bool is_controlled_spm; bool is_controlled_odata; bool is_controlled_rdata; bool use_cr; /* congestion reports */ bool use_pgmcc; /* congestion control */ bool is_pending_crqst; unsigned ack_c; /* constant C */ unsigned ack_c_p; /* constant Cᵨ */ uint32_t ssthresh; /* slow-start threshold */ uint32_t tokens; uint32_t cwnd_size; /* congestion window size */ uint32_t ack_rx_max; uint32_t ack_bitmap; uint32_t acks_after_loss; uint32_t suspended_sqn; bool is_congested; pgm_time_t ack_expiry; pgm_time_t ack_expiry_ivl; pgm_time_t next_crqst; pgm_time_t crqst_ivl; pgm_time_t ack_bo_ivl; struct sockaddr_storage acker_nla; uint64_t acker_loss; pgm_notify_t ack_notify; pgm_notify_t rdata_notify; pgm_hash_t last_hash_key; void* restrict last_hash_value; unsigned last_commit; size_t blocklen; /* length of buffer blocked */ bool is_apdu_eagain; /* writer-lock on window_lock exists as send would block */ bool is_spm_eagain; /* writer-lock in receiver */ struct { size_t data_pkt_offset; size_t data_bytes_offset; uint32_t first_sqn; struct pgm_sk_buff_t* skb; /* references external buffer */ size_t tsdu_length; uint32_t unfolded_odata; size_t apdu_length; unsigned vector_index; size_t vector_offset; bool is_rate_limited; } pkt_dontwait_state; uint32_t spm_sqn; unsigned spm_ambient_interval; /* microseconds */ unsigned* restrict spm_heartbeat_interval; /* zero terminated, zero lead-pad */ unsigned spm_heartbeat_state; /* indexof spm_heartbeat_interval */ unsigned spm_heartbeat_len; unsigned peer_expiry; /* from absence of SPMs */ unsigned spmr_expiry; /* waiting for peer SPMRs */ pgm_rand_t rand_; /* for calculating nak_rb_ivl from nak_bo_ivl */ unsigned nak_data_retries, nak_ncf_retries; pgm_time_t nak_bo_ivl, nak_rpt_ivl, nak_rdata_ivl; pgm_time_t next_heartbeat_spm, next_ambient_spm; bool use_proactive_parity; bool use_ondemand_parity; bool use_var_pktlen; uint8_t rs_n; uint8_t rs_k; uint8_t rs_proactive_h; /* 0 <= proactive-h <= ( n - k ) */ uint8_t tg_sqn_shift; struct pgm_sk_buff_t* restrict rx_buffer; pgm_rwlock_t peers_lock; pgm_hashtable_t* restrict peers_hashtable; /* fast lookup */ pgm_list_t* restrict peers_list; /* easy iteration */ pgm_slist_t* restrict peers_pending; /* rxw: have or lost data */ pgm_notify_t pending_notify; /* timer to rx */ bool is_pending_read; pgm_time_t next_poll; uint32_t cumulative_stats[PGM_PC_SOURCE_MAX]; uint32_t snap_stats[PGM_PC_SOURCE_MAX]; pgm_time_t snap_time; }; /* global variables */ extern pgm_rwlock_t pgm_sock_list_lock; extern pgm_slist_t* pgm_sock_list; size_t pgm_pkt_offset (bool, sa_family_t); PGM_END_DECLS #endif /* __PGM_IMPL_SOCKET_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/getifaddrs.h0000644000175000017500000000423311640407352022414 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable getifaddrs * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_GETIFADDRS_H__ #define __PGM_IMPL_GETIFADDRS_H__ #ifndef _WIN32 # include # include # include #else # include #endif struct pgm_ifaddrs_t; #include #include PGM_BEGIN_DECLS #ifndef IF_NAMESIZE # ifdef IFNAMSIZ # define IF_NAMESIZE IFNAMSIZ # elif defined(MAX_INTERFACE_NAME_LEN) # define IF_NAMESIZE MAX_INTERFACE_NAME_LEN # elif defined(_WIN32) /* 40 for UUID, 256 for device path */ # define IF_NAMESIZE 256 # else # define IF_NAMESIZE 16 # endif #endif struct pgm_ifaddrs_t { struct pgm_ifaddrs_t* ifa_next; /* Pointer to the next structure. */ char* ifa_name; /* Name of this network interface. */ unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */ #ifdef ifa_addr # undef ifa_addr #endif struct sockaddr* ifa_addr; /* Network address of this interface. */ struct sockaddr* ifa_netmask; /* Netmask of this interface. */ }; bool pgm_getifaddrs (struct pgm_ifaddrs_t**restrict, pgm_error_t**restrict); void pgm_freeifaddrs (struct pgm_ifaddrs_t*); PGM_END_DECLS #endif /* __PGM_IMPL_GETIFADDRS_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/ip.h0000644000175000017500000001227311640407352020713 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Internet header for protocol version 4, RFC 791. * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_IP_H__ #define __PGM_IMPL_IP_H__ #ifndef _WIN32 # include # include #endif #include PGM_BEGIN_DECLS /* Byte alignment for packet memory maps. * NB: Solaris and OpenSolaris don't support #pragma pack(push) even on x86. */ #if defined( __GNUC__ ) && !defined( __sun ) # pragma pack(push) #endif #pragma pack(1) /* RFC 791 */ /* nb: first four bytes are forced bitfields for win32 "feature" */ struct pgm_ip { #if (defined( __sun ) && defined( _BIT_FIELDS_LTOH )) || (!defined( __sun ) && __BYTE_ORDER == __LITTLE_ENDIAN) unsigned ip_hl:4; /* header length */ unsigned ip_v:4; /* version */ #else unsigned ip_v:4; /* version */ unsigned ip_hl:4; /* header length */ #endif unsigned ip_tos:8; /* type of service */ unsigned ip_len:16; /* total length */ uint16_t ip_id; /* identification */ uint16_t ip_off; /* fragment offset field */ uint8_t ip_ttl; /* time to live */ uint8_t ip_p; /* protocol */ uint16_t ip_sum; /* checksum */ struct in_addr ip_src, ip_dst; /* source and dest address */ }; PGM_STATIC_ASSERT(sizeof(struct pgm_ip) == 20); /* RFC 2460 */ #ifdef ip6_vfc # undef ip6_vfc #endif #ifdef ip6_plen # undef ip6_plen #endif #ifdef ip6_nxt # undef ip6_nxt #endif #ifdef ip6_hops # undef ip6_hops #endif struct pgm_ip6_hdr { uint32_t ip6_vfc; /* version:4, traffic class:8, flow label:20 */ uint16_t ip6_plen; /* payload length: packet length - 40 */ uint8_t ip6_nxt; /* next header type */ uint8_t ip6_hops; /* hop limit */ struct in6_addr ip6_src, ip6_dst; /* source and dest address */ }; PGM_STATIC_ASSERT(sizeof(struct pgm_ip6_hdr) == 40); #define PGM_IPOPT_EOL 0 /* end of option list */ #define PGM_IPOPT_NOP 1 /* no operation */ #define PGM_IPOPT_RR 7 /* record packet route */ #define PGM_IPOPT_TS 68 /* timestamp */ #define PGM_IPOPT_SECURITY 130 /* provide s, c, h, tcc */ #define PGM_IPOPT_LSRR 131 /* loose source route */ #define PGM_IPOPT_ESO 133 #define PGM_IPOPT_CIPSO 134 #define PGM_IPOPT_SATID 136 /* satnet id */ #define PGM_IPOPT_SSRR 137 /* strict source route */ #define PGM_IPOPT_RA 148 /* router alert */ /* RFC 768 */ struct pgm_udphdr { in_port_t uh_sport; /* source port */ in_port_t uh_dport; /* destination port */ uint16_t uh_ulen; /* udp length */ uint16_t uh_sum; /* udp checksum */ }; PGM_STATIC_ASSERT(sizeof(struct pgm_udphdr) == 8); #if defined( __GNUC__ ) && !defined( __sun ) # pragma pack(pop) #else # pragma pack() #endif PGM_END_DECLS #endif /* __PGM_IMPL_IP_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/sockaddr.h0000644000175000017500000001534711640407352022102 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * struct sockaddr functions independent of in or in6. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SOCKADDR_H__ #define __PGM_IMPL_SOCKADDR_H__ #ifndef _WIN32 # include # include # include #endif #ifdef __APPLE__ # include #endif #include #include #include PGM_BEGIN_DECLS /* fallback values where not directly supported */ #ifndef MSG_DONTWAIT # define MSG_DONTWAIT 0 #endif #ifndef MSG_ERRQUEUE # define MSG_ERRQUEUE 0x2000 #endif #ifndef _WIN32 # define SOCKET int # define INVALID_SOCKET (int)-1 # define SOCKET_ERROR (int)-1 # define PGM_SOCK_EAGAIN EAGAIN # define PGM_SOCK_ECONNRESET ECONNRESET # define PGM_SOCK_EHOSTUNREACH EHOSTUNREACH # define PGM_SOCK_EINTR EINTR # define PGM_SOCK_EINVAL EINVAL # define PGM_SOCK_ENETUNREACH ENETUNREACH # define PGM_SOCK_ENOBUFS ENOBUFS # define closesocket close # define ioctlsocket ioctl # define pgm_error_from_sock_errno pgm_error_from_errno static inline int pgm_get_last_sock_error (void) { return errno; } static inline void pgm_set_last_sock_error (int errnum) { errno = errnum; } static inline char* pgm_sock_strerror_s (char *buffer, size_t size, int errnum) { return pgm_strerror_s (buffer, size, errnum); } static inline char* pgm_gai_strerror_s (char* buffer, size_t size, int errnum) { pgm_strncpy_s (buffer, size, gai_strerror (errnum), _TRUNCATE); return buffer; } #else # define PGM_SOCK_EAGAIN WSAEWOULDBLOCK # define PGM_SOCK_ECONNRESET WSAECONNRESET # define PGM_SOCK_EHOSTUNREACH WSAEHOSTUNREACH # define PGM_SOCK_EINTR WSAEINTR # define PGM_SOCK_EINVAL WSAEINVAL # define PGM_SOCK_ENETUNREACH WSAENETUNREACH # define PGM_SOCK_ENOBUFS WSAENOBUFS # define pgm_get_last_sock_error() WSAGetLastError() # define pgm_set_last_sock_error(e) WSASetLastError(e) # define pgm_error_from_sock_errno pgm_error_from_wsa_errno static inline char* pgm_sock_strerror_s (char *buffer, size_t size, int errnum) { pgm_strncpy_s (buffer, size, pgm_wsastrerror (errnum), _TRUNCATE); return buffer; } static inline char* pgm_gai_strerror_s (char* buffer, size_t size, int errnum) { /* Windows maps EAI error codes onto WSA error codes */ return pgm_sock_strerror_s (buffer, size, errnum); } #endif PGM_GNUC_INTERNAL sa_family_t pgm_sockaddr_family (const struct sockaddr* sa); PGM_GNUC_INTERNAL in_port_t pgm_sockaddr_port (const struct sockaddr* sa); PGM_GNUC_INTERNAL socklen_t pgm_sockaddr_len (const struct sockaddr* sa); PGM_GNUC_INTERNAL socklen_t pgm_sockaddr_storage_len (const struct sockaddr_storage* ss); PGM_GNUC_INTERNAL uint32_t pgm_sockaddr_scope_id (const struct sockaddr* sa); PGM_GNUC_INTERNAL int pgm_sockaddr_ntop (const struct sockaddr*restrict sa, char*restrict dst, size_t ulen); PGM_GNUC_INTERNAL int pgm_sockaddr_pton (const char*restrict src, struct sockaddr*restrict dst); PGM_GNUC_INTERNAL int pgm_sockaddr_is_addr_multicast (const struct sockaddr* sa); PGM_GNUC_INTERNAL int pgm_sockaddr_is_addr_unspecified (const struct sockaddr* sa); PGM_GNUC_INTERNAL int pgm_sockaddr_cmp (const struct sockaddr*restrict sa1, const struct sockaddr*restrict sa2); PGM_GNUC_INTERNAL int pgm_sockaddr_hdrincl (const SOCKET s, const sa_family_t sa_family, const bool v); PGM_GNUC_INTERNAL int pgm_sockaddr_pktinfo (const SOCKET s, const sa_family_t sa_family, const bool v); PGM_GNUC_INTERNAL int pgm_sockaddr_router_alert (const SOCKET s, const sa_family_t sa_family, const bool v); PGM_GNUC_INTERNAL int pgm_sockaddr_tos (const SOCKET s, const sa_family_t sa_family, const int tos); PGM_GNUC_INTERNAL int pgm_sockaddr_join_group (const SOCKET s, const sa_family_t sa_family, const struct group_req* gr); PGM_GNUC_INTERNAL int pgm_sockaddr_leave_group (const SOCKET s, const sa_family_t sa_family, const struct group_req* gr); PGM_GNUC_INTERNAL int pgm_sockaddr_block_source (const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr); PGM_GNUC_INTERNAL int pgm_sockaddr_unblock_source (const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr); PGM_GNUC_INTERNAL int pgm_sockaddr_join_source_group (const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr); PGM_GNUC_INTERNAL int pgm_sockaddr_leave_source_group (const SOCKET s, const sa_family_t sa_family, const struct group_source_req* gsr); #if defined(MCAST_MSFILTER) || defined(SIOCSMSFILTER) # ifndef GROUP_FILTER_SIZE # define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \ - sizeof (struct sockaddr_storage) \ + ((numsrc) \ * sizeof (struct sockaddr_storage))) # endif # ifndef IP_MSFILTER_SIZE # define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \ - sizeof (struct in_addr) \ + ((numsrc) \ * sizeof (struct in_addr))) # endif PGM_GNUC_INTERNAL int pgm_sockaddr_msfilter (const SOCKET s, const sa_family_t sa_family, const struct group_filter* gf_list); #endif PGM_GNUC_INTERNAL int pgm_sockaddr_multicast_if (const SOCKET s, const struct sockaddr* address, const unsigned ifindex); PGM_GNUC_INTERNAL int pgm_sockaddr_multicast_loop (const SOCKET s, const sa_family_t sa_family, const bool v); PGM_GNUC_INTERNAL int pgm_sockaddr_multicast_hops (const SOCKET s, const sa_family_t sa_family, const unsigned hops); PGM_GNUC_INTERNAL void pgm_sockaddr_nonblocking (const SOCKET s, const bool v); PGM_GNUC_INTERNAL const char* pgm_inet_ntop (int af, const void*restrict src, char*restrict dst, socklen_t size); PGM_GNUC_INTERNAL int pgm_inet_pton (int af, const char*restrict src, void*restrict dst); PGM_GNUC_INTERNAL int pgm_nla_to_sockaddr (const void*restrict nla, struct sockaddr*restrict sa); PGM_GNUC_INTERNAL int pgm_sockaddr_to_nla (const struct sockaddr*restrict sa, void*restrict nla); PGM_END_DECLS #endif /* __PGM_IMPL_SOCKADDR_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/galois.h0000644000175000017500000000666011640407352021564 0ustar locallocal/* * Galois field maths. * * Copyright (c) 2006-2008 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_GALOIS_H__ #define __PGM_IMPL_GALOIS_H__ #include PGM_BEGIN_DECLS /* 8 bit wide galois field integer: GF(2⁸) */ #ifdef _MSC_VER typedef uint8_t pgm_gf8_t; #else typedef uint8_t __attribute__((__may_alias__)) pgm_gf8_t; #endif /* E denotes the encoding symbol length in bytes. * S denotes the symbol size in units of m-bit elements. When m = 8, * then S and E are equal. */ #define PGM_GF_ELEMENT_BYTES sizeof(pgm_gf8_t) /* m defines the length of the elements in the finite field, in bits. * m belongs to {2..16}. */ #define PGM_GF_ELEMENT_BITS ( 8 * PGM_GF_ELEMENT_BYTES ) /* q defines the number of elements in the finite field. */ #define PGM_GF_NO_ELEMENTS ( 1 << PGM_GF_ELEMENT_BITS ) #define PGM_GF_MAX ( PGM_GF_NO_ELEMENTS - 1 ) extern const pgm_gf8_t pgm_gflog[PGM_GF_NO_ELEMENTS]; extern const pgm_gf8_t pgm_gfantilog[PGM_GF_NO_ELEMENTS]; #ifdef CONFIG_GALOIS_MUL_LUT extern const pgm_gf8_t pgm_gftable[PGM_GF_NO_ELEMENTS * PGM_GF_NO_ELEMENTS]; #endif /* In a finite field with characteristic 2, addition and subtraction are * identical, and are accomplished using the XOR operator. */ static inline pgm_gf8_t pgm_gfadd ( pgm_gf8_t a, pgm_gf8_t b ) { return a ^ b; } static inline pgm_gf8_t pgm_gfadd_equals ( pgm_gf8_t a, pgm_gf8_t b ) { return a ^= b; } static inline pgm_gf8_t pgm_gfsub ( pgm_gf8_t a, pgm_gf8_t b ) { return pgm_gfadd (a, b); } static inline pgm_gf8_t pgm_gfsub_equals ( pgm_gf8_t a, pgm_gf8_t b ) { return pgm_gfadd_equals (a, b); } static inline pgm_gf8_t pgm_gfmul ( pgm_gf8_t a, pgm_gf8_t b ) { if (PGM_UNLIKELY( !(a && b) )) { return 0; } #ifdef CONFIG_GALOIS_MUL_LUT return pgm_gftable[ (uint16_t)a << 8 | (uint16_t)b ]; #else const unsigned sum = pgm_gflog[ a ] + pgm_gflog[ b ]; return sum >= PGM_GF_MAX ? pgm_gfantilog[ sum - PGM_GF_MAX ] : pgm_gfantilog[ sum ]; #endif } static inline pgm_gf8_t pgm_gfdiv ( pgm_gf8_t a, pgm_gf8_t b ) { #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 version */ if (PGM_UNLIKELY( !a )) { return 0; } const int sum = pgm_gflog[ a ] - pgm_gflog[ b ]; return sum < 0 ? pgm_gfantilog[ sum + PGM_GF_MAX ] : pgm_gfantilog[ sum ]; #else /* C89 version */ const int sum = pgm_gflog[ a ] - pgm_gflog[ b ]; if (PGM_UNLIKELY( !a )) { return 0; } return sum < 0 ? pgm_gfantilog[ sum + PGM_GF_MAX ] : pgm_gfantilog[ sum ]; #endif } PGM_END_DECLS #endif /* __PGM_IMPL_GALOIS_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/framework.h0000644000175000017500000000452211640407352022276 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Framework collection. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_FRAMEWORK_H__ #define __PGM_IMPL_FRAMEWORK_H__ #define __PGM_IMPL_FRAMEWORK_H_INSIDE__ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #undef __PGM_IMPL_FRAMEWORK_H_INSIDE__ #endif /* __PGM_IMPL_FRAMEWORK_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/rand.h0000644000175000017500000000324211640407352021223 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable weak pseudo-random generator. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_RAND_H__ #define __PGM_IMPL_RAND_H__ typedef struct pgm_rand_t pgm_rand_t; #include PGM_BEGIN_DECLS struct pgm_rand_t { uint32_t seed; }; PGM_GNUC_INTERNAL void pgm_rand_create (pgm_rand_t*); PGM_GNUC_INTERNAL uint32_t pgm_rand_int (pgm_rand_t*); PGM_GNUC_INTERNAL int32_t pgm_rand_int_range (pgm_rand_t*, int32_t, int32_t); PGM_GNUC_INTERNAL uint32_t pgm_random_int (void); PGM_GNUC_INTERNAL int32_t pgm_random_int_range (int32_t, int32_t); PGM_GNUC_INTERNAL void pgm_rand_init (void); PGM_GNUC_INTERNAL void pgm_rand_shutdown (void); PGM_END_DECLS #endif /* __PGM_IMPL_RAND_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/reed_solomon.h0000644000175000017500000000363711640407352022774 0ustar locallocal/* * Reed-Solomon forward error correction based on Vandermonde matrices * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_REED_SOLOMON_H__ #define __PGM_IMPL_REED_SOLOMON_H__ typedef struct pgm_rs_t pgm_rs_t; #include #include PGM_BEGIN_DECLS struct pgm_rs_t { uint8_t n, k; /* RS(n, k) */ pgm_gf8_t* GM; pgm_gf8_t* RM; }; #define PGM_RS_DEFAULT_N 255 PGM_GNUC_INTERNAL void pgm_rs_create (pgm_rs_t*, const uint8_t, const uint8_t); PGM_GNUC_INTERNAL void pgm_rs_destroy (pgm_rs_t*); PGM_GNUC_INTERNAL void pgm_rs_encode (pgm_rs_t*restrict, const pgm_gf8_t**restrict, const uint8_t, pgm_gf8_t*restrict, const uint16_t); PGM_GNUC_INTERNAL void pgm_rs_decode_parity_inline (pgm_rs_t*restrict, pgm_gf8_t**restrict, const uint8_t*restrict, const uint16_t); PGM_GNUC_INTERNAL void pgm_rs_decode_parity_appended (pgm_rs_t*restrict, pgm_gf8_t**restrict, const uint8_t*restrict, const uint16_t); PGM_END_DECLS #endif /* __PGM_IMPL_REED_SOLOMON_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/get_nprocs.h0000644000175000017500000000246211640407352022445 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable function to return number of available, online, or * configured processors. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_GET_NPROCS_H__ #define __PGM_IMPL_GET_NPROCS_H__ #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL int pgm_get_nprocs (void); PGM_END_DECLS #endif /* __PGM_IMPL_GET_NPROCS_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/sn.h0000644000175000017500000000623411640407352020723 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * serial number arithmetic: rfc 1982 * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SN_H__ #define __PGM_IMPL_SN_H__ #include #include PGM_BEGIN_DECLS #define PGM_UINT32_SIGN_BIT (1UL<<31) #define PGM_UINT64_SIGN_BIT (1ULL<<63) /* declare for GCC attributes */ static inline bool pgm_uint32_lt (const uint32_t, const uint32_t) PGM_GNUC_CONST; static inline bool pgm_uint32_lte (const uint32_t, const uint32_t) PGM_GNUC_CONST; static inline bool pgm_uint32_gt (const uint32_t, const uint32_t) PGM_GNUC_CONST; static inline bool pgm_uint32_gte (const uint32_t, const uint32_t) PGM_GNUC_CONST; static inline bool pgm_uint64_lt (const uint64_t, const uint64_t) PGM_GNUC_CONST; static inline bool pgm_uint64_lte (const uint64_t, const uint64_t) PGM_GNUC_CONST; static inline bool pgm_uint64_gt (const uint64_t, const uint64_t) PGM_GNUC_CONST; static inline bool pgm_uint64_gte (const uint64_t, const uint64_t) PGM_GNUC_CONST; /* 32 bit */ static inline bool pgm_uint32_lt ( const uint32_t s, const uint32_t t ) { pgm_assert (sizeof(int) >= 4); return ((s - t) & PGM_UINT32_SIGN_BIT) != 0; } static inline bool pgm_uint32_lte ( const uint32_t s, const uint32_t t ) { pgm_assert (sizeof(int) >= 4); return s == t || ((s - t) & PGM_UINT32_SIGN_BIT) != 0; } static inline bool pgm_uint32_gt ( const uint32_t s, const uint32_t t ) { pgm_assert (sizeof(int) >= 4); return ((t - s) & PGM_UINT32_SIGN_BIT) != 0; } static inline bool pgm_uint32_gte ( const uint32_t s, const uint32_t t ) { pgm_assert (sizeof(int) >= 4); return s == t || ((t - s) & PGM_UINT32_SIGN_BIT) != 0; } /* 64 bit */ static inline bool pgm_uint64_lt ( const uint64_t s, const uint64_t t ) { return ((s - t) & PGM_UINT64_SIGN_BIT) != 0; } static inline bool pgm_uint64_lte ( const uint64_t s, const uint64_t t ) { return s == t || ((s - t) & PGM_UINT64_SIGN_BIT) != 0; } static inline bool pgm_uint64_gt ( const uint64_t s, const uint64_t t ) { return ((t - s) & PGM_UINT64_SIGN_BIT) != 0; } static inline bool pgm_uint64_gte ( const uint64_t s, const uint64_t t ) { return s == t || ((t - s) & PGM_UINT64_SIGN_BIT) != 0; } PGM_END_DECLS #endif /* __PGM_IMPL_SN_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/wsastrerror.h0000644000175000017500000000244011640407352022673 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Winsock Error strings. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_WSASTRERROR_H__ #define __PGM_IMPL_WSASTRERROR_H__ #include PGM_BEGIN_DECLS char* pgm_wsastrerror (const int); char* pgm_adapter_strerror (const int); char* pgm_win_strerror (char*, size_t, const int); PGM_END_DECLS #endif /* __PGM_IMPL_WSASTRERROR_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/indextoaddr.h0000644000175000017500000000271011640407352022603 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable interface index to socket address function. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_INDEXTOADDR_H__ #define __PGM_IMPL_INDEXTOADDR_H__ #ifndef _WIN32 # include #endif #include #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL bool pgm_if_indextoaddr (const unsigned, const sa_family_t, const uint32_t, struct sockaddr*restrict, pgm_error_t**restrict); PGM_END_DECLS #endif /* __PGM_IMPL_INDEXTOADDR_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/packet_parse.h0000644000175000017500000000371311640407352022743 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM packet formats, RFC 3208. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_PACKET_PARSE_H__ #define __PGM_IMPL_PACKET_PARSE_H__ #ifndef _WIN32 # include #endif #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL bool pgm_parse_raw (struct pgm_sk_buff_t*const restrict, struct sockaddr*const restrict, pgm_error_t**restrict); PGM_GNUC_INTERNAL bool pgm_parse_udp_encap (struct pgm_sk_buff_t*const restrict, pgm_error_t**restrict); PGM_GNUC_INTERNAL bool pgm_verify_spm (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_spmr (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_nak (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_nnak (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_ncf (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_poll (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_polr (const struct pgm_sk_buff_t* const); PGM_GNUC_INTERNAL bool pgm_verify_ack (const struct pgm_sk_buff_t* const); PGM_END_DECLS #endif /* __PGM_IMPL_PACKET_PARSE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/list.h0000644000175000017500000000354111640407352021254 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable doubly-linked list. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_LIST_H__ #define __PGM_IMPL_LIST_H__ #include #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL pgm_list_t* pgm_list_append (pgm_list_t*restrict, void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_list_t* pgm_list_prepend_link (pgm_list_t*restrict, pgm_list_t*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_list_t* pgm_list_remove_link (pgm_list_t*, pgm_list_t*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_list_t* pgm_list_delete_link (pgm_list_t*, pgm_list_t*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_list_t* pgm_list_last (pgm_list_t*) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL unsigned pgm_list_length (pgm_list_t*) PGM_GNUC_PURE PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_IMPL_LIST_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/net.h0000644000175000017500000000330011640407352021060 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * network send wrapper. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_NET_H__ #define __PGM_IMPL_NET_H__ #ifndef _WIN32 # include #endif #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL ssize_t pgm_sendto_hops (pgm_sock_t*restrict, bool, pgm_rate_t*restrict, bool, int, const void*restrict, size_t, const struct sockaddr*restrict, socklen_t); PGM_GNUC_INTERNAL int pgm_set_nonblocking (SOCKET fd[2]); static inline ssize_t pgm_sendto ( pgm_sock_t*restrict sock, bool use_rate_limit, pgm_rate_t*restrict minor_rate_control, bool use_router_alert, const void*restrict buf, size_t len, const struct sockaddr*restrict to, socklen_t tolen ) { return pgm_sendto_hops (sock, use_rate_limit, minor_rate_control, use_router_alert, -1, buf, len, to, tolen); } PGM_END_DECLS #endif /* __PGM_IMPL_NET_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/txw.h0000644000175000017500000001416511640407352021127 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * basic transmit window. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_TXW_H__ #define __PGM_IMPL_TXW_H__ typedef struct pgm_txw_state_t pgm_txw_state_t; typedef struct pgm_txw_t pgm_txw_t; #include PGM_BEGIN_DECLS /* must be smaller than PGM skbuff control buffer */ struct pgm_txw_state_t { uint32_t unfolded_checksum; /* first 32-bit word must be checksum */ unsigned waiting_retransmit:1; /* in retransmit queue */ unsigned retransmit_count:15; unsigned nak_elimination_count:16; uint8_t pkt_cnt_requested; /* # parity packets to send */ uint8_t pkt_cnt_sent; /* # parity packets already sent */ }; struct pgm_txw_t { const pgm_tsi_t* restrict tsi; /* option: lockless atomics */ volatile uint32_t lead; volatile uint32_t trail; pgm_queue_t retransmit_queue; pgm_rs_t rs; uint8_t tg_sqn_shift; struct pgm_sk_buff_t* restrict parity_buffer; /* Advance with data */ pgm_time_t adv_ivl_expiry; unsigned increment_window_naks; unsigned adv_secs; /* TXW_ADV_SECS */ unsigned adv_sqns; /* TXW_ADV_SECS in sequences */ unsigned is_fec_enabled:1; unsigned adv_mode:1; /* 0 = advance by time, 1 = advance by data */ size_t size; /* window content size in bytes */ unsigned alloc; /* length of pdata[] */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 flexible array, sizeof() invalid */ struct pgm_sk_buff_t* pdata[]; #elif !defined(__STDC_VERSION__) || defined(__cplusplus) /* C90 and older */ struct pgm_sk_buff_t* pdata[1]; #else /* GNU C variable-length object */ struct pgm_sk_buff_t* pdata[0]; #endif }; PGM_GNUC_INTERNAL pgm_txw_t* pgm_txw_create (const pgm_tsi_t*const, const uint16_t, const uint32_t, const unsigned, const ssize_t, const bool, const uint8_t, const uint8_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_txw_shutdown (pgm_txw_t*const); PGM_GNUC_INTERNAL void pgm_txw_add (pgm_txw_t*const restrict, struct pgm_sk_buff_t*const restrict); PGM_GNUC_INTERNAL struct pgm_sk_buff_t* pgm_txw_peek (const pgm_txw_t*const, const uint32_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_txw_retransmit_push (pgm_txw_t*const, const uint32_t, const bool, const uint8_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL struct pgm_sk_buff_t* pgm_txw_retransmit_try_peek (pgm_txw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_txw_retransmit_remove_head (pgm_txw_t*const); PGM_GNUC_INTERNAL uint32_t pgm_txw_get_unfolded_checksum (const struct pgm_sk_buff_t*const) PGM_GNUC_PURE; PGM_GNUC_INTERNAL void pgm_txw_set_unfolded_checksum (struct pgm_sk_buff_t*const, const uint32_t); PGM_GNUC_INTERNAL void pgm_txw_inc_retransmit_count (struct pgm_sk_buff_t*const); PGM_GNUC_INTERNAL bool pgm_txw_retransmit_is_empty (const pgm_txw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; /* declare for GCC attributes */ static inline size_t pgm_txw_max_length (const pgm_txw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_txw_length (const pgm_txw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline size_t pgm_txw_size (const pgm_txw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline bool pgm_txw_is_empty (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline bool pgm_txw_is_full (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_txw_lead (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_txw_lead_atomic (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_txw_next_lead (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_txw_trail (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_txw_trail_atomic (const pgm_txw_t* const) PGM_GNUC_WARN_UNUSED_RESULT; static inline size_t pgm_txw_max_length ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return window->alloc; } static inline uint32_t pgm_txw_length ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return ( 1 + window->lead ) - window->trail; } static inline size_t pgm_txw_size ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return window->size; } static inline bool pgm_txw_is_empty ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return (0 == pgm_txw_length (window)); } static inline bool pgm_txw_is_full ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return (pgm_txw_length (window) == pgm_txw_max_length (window)); } static inline uint32_t pgm_txw_lead ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return window->lead; } /* atomics may rely on global variables and so cannot be defined __pure__ */ static inline uint32_t pgm_txw_lead_atomic ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return pgm_atomic_read32 (&window->lead); } static inline uint32_t pgm_txw_next_lead ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return (uint32_t)(pgm_txw_lead (window) + 1); } static inline uint32_t pgm_txw_trail ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return window->trail; } static inline uint32_t pgm_txw_trail_atomic ( const pgm_txw_t*const window ) { pgm_assert (NULL != window); return pgm_atomic_read32 (&window->trail); } PGM_END_DECLS #endif /* __PGM_IMPL_TXW_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/features.h0000644000175000017500000000360111640407352022114 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Compiler feature flags. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_FEATURES_H__ #define __PGM_IMPL_FEATURES_H__ #if defined(_POSIX_C_SOURCE) || defined(__POSIX_VISIBLE) # if (_POSIX_C_SOURCE - 0) >= 200112L || (__POSIX_VISIBLE - 0) >= 200112L # define CONFIG_HAVE_FTIME 1 # define CONFIG_HAVE_GETTIMEOFDAY 1 # endif # if (_POSIX_C_SOURCE - 0) >= 199309L || (__POSIX_VISIBLE - 0) >= 199309L # define CONFIG_HAVE_CLOCK_GETTIME 1 # endif #endif #if defined(_WIN32) # define CONFIG_HAVE_FTIME 1 #endif #if defined(__APPLE__) # define CONFIG_HAVE_FTIME 1 # define CONFIG_HAVE_GETTIMEOFDAY 1 #endif #if defined(__FreeBSD__) /* ftime is via compatibility library, so skip */ # undef CONFIG_HAVE_FTIME # define CONFIG_HAVE_GETTIMEOFDAY 1 #endif #if defined(__sun) || defined(__SUNPRO_C) # define CONFIG_HAVE_FTIME 1 # define CONFIG_HAVE_GETTIMEOFDAY 1 #endif #endif /* __PGM_IMPL_FEATURES_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/messages.h0000644000175000017500000002441411640407352022112 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * basic message reporting. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_MESSAGES_H__ #define __PGM_IMPL_MESSAGES_H__ #ifdef _MSC_VER # include #else # include #endif #include #include #include #include #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL void pgm__log (const int, const char*, ...) PGM_GNUC_PRINTF (2, 3); PGM_GNUC_INTERNAL void pgm__logv (const int, const char*, va_list) PGM_GNUC_PRINTF (2, 0); #ifdef CONFIG_HAVE_ISO_VARARGS /* debug trace level only valid in debug mode */ # ifdef PGM_DEBUG # define pgm_debug(...) \ do { \ if (pgm_min_log_level == PGM_LOG_LEVEL_DEBUG) \ pgm__log (PGM_LOG_LEVEL_DEBUG, __VA_ARGS__); \ } while (0) # else # define pgm_debug(...) while (0) # endif /* !PGM_DEBUG */ # define pgm_trace(r,...) \ do { \ if (pgm_min_log_level <= PGM_LOG_LEVEL_TRACE && pgm_log_mask & (r)) \ pgm__log (PGM_LOG_LEVEL_TRACE, __VA_ARGS__); \ } while (0) # define pgm_minor(...) \ do { \ if (pgm_min_log_level <= PGM_LOG_LEVEL_MINOR) \ pgm__log (PGM_LOG_LEVEL_MINOR, __VA_ARGS__); \ } while (0) # define pgm_info(...) \ do { \ if (pgm_min_log_level <= PGM_LOG_LEVEL_NORMAL) \ pgm__log (PGM_LOG_LEVEL_NORMAL, __VA_ARGS__); \ } while (0) # define pgm_warn(...) \ do { \ if (pgm_min_log_level <= PGM_LOG_LEVEL_WARNING) \ pgm__log (PGM_LOG_LEVEL_WARNING, __VA_ARGS__); \ } while (0) # define pgm_error(...) \ do { \ if (pgm_min_log_level <= PGM_LOG_LEVEL_ERROR) \ pgm__log (PGM_LOG_LEVEL_ERROR, __VA_ARGS__); \ } while (0) # define pgm_fatal(...) \ do { \ pgm__log (PGM_LOG_LEVEL_FATAL, __VA_ARGS__); \ } while (0) #elif defined(CONFIG_HAVE_GNUC_VARARGS) # ifdef PGM_DEBUG # define pgm_debug(f...) \ do { \ if (pgm_min_log_level == PGM_LOG_LEVEL_DEBUG) \ pgm__log (PGM_LOG_LEVEL_DEBUG, f); \ } while (0) # else # define pgm_debug(f...) while (0) # endif /* !PGM_DEBUG */ # define pgm_trace(r,f...) if (pgm_min_log_level <= PGM_LOG_LEVEL_TRACE && pgm_log_mask & (r)) \ pgm__log (PGM_LOG_LEVEL_TRACE, f) # define pgm_minor(f...) if (pgm_min_log_level <= PGM_LOG_LEVEL_MINOR) pgm__log (PGM_LOG_LEVEL_MINOR, f) # define pgm_info(f...) if (pgm_min_log_level <= PGM_LOG_LEVEL_NORMAL) pgm__log (PGM_LOG_LEVEL_NORMAL, f) # define pgm_warn(f...) if (pgm_min_log_level <= PGM_LOG_LEVEL_WARNING) pgm__log (PGM_LOG_LEVEL_WARNING, f) # define pgm_error(f...) if (pgm_min_log_level <= PGM_LOG_LEVEL_ERROR) pgm__log (PGM_LOG_LEVEL_ERROR, f) # define pgm_fatal(f...) pgm__log (PGM_LOG_LEVEL_FATAL, f) #else /* no varargs macros */ /* declare for GCC attributes */ static inline void pgm_debug (const char*, ...) PGM_GNUC_PRINTF (1, 2); static inline void pgm_trace (const int, const char*, ...) PGM_GNUC_PRINTF (2, 3); static inline void pgm_minor (const char*, ...) PGM_GNUC_PRINTF (1, 2); static inline void pgm_info (const char*, ...) PGM_GNUC_PRINTF (1, 2); static inline void pgm_warn (const char*, ...) PGM_GNUC_PRINTF (1, 2); static inline void pgm_error (const char*, ...) PGM_GNUC_PRINTF (1, 2); static inline void pgm_fatal (const char*, ...) PGM_GNUC_PRINTF (1, 2); static inline void pgm_debug (const char* format, ...) { if (PGM_LOG_LEVEL_DEBUG == pgm_min_log_level) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_DEBUG, format, args); va_end (args); } } static inline void pgm_trace (const int role, const char* format, ...) { if (PGM_LOG_LEVEL_TRACE >= pgm_min_log_level && pgm_log_mask & role) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_TRACE, format, args); va_end (args); } } static inline void pgm_minor (const char* format, ...) { if (PGM_LOG_LEVEL_MINOR >= pgm_min_log_level) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_MINOR, format, args); va_end (args); } } static inline void pgm_info (const char* format, ...) { if (PGM_LOG_LEVEL_NORMAL >= pgm_min_log_level) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_NORMAL, format, args); va_end (args); } } static inline void pgm_warn (const char* format, ...) { if (PGM_LOG_LEVEL_WARNING >= pgm_min_log_level) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_WARNING, format, args); va_end (args); } } static inline void pgm_error (const char* format, ...) { if (PGM_LOG_LEVEL_ERROR >= pgm_min_log_level) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_WARNING, format, args); va_end (args); } } static inline void pgm_fatal (const char* format, ...) { va_list args; va_start (args, format); pgm__logv (PGM_LOG_LEVEL_FATAL, format, args); va_end (args); } #endif /* varargs */ #define pgm_warn_if_reached() \ do { \ pgm_warn ("file %s: line %d (%s): code should not be reached", \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ } while (0) #define pgm_warn_if_fail(expr) \ do { \ if (PGM_LIKELY (expr)); \ else \ pgm_warn ("file %s: line %d (%s): runtime check failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ } while (0) #ifdef PGM_DISABLE_ASSERT # define pgm_assert(expr) while (0) # define pgm_assert_not_reached() while (0) # define pgm_assert_cmpint(n1, cmp, n2) while (0) # define pgm_assert_cmpuint(n1, cmp, n2) while (0) #elif defined(__GNUC__) # define pgm_assert(expr) \ do { \ if (PGM_LIKELY(expr)); \ else { \ pgm_fatal ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ abort (); \ } \ } while (0) # define pgm_assert_not_reached() \ do { \ pgm_fatal ("file %s: line %d (%s): should not be reached", \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ abort (); \ } while (0) # define pgm_assert_cmpint(n1, cmp, n2) \ do { \ const int64_t _n1 = (n1), _n2 = (n2); \ if (PGM_LIKELY(_n1 cmp _n2)); \ else { \ pgm_fatal ("file %s: line %d (%s): assertion failed (%s): (%" PRIi64 " %s %" PRIi64 ")", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ abort (); \ } \ } while (0) # define pgm_assert_cmpuint(n1, cmp, n2) \ do { \ const uint64_t _n1 = (n1), _n2 = (n2); \ if (PGM_LIKELY(_n1 cmp _n2)); \ else { \ pgm_fatal ("file %s: line %d (%s): assertion failed (%s): (%" PRIu64 " %s %" PRIu64 ")", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ abort (); \ } \ } while (0) #else # define pgm_assert(expr) \ do { \ if (PGM_LIKELY(expr)); \ else { \ pgm_fatal ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ abort (); \ } \ } while (0) # define pgm_assert_not_reached() \ do { \ pgm_fatal ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__); \ abort (); \ } while (0) # define pgm_assert_cmpint(n1, cmp, n2) \ do { \ const int64_t _n1 = (n1), _n2 = (n2); \ if (PGM_LIKELY(_n1 cmp _n2)); \ else { \ pgm_fatal ("file %s: line %d: assertion failed (%s): (%" PRIi64 " %s %" PRIi64 ")", \ __FILE__, __LINE__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ abort (); \ } \ } while (0) # define pgm_assert_cmpuint(n1, cmp, n2) \ do { \ const uint64_t _n1 = (n1), _n2 = (n2); \ if (PGM_LIKELY(_n1 cmp _n2)); \ else { \ pgm_fatal ("file %s: line %d: assertion failed (%s): (%" PRIu64 " %s %" PRIu64 ")", \ __FILE__, __LINE__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ abort (); \ } \ } while (0) #endif /* !PGM_DISABLE_ASSERT */ #ifdef PGM_DISABLE_CHECKS # define pgm_return_if_fail(expr) while (0) # define pgm_return_val_if_fail(expr, val) while (0) # define pgm_return_if_reached() return # define pgm_return_val_if_reached(val) return (val) #elif defined(__GNUC__) # define pgm_return_if_fail(expr) \ do { \ if (PGM_LIKELY(expr)); \ else { \ pgm_warn ("file %s: line %d (%s): assertion `%s' failed", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ return; \ } \ } while (0) # define pgm_return_val_if_fail(expr, val) \ do { \ if (PGM_LIKELY(expr)); \ else { \ pgm_warn ("file %s: line %d (%s): assertion `%s' failed", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ return (val); \ } \ } while (0) # define pgm_return_if_reached() \ do { \ pgm_warn ("file %s: line %d (%s): should not be reached", \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ return; \ } while (0) # define pgm_return_val_if_reached(val) \ do { \ pgm_warn ("file %s: line %d (%s): should not be reached", \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ return (val); \ } while (0) #else # define pgm_return_if_fail(expr) \ do { \ if (PGM_LIKELY(expr)); \ else { \ pgm_warn ("file %s: line %d: assertion `%s' failed", \ __FILE__, __LINE__, #expr); \ return; \ } \ } while (0) # define pgm_return_val_if_fail(expr, val) \ do { \ if (PGM_LIKELY(expr)); \ else { \ pgm_warn ("file %s: line %d: assertion `%s' failed", \ __FILE__, __LINE__, #expr); \ return (val); \ } \ } while (0) # define pgm_return_if_reached() \ do { \ pgm_warn ("file %s: line %d): should not be reached", \ __FILE__, __LINE__); \ return; \ } while (0) # define pgm_return_val_if_reached(val) \ do { \ pgm_warn ("file %s: line %d: should not be reached", \ __FILE__, __LINE__); \ return (val); \ } while (0) #endif /* !PGM_DISABLE_CHECKS */ PGM_END_DECLS #endif /* __PGM_IMPL_MESSAGES_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/errno.h0000644000175000017500000000237411640407352021431 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Portable error code return type for selected CRT API. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_ERRNO_H__ #define __PGM_IMPL_ERRNO_H__ #ifndef _MSC_VER # define errno_t int #endif PGM_BEGIN_DECLS /* nc */ PGM_END_DECLS #endif /* __PGM_IMPL_ERRNO_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/engine.h0000644000175000017500000000234611640407352021550 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM engine. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_ENGINE_H__ #define __PGM_IMPL_ENGINE_H__ #ifdef _WIN32 # include # include #endif #include PGM_BEGIN_DECLS #ifdef _WIN32 extern LPFN_WSARECVMSG pgm_WSARecvMsg; #endif #ifdef PGM_DEBUG extern unsigned pgm_loss_rate; #endif PGM_END_DECLS #endif /* __PGM_IMPL_ENGINE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/mem.h0000644000175000017500000000222011640407352021050 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable fail fast memory allocation. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_MEM_H__ #define __PGM_IMPL_MEM_H__ #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL void pgm_mem_init (void); PGM_GNUC_INTERNAL void pgm_mem_shutdown (void); PGM_END_DECLS #endif /* __PGM_IMPL_MEM_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/string.h0000644000175000017500000000473411640407352021614 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable string manipulation functions. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_STRING_H__ #define __PGM_IMPL_STRING_H__ typedef struct pgm_string_t pgm_string_t; #include #include PGM_BEGIN_DECLS struct pgm_string_t { char* str; size_t len; size_t allocated_len; }; PGM_GNUC_INTERNAL char* pgm_strdup (const char*) PGM_GNUC_MALLOC; PGM_GNUC_INTERNAL int pgm_printf_string_upper_bound (const char*, va_list) PGM_GNUC_PRINTF(1, 0); PGM_GNUC_INTERNAL int pgm_vasprintf (char**restrict, char const*restrict, va_list args) PGM_GNUC_PRINTF(2, 0); PGM_GNUC_INTERNAL char* pgm_strdup_vprintf (const char*, va_list) PGM_GNUC_PRINTF(1, 0) PGM_GNUC_MALLOC; PGM_GNUC_INTERNAL char* pgm_strconcat (const char*, ...) PGM_GNUC_MALLOC PGM_GNUC_NULL_TERMINATED; PGM_GNUC_INTERNAL char** pgm_strsplit (const char*restrict, const char*restrict, int) PGM_GNUC_MALLOC; PGM_GNUC_INTERNAL void pgm_strfreev (char**); PGM_GNUC_INTERNAL pgm_string_t* pgm_string_new (const char*); PGM_GNUC_INTERNAL char* pgm_string_free (pgm_string_t*, bool); PGM_GNUC_INTERNAL void pgm_string_printf (pgm_string_t*restrict, const char*restrict, ...) PGM_GNUC_PRINTF(2, 3); PGM_GNUC_INTERNAL pgm_string_t* pgm_string_append (pgm_string_t*restrict, const char*restrict); PGM_GNUC_INTERNAL pgm_string_t* pgm_string_append_c (pgm_string_t*, char); PGM_GNUC_INTERNAL void pgm_string_append_printf (pgm_string_t*restrict, const char*restrict, ...) PGM_GNUC_PRINTF(2, 3); PGM_END_DECLS #endif /* __PGM_IMPL_STRING_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/source.h0000644000175000017500000000575511640407352021612 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM source socket. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SOURCE_H__ #define __PGM_IMPL_SOURCE_H__ #include #include PGM_BEGIN_DECLS /* Performance Counters */ enum { PGM_PC_SOURCE_DATA_BYTES_SENT, PGM_PC_SOURCE_DATA_MSGS_SENT, /* msgs = packets not APDUs */ /* PGM_PC_SOURCE_BYTES_BUFFERED, */ /* tx window contents in bytes */ /* PGM_PC_SOURCE_MSGS_BUFFERED, */ PGM_PC_SOURCE_BYTES_SENT, /* PGM_PC_SOURCE_RAW_NAKS_RECEIVED, */ PGM_PC_SOURCE_CKSUM_ERRORS, PGM_PC_SOURCE_MALFORMED_NAKS, PGM_PC_SOURCE_PACKETS_DISCARDED, PGM_PC_SOURCE_PARITY_BYTES_RETRANSMITTED, PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED, PGM_PC_SOURCE_PARITY_MSGS_RETRANSMITTED, PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED, PGM_PC_SOURCE_PARITY_NAK_PACKETS_RECEIVED, PGM_PC_SOURCE_SELECTIVE_NAK_PACKETS_RECEIVED, /* total packets */ PGM_PC_SOURCE_PARITY_NAKS_RECEIVED, PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED, /* serial numbers */ PGM_PC_SOURCE_PARITY_NAKS_IGNORED, PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED, PGM_PC_SOURCE_ACK_ERRORS, /* PGM_PC_SOURCE_PGMCC_ACKER, */ PGM_PC_SOURCE_TRANSMISSION_CURRENT_RATE, PGM_PC_SOURCE_ACK_PACKETS_RECEIVED, PGM_PC_SOURCE_PARITY_NNAK_PACKETS_RECEIVED, PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED, PGM_PC_SOURCE_PARITY_NNAKS_RECEIVED, PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED, PGM_PC_SOURCE_NNAK_ERRORS, /* marker */ PGM_PC_SOURCE_MAX }; PGM_GNUC_INTERNAL bool pgm_send_spm (pgm_sock_t*const, const int) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_deferred_nak (pgm_sock_t*const); PGM_GNUC_INTERNAL bool pgm_on_spmr (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_nak (pgm_sock_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_nnak (pgm_sock_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_ack (pgm_sock_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_IMPL_SOURCE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/thread.h0000644000175000017500000002462411640407352021555 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * mutexes and locks. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_THREAD_H__ #define __PGM_IMPL_THREAD_H__ typedef struct pgm_mutex_t pgm_mutex_t; typedef struct pgm_spinlock_t pgm_spinlock_t; typedef struct pgm_cond_t pgm_cond_t; typedef struct pgm_rwlock_t pgm_rwlock_t; /* spins before yielding, 200 (Linux) - 4,000 (Windows) */ #define PGM_ADAPTIVE_MUTEX_SPINCOUNT 200 /* On initialisation the number of available processors is queried to determine * whether we should spin in locks or yield to other threads and processes. */ extern bool pgm_smp_system; #ifndef _WIN32 # include # include # if defined( __sun ) # include # endif #else # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # include #endif #ifdef __APPLE__ # include #endif #include #if defined( CONFIG_TICKET_SPINLOCK ) # include #endif #if defined( CONFIG_DUMB_RWSPINLOCK ) # include #endif PGM_BEGIN_DECLS struct pgm_mutex_t { #ifndef _WIN32 /* POSIX mutex */ pthread_mutex_t pthread_mutex; #else /* Windows process-private adaptive mutex */ CRITICAL_SECTION win32_crit; #endif /* !_WIN32 */ }; struct pgm_spinlock_t { #if defined( CONFIG_TICKET_SPINLOCK ) /* ticket based spinlock */ pgm_ticket_t ticket_lock; #elif defined( CONFIG_HAVE_POSIX_SPINLOCK ) /* POSIX spinlock, not available on OSX */ pthread_spinlock_t pthread_spinlock; #elif defined( __APPLE__ ) /* OSX native spinlock */ OSSpinLock darwin_spinlock; #elif defined( _WIN32 ) /* Win32 friendly atomic-op based spinlock */ volatile LONG taken; #else /* GCC atomic-op based spinlock */ volatile uint32_t taken; #endif }; struct pgm_cond_t { #ifndef _WIN32 /* POSIX condition variable */ pthread_cond_t pthread_cond; #elif defined( CONFIG_HAVE_WIN_COND ) /* Windows Vista+ condition variable */ CONDITION_VARIABLE win32_cond; #else /* Windows XP friendly condition variable implementation */ CRITICAL_SECTION win32_crit; size_t len; size_t allocated_len; HANDLE* phandle; #endif /* !_WIN32 */ }; struct pgm_rwlock_t { #if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_t rwspinlock; #elif !defined( _WIN32 ) /* POSIX read-write lock */ pthread_rwlock_t pthread_rwlock; #elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) /* Windows Vista+ user-space (slim) read-write lock */ SRWLOCK win32_rwlock; #else /* Windows XP friendly read-write lock implementation */ CRITICAL_SECTION win32_crit; pgm_cond_t read_cond; pgm_cond_t write_cond; unsigned read_counter; bool have_writer; unsigned want_to_read; unsigned want_to_write; #endif /* !CONFIG_HAVE_WIN_SRW_LOCK */ }; PGM_GNUC_INTERNAL void pgm_mutex_init (pgm_mutex_t*); PGM_GNUC_INTERNAL void pgm_mutex_free (pgm_mutex_t*); static inline bool pgm_mutex_trylock (pgm_mutex_t* mutex) { #ifndef _WIN32 const int result = pthread_mutex_trylock (&mutex->pthread_mutex); if (EBUSY == result) return FALSE; return TRUE; #else /* WARNING: returns TRUE if in same thread as lock */ return TryEnterCriticalSection (&mutex->win32_crit); #endif /* !_WIN32 */ } /* call to pgm_mutex_lock on locked mutex or non-init pointer is undefined. */ static inline void pgm_mutex_lock (pgm_mutex_t* mutex) { #ifndef _WIN32 pthread_mutex_lock (&mutex->pthread_mutex); #else EnterCriticalSection (&mutex->win32_crit); #endif /* !_WIN32 */ } /* call to pgm_mutex_unlock on unlocked mutex or non-init pointer is undefined. */ static inline void pgm_mutex_unlock (pgm_mutex_t* mutex) { #ifndef _WIN32 pthread_mutex_unlock (&mutex->pthread_mutex); #else LeaveCriticalSection (&mutex->win32_crit); #endif /* !_WIN32 */ } PGM_GNUC_INTERNAL void pgm_spinlock_init (pgm_spinlock_t*); PGM_GNUC_INTERNAL void pgm_spinlock_free (pgm_spinlock_t*); static inline bool pgm_spinlock_trylock (pgm_spinlock_t* spinlock) { #if defined( CONFIG_TICKET_SPINLOCK ) return pgm_ticket_trylock (&spinlock->ticket_lock); #elif defined( CONFIG_HAVE_POSIX_SPINLOCK ) const int result = pthread_spin_trylock (&spinlock->pthread_spinlock); if (EBUSY == result) return FALSE; return TRUE; #elif defined( __APPLE__ ) return OSSpinLockTry (&spinlock->darwin_spinlock); #elif defined( _WIN32 ) const LONG prev = _InterlockedExchange (&spinlock->taken, 1); return (0 == prev); #else /* GCC atomics */ const uint32_t prev = __sync_lock_test_and_set (&spinlock->taken, 1); return (0 == prev); #endif } static inline void pgm_spinlock_lock (pgm_spinlock_t* spinlock) { #if defined( CONFIG_TICKET_SPINLOCK ) pgm_ticket_lock (&spinlock->ticket_lock); #elif defined( CONFIG_HAVE_POSIX_SPINLOCK ) pthread_spin_lock (&spinlock->pthread_spinlock); #elif defined( __APPLE__ ) /* Anderson's exponential back-off */ OSSpinLockLock (&spinlock->darwin_spinlock); #elif defined( _WIN32 ) /* Segall and Rudolph bus-optimised spinlock acquire with Intel's recommendation * for a pause instruction for hyper-threading. */ unsigned spins = 0; while (_InterlockedExchange (&spinlock->taken, 1)) while (spinlock->taken) if (!pgm_smp_system || (++spins > PGM_ADAPTIVE_MUTEX_SPINCOUNT)) SwitchToThread(); else YieldProcessor(); #elif defined( __i386__ ) || defined( __i386 ) || defined( __x86_64__ ) || defined( __amd64 ) /* GCC atomics */ unsigned spins = 0; while (__sync_lock_test_and_set (&spinlock->taken, 1)) while (spinlock->taken) if (!pgm_smp_system || (++spins > PGM_ADAPTIVE_MUTEX_SPINCOUNT)) sched_yield(); else __asm volatile ("pause" ::: "memory"); #else while (__sync_lock_test_and_set (&spinlock->taken, 1)) while (spinlock->taken) sched_yield(); #endif } static inline void pgm_spinlock_unlock (pgm_spinlock_t* spinlock) { #if defined( CONFIG_TICKET_SPINLOCK ) pgm_ticket_unlock (&spinlock->ticket_lock); #elif defined( CONFIG_HAVE_POSIX_SPINLOCK ) pthread_spin_unlock (&spinlock->pthread_spinlock); #elif defined( __APPLE__ ) OSSpinLockUnlock (&spinlock->darwin_spinlock); #elif defined( _WIN32 ) _InterlockedExchange (&spinlock->taken, 0); #else /* GCC atomics */ __sync_lock_release (&spinlock->taken); #endif } PGM_GNUC_INTERNAL void pgm_cond_init (pgm_cond_t*); PGM_GNUC_INTERNAL void pgm_cond_signal (pgm_cond_t*); PGM_GNUC_INTERNAL void pgm_cond_broadcast (pgm_cond_t*); #ifndef _WIN32 PGM_GNUC_INTERNAL void pgm_cond_wait (pgm_cond_t*, pthread_mutex_t*); #else PGM_GNUC_INTERNAL void pgm_cond_wait (pgm_cond_t*, CRITICAL_SECTION*); #endif PGM_GNUC_INTERNAL void pgm_cond_free (pgm_cond_t*); #if defined( CONFIG_HAVE_WIN_SRW_LOCK ) || defined( CONFIG_DUMB_RWSPINLOCK ) || !defined( _WIN32 ) static inline void pgm_rwlock_reader_lock (pgm_rwlock_t* rwlock) { # if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_reader_lock (&rwlock->rwspinlock); # elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) AcquireSRWLockShared (&rwlock->win32_rwlock); # else pthread_rwlock_rdlock (&rwlock->pthread_rwlock); # endif } static inline bool pgm_rwlock_reader_trylock (pgm_rwlock_t* rwlock) { # if defined( CONFIG_DUMB_RWSPINLOCK ) return pgm_rwspinlock_reader_trylock (&rwlock->rwspinlock); # elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) return TryAcquireSRWLockShared (&rwlock->win32_rwlock); # else return !pthread_rwlock_tryrdlock (&rwlock->pthread_rwlock); # endif } static inline void pgm_rwlock_reader_unlock(pgm_rwlock_t* rwlock) { # if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_reader_unlock (&rwlock->rwspinlock); # elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) ReleaseSRWLockShared (&rwlock->win32_rwlock); # else pthread_rwlock_unlock (&rwlock->pthread_rwlock); # endif } static inline void pgm_rwlock_writer_lock (pgm_rwlock_t* rwlock) { # if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_writer_lock (&rwlock->rwspinlock); # elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) AcquireSRWLockExclusive (&rwlock->win32_rwlock); # else pthread_rwlock_wrlock (&rwlock->pthread_rwlock); # endif } static inline bool pgm_rwlock_writer_trylock (pgm_rwlock_t* rwlock) { # if defined( CONFIG_DUMB_RWSPINLOCK ) return pgm_rwspinlock_writer_trylock (&rwlock->rwspinlock); # elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) return TryAcquireSRWLockExclusive (&rwlock->win32_rwlock); # else return !pthread_rwlock_trywrlock (&rwlock->pthread_rwlock); # endif } static inline void pgm_rwlock_writer_unlock (pgm_rwlock_t* rwlock) { # if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_writer_unlock (&rwlock->rwspinlock); # elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) ReleaseSRWLockExclusive (&rwlock->win32_rwlock); # else pthread_rwlock_unlock (&rwlock->pthread_rwlock); # endif } #else PGM_GNUC_INTERNAL void pgm_rwlock_reader_lock (pgm_rwlock_t*); PGM_GNUC_INTERNAL bool pgm_rwlock_reader_trylock (pgm_rwlock_t*); PGM_GNUC_INTERNAL void pgm_rwlock_reader_unlock(pgm_rwlock_t*); PGM_GNUC_INTERNAL void pgm_rwlock_writer_lock (pgm_rwlock_t*); PGM_GNUC_INTERNAL bool pgm_rwlock_writer_trylock (pgm_rwlock_t*); PGM_GNUC_INTERNAL void pgm_rwlock_writer_unlock (pgm_rwlock_t*); #endif PGM_GNUC_INTERNAL void pgm_rwlock_init (pgm_rwlock_t*); PGM_GNUC_INTERNAL void pgm_rwlock_free (pgm_rwlock_t*); PGM_GNUC_INTERNAL void pgm_thread_init (void); PGM_GNUC_INTERNAL void pgm_thread_shutdown (void); static inline void pgm_thread_yield (void) { #if defined( __sun ) thr_yield(); #elif !defined( _WIN32 ) sched_yield(); #else SwitchToThread(); /* yields only current processor */ # if 0 Sleep (1); /* If you specify 0 milliseconds, the thread will relinquish * the remainder of its time slice to processes of equal priority. * * Specify > Sleep (1) to yield to any process. */ # endif #endif /* _WIN32 */ } PGM_END_DECLS #endif /* __PGM_IMPL_THREAD_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/pgmMIB_columns.h0000644000175000017500000004305711640407352023162 0ustar locallocal/* * Note: this file originally auto-generated by mib2c using * : mib2c.column_defines.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $ */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef PGMMIB_COLUMNS_H #define PGMMIB_COLUMNS_H /* column number definitions for table pgmNeIfConfigTable */ #define COLUMN_PGMNEIFCONFIGINDEX 1 #define COLUMN_PGMNEIFPGMENABLE 2 #define COLUMN_PGMNEIFNAKRPTINTERVAL 3 #define COLUMN_PGMNEIFNAKRPTRATE 4 #define COLUMN_PGMNEIFNAKRDATAINTERVAL 5 #define COLUMN_PGMNEIFNAKELIMINATEINTERVAL 6 /* column number definitions for table pgmNeIfPerformanceTable */ #define COLUMN_PGMNEIFPERFORMANCEINDEX 1 #define COLUMN_PGMNEIFREXMITSTATES 2 #define COLUMN_PGMNEIFREXMITTIMEDOUT 3 #define COLUMN_PGMNEIFINSPMS 4 #define COLUMN_PGMNEIFOUTSPMS 5 #define COLUMN_PGMNEIFINPARITYSPMS 6 #define COLUMN_PGMNEIFOUTPARITYSPMS 7 #define COLUMN_PGMNEIFINRDATA 8 #define COLUMN_PGMNEIFOUTRDATA 9 #define COLUMN_PGMNEIFINPARITYRDATA 10 #define COLUMN_PGMNEIFOUTPARITYRDATA 11 #define COLUMN_PGMNEIFINRDATANOSESSIONERRORS 12 #define COLUMN_PGMNEIFUNIQUENAKS 13 #define COLUMN_PGMNEIFINNAKS 14 #define COLUMN_PGMNEIFOUTNAKS 15 #define COLUMN_PGMNEIFUNIQUEPARITYNAKS 16 #define COLUMN_PGMNEIFINPARITYNAKS 17 #define COLUMN_PGMNEIFOUTPARITYNAKS 18 #define COLUMN_PGMNEIFINNAKNOSESSIONERRORS 19 #define COLUMN_PGMNEIFINNAKSEQERRORS 20 #define COLUMN_PGMNEIFINPARITYNAKTGERRORS 21 #define COLUMN_PGMNEIFINNNAKS 22 #define COLUMN_PGMNEIFOUTNNAKS 23 #define COLUMN_PGMNEIFINPARITYNNAKS 24 #define COLUMN_PGMNEIFOUTPARITYNNAKS 25 #define COLUMN_PGMNEIFINNNAKNOSESSIONERRORS 26 #define COLUMN_PGMNEIFINNCFS 27 #define COLUMN_PGMNEIFOUTNCFS 28 #define COLUMN_PGMNEIFINPARITYNCFS 29 #define COLUMN_PGMNEIFOUTPARITYNCFS 30 #define COLUMN_PGMNEIFINNCFNOSESSIONERRORS 31 #define COLUMN_PGMNEIFINREDIRECTNCFS 32 #define COLUMN_PGMNEIFMALFORMED 33 #define COLUMN_PGMNEIFSPMFROMSOURCE 34 #define COLUMN_PGMNEIFSPMBADSQN 35 #define COLUMN_PGMNEIFSPMERROR 36 #define COLUMN_PGMNEIFPOLLRANDOMIGNORE 37 #define COLUMN_PGMNEIFPOLLTSISTATEERROR 38 #define COLUMN_PGMNEIFPOLLPARENTERROR 39 #define COLUMN_PGMNEIFPOLLTYPEERROR 40 #define COLUMN_PGMNEIFPOLLERROR 41 #define COLUMN_PGMNEIFPOLLSUCCESS 42 #define COLUMN_PGMNEIFPOLLORIGINATED 43 #define COLUMN_PGMNEIFPOLRNOSTATE 44 #define COLUMN_PGMNEIFPOLRERROR 45 #define COLUMN_PGMNEIFPOLRPARITYERROR 46 #define COLUMN_PGMNEIFPOLRSUCCESS 47 #define COLUMN_PGMNEIFPOLRORIGINATED 48 #define COLUMN_PGMNEIFNCFERROR 49 #define COLUMN_PGMNEIFNCFPARITYERROR 50 #define COLUMN_PGMNEIFNCFPARTIALPARITY 51 #define COLUMN_PGMNEIFNCFRECEIVED 52 #define COLUMN_PGMNEIFNCFANTICIPATED 53 #define COLUMN_PGMNEIFNCFREDIRECTING 54 #define COLUMN_PGMNEIFNAKELIMINATED 55 #define COLUMN_PGMNEIFNAKERROR 56 #define COLUMN_PGMNEIFNAKPARITYERROR 57 #define COLUMN_PGMNEIFNNAKELIMINATED 58 #define COLUMN_PGMNEIFNNAKERROR 59 #define COLUMN_PGMNEIFNNAKPARITYERROR 60 #define COLUMN_PGMNEIFNNAKCONGESTIONREPORTS 61 #define COLUMN_PGMNEIFNAKRETRYEXPIRED 62 #define COLUMN_PGMNEIFNAKRETRYEXPIREDDLR 63 #define COLUMN_PGMNEIFNAKFORWARDEDDLR 64 #define COLUMN_PGMNEIFNAKRETRANSMITTED 65 #define COLUMN_PGMNEIFRDATAELIMINATEDOIF 66 #define COLUMN_PGMNEIFRDATAELIMINATEDSQN 67 #define COLUMN_PGMNEIFINRDATAFRAGMENTS 68 #define COLUMN_PGMNEIFRDATAFRAGMENTSNOSESSIONERRORS 69 #define COLUMN_PGMNEIFRDATAFRAGMENTSELIMINATEDOIF 70 #define COLUMN_PGMNEIFRDATAFRAGMENTSELIMINATEDSQN 71 #define COLUMN_PGMNEIFOUTRDATAFRAGMENTS 72 /* column number definitions for table pgmNeTsiTable */ #define COLUMN_PGMNETSIGLOBALID 1 #define COLUMN_PGMNETSIDATASOURCEPORT 2 #define COLUMN_PGMNETSISTATEBITS 3 #define COLUMN_PGMNETSIDATADESTINATIONPORT 4 #define COLUMN_PGMNETSISOURCEADDRESS 5 #define COLUMN_PGMNETSIGROUPADDRESS 6 #define COLUMN_PGMNETSIUPSTREAMADDRESS 7 #define COLUMN_PGMNETSIUPSTREAMIFINDEX 8 #define COLUMN_PGMNETSIDLRADDRESS 9 /* column number definitions for table pgmNeTsiPerformanceTable */ #define COLUMN_PGMNETSIPERFORMANCEGLOBALID 1 #define COLUMN_PGMNETSIPERFORMANCEDATASOURCEPORT 2 #define COLUMN_PGMNETSISESSIONTRAILEDGESEQ 3 #define COLUMN_PGMNETSISESSIONINCRSEQ 4 #define COLUMN_PGMNETSILEADEDGESEQ 5 #define COLUMN_PGMNETSIINSPMS 6 #define COLUMN_PGMNETSIOUTSPMS 7 #define COLUMN_PGMNETSIINPARITYSPMS 8 #define COLUMN_PGMNETSIOUTPARITYSPMS 9 #define COLUMN_PGMNETSITOTALREXMITSTATES 10 #define COLUMN_PGMNETSITOTALREXMITTIMEDOUT 11 #define COLUMN_PGMNETSIINRDATA 12 #define COLUMN_PGMNETSIOUTRDATA 13 #define COLUMN_PGMNETSIINPARITYRDATA 14 #define COLUMN_PGMNETSIOUTPARITYRDATA 15 #define COLUMN_PGMNETSIINRDATANOSTATEERRORS 16 #define COLUMN_PGMNETSIUNIQUENAKS 17 #define COLUMN_PGMNETSIINNAKS 18 #define COLUMN_PGMNETSIOUTNAKS 19 #define COLUMN_PGMNETSIUNIQUEPARITYNAKS 20 #define COLUMN_PGMNETSIINPARITYNAKS 21 #define COLUMN_PGMNETSIOUTPARITYNAKS 22 #define COLUMN_PGMNETSIINNAKSEQERRORS 23 #define COLUMN_PGMNETSIINNNAKS 24 #define COLUMN_PGMNETSIOUTNNAKS 25 #define COLUMN_PGMNETSIINPARITYNNAKS 26 #define COLUMN_PGMNETSIOUTPARITYNNAKS 27 #define COLUMN_PGMNETSIINNCFS 28 #define COLUMN_PGMNETSIOUTNCFS 29 #define COLUMN_PGMNETSIINPARITYNCFS 30 #define COLUMN_PGMNETSIOUTPARITYNCFS 31 #define COLUMN_PGMNETSISPMSEQUENCENUMBER 32 #define COLUMN_PGMNETSITRANSMISSIONGROUPSIZE 33 #define COLUMN_PGMNETSITIMEOUT 34 #define COLUMN_PGMNETSILASTTTL 35 #define COLUMN_PGMNETSILINKLOSSRATE 36 #define COLUMN_PGMNETSIPATHLOSSRATE 37 #define COLUMN_PGMNETSIRECEIVERLOSSRATE 38 #define COLUMN_PGMNETSICONGESTIONREPORTLEAD 39 #define COLUMN_PGMNETSICONGESTIONREPORTWORSTRECEIVER 40 /* column number definitions for table pgmNeTsiRtxTable */ #define COLUMN_PGMNETSIRTXSEQUENCENUMBER 1 #define COLUMN_PGMNETSIRTXSEQUENCENUMBERTYPE 2 #define COLUMN_PGMNETSIRTXREQPARITYTGCOUNT 4 #define COLUMN_PGMNETSIRTXTIMEOUT 5 #define COLUMN_PGMNETSIRTXSTATEBITS 6 /* column number definitions for table pgmNeTsiRtxIfTable */ #define COLUMN_PGMNETSIRTXIFINDEX 1 #define COLUMN_PGMNETSIRTXIFPACKETCOUNT 2 /* column number definitions for table pgmNeTsiPolrTable */ #define COLUMN_PGMNETSIPOLRSOURCE 1 #define COLUMN_PGMNETSIPOLRSEQUENCENUMBER 2 /* column number definitions for table pgmNeTsiPollTable */ #define COLUMN_PGMNETSIPOLLTYPE 1 #define COLUMN_PGMNETSIPOLLSEQUENCE 2 #define COLUMN_PGMNETSIPOLLCHILDBACKOFF 3 #define COLUMN_PGMNETSIPOLLMASK 4 #define COLUMN_PGMNETSIPOLLPERIOD 5 #define COLUMN_PGMNETSIPOLLCOUNT 6 #define COLUMN_PGMNETSIPOLLTIMEOUT 7 /* column number definitions for table pgmSourceTable */ #define COLUMN_PGMSOURCEGLOBALID 1 #define COLUMN_PGMSOURCESOURCEPORT 2 #define COLUMN_PGMSOURCESOURCEADDRESS 3 #define COLUMN_PGMSOURCEGROUPADDRESS 4 #define COLUMN_PGMSOURCEDESTPORT 5 #define COLUMN_PGMSOURCESOURCEGSI 6 #define COLUMN_PGMSOURCESOURCEPORTNUMBER 7 /* column number definitions for table pgmSourceConfigTable */ #define COLUMN_PGMSOURCECONFIGGLOBALID 1 #define COLUMN_PGMSOURCECONFIGSOURCEPORT 2 #define COLUMN_PGMSOURCETTL 3 #define COLUMN_PGMSOURCEADVMODE 4 #define COLUMN_PGMSOURCELATEJOIN 5 #define COLUMN_PGMSOURCETXWMAXRTE 6 #define COLUMN_PGMSOURCETXWSECS 7 #define COLUMN_PGMSOURCETXWADVSECS 8 #define COLUMN_PGMSOURCEADVIVL 9 #define COLUMN_PGMSOURCESPMIVL 10 #define COLUMN_PGMSOURCESPMHEARTBEATIVLMIN 11 #define COLUMN_PGMSOURCESPMHEARTBEATIVLMAX 12 #define COLUMN_PGMSOURCERDATABACKOFFIVL 13 #define COLUMN_PGMSOURCEFEC 14 #define COLUMN_PGMSOURCEFECTRANSMISSIONGRPSIZE 15 #define COLUMN_PGMSOURCEFECPROACTIVEPARITYSIZE 16 #define COLUMN_PGMSOURCESPMPATHADDRESS 17 /* column number definitions for table pgmSourcePerformanceTable */ #define COLUMN_PGMSOURCEPERFORMANCEGLOBALID 1 #define COLUMN_PGMSOURCEPERFORMANCESOURCEPORT 2 #define COLUMN_PGMSOURCEDATABYTESSENT 3 #define COLUMN_PGMSOURCEDATAMSGSSENT 4 #define COLUMN_PGMSOURCEBYTESBUFFERED 5 #define COLUMN_PGMSOURCEMSGSBUFFERED 6 #define COLUMN_PGMSOURCEBYTESRETRANSMITTED 7 #define COLUMN_PGMSOURCEMSGSRETRANSMITTED 8 #define COLUMN_PGMSOURCEBYTESSENT 9 #define COLUMN_PGMSOURCERAWNAKSRECEIVED 10 #define COLUMN_PGMSOURCENAKSIGNORED 11 #define COLUMN_PGMSOURCECKSUMERRORS 12 #define COLUMN_PGMSOURCEMALFORMEDNAKS 13 #define COLUMN_PGMSOURCEPACKETSDISCARDED 14 #define COLUMN_PGMSOURCENAKSRCVD 15 #define COLUMN_PGMSOURCEPARITYBYTESRETRANSMITTED 16 #define COLUMN_PGMSOURCESELECTIVEBYTESRETRANSMITED 17 #define COLUMN_PGMSOURCEPARITYMSGSRETRANSMITTED 18 #define COLUMN_PGMSOURCESELECTIVEMSGSRETRANSMITTED 19 #define COLUMN_PGMSOURCEBYTESADMIT 20 #define COLUMN_PGMSOURCEMSGSADMIT 21 #define COLUMN_PGMSOURCEPARITYNAKPACKETSRECEIVED 22 #define COLUMN_PGMSOURCESELECTIVENAKPACKETSRECEIVED 23 #define COLUMN_PGMSOURCEPARITYNAKSRECEIVED 24 #define COLUMN_PGMSOURCESELECTIVENAKSRECEIVED 25 #define COLUMN_PGMSOURCEPARITYNAKSIGNORED 26 #define COLUMN_PGMSOURCESELECTIVENAKSIGNORED 27 #define COLUMN_PGMSOURCEACKERRORS 28 #define COLUMN_PGMSOURCEPGMCCACKER 29 #define COLUMN_PGMSOURCETRANSMISSIONCURRENTRATE 30 #define COLUMN_PGMSOURCEACKPACKETSRECEIVED 31 #define COLUMN_PGMSOURCENNAKPACKETSRECEIVED 32 #define COLUMN_PGMSOURCEPARITYNNAKPACKETSRECEIVED 33 #define COLUMN_PGMSOURCESELECTIVENNAKPACKETSRECEIVED 34 #define COLUMN_PGMSOURCENNAKSRECEIVED 35 #define COLUMN_PGMSOURCEPARITYNNAKSRECEIVED 36 #define COLUMN_PGMSOURCESELECTIVENNAKSRECEIVED 37 #define COLUMN_PGMSOURCENNAKERRORS 38 /* column number definitions for table pgmReceiverTable */ #define COLUMN_PGMRECEIVERGLOBALID 1 #define COLUMN_PGMRECEIVERSOURCEPORT 2 #define COLUMN_PGMRECEIVERINSTANCE 3 #define COLUMN_PGMRECEIVERGROUPADDRESS 4 #define COLUMN_PGMRECEIVERDESTPORT 5 #define COLUMN_PGMRECEIVERSOURCEADDRESS 6 #define COLUMN_PGMRECEIVERLASTHOP 7 #define COLUMN_PGMRECEIVERSOURCEGSI 8 #define COLUMN_PGMRECEIVERSOURCEPORTNUMBER 9 #define COLUMN_PGMRECEIVERUNIQUEINSTANCE 10 /* column number definitions for table pgmReceiverConfigTable */ #define COLUMN_PGMRECEIVERCONFIGGLOBALID 1 #define COLUMN_PGMRECEIVERCONFIGSOURCEPORT 2 #define COLUMN_PGMRECEIVERCONFIGINSTANCE 3 #define COLUMN_PGMRECEIVERNAKBACKOFFIVL 4 #define COLUMN_PGMRECEIVERNAKREPEATIVL 5 #define COLUMN_PGMRECEIVERNAKNCFRETRIES 6 #define COLUMN_PGMRECEIVERNAKRDATAIVL 7 #define COLUMN_PGMRECEIVERNAKDATARETRIES 8 #define COLUMN_PGMRECEIVERSENDNAKS 9 #define COLUMN_PGMRECEIVERLATEJOIN 10 #define COLUMN_PGMRECEIVERNAKTTL 11 #define COLUMN_PGMRECEIVERDELIVERYORDER 12 #define COLUMN_PGMRECEIVERMCASTNAKS 13 #define COLUMN_PGMRECEIVERNAKFAILURETHRESHOLDTIMER 14 #define COLUMN_PGMRECEIVERNAKFAILURETHRESHOLD 15 /* column number definitions for table pgmReceiverPerformanceTable */ #define COLUMN_PGMRECEIVERPERFORMANCEGLOBALID 1 #define COLUMN_PGMRECEIVERPERFORMANCESOURCEPORT 2 #define COLUMN_PGMRECEIVERPERFORMANCEINSTANCE 3 #define COLUMN_PGMRECEIVERDATABYTESRECEIVED 4 #define COLUMN_PGMRECEIVERDATAMSGSRECEIVED 5 #define COLUMN_PGMRECEIVERNAKSSENT 6 #define COLUMN_PGMRECEIVERNAKSRETRANSMITTED 7 #define COLUMN_PGMRECEIVERNAKFAILURES 8 #define COLUMN_PGMRECEIVERBYTESRECEIVED 9 #define COLUMN_PGMRECEIVERNAKSSUPPRESSED 10 #define COLUMN_PGMRECEIVERCKSUMERRORS 11 #define COLUMN_PGMRECEIVERMALFORMEDSPMS 12 #define COLUMN_PGMRECEIVERMALFORMEDODATA 13 #define COLUMN_PGMRECEIVERMALFORMEDRDATA 14 #define COLUMN_PGMRECEIVERMALFORMEDNCFS 15 #define COLUMN_PGMRECEIVERPACKETSDISCARDED 16 #define COLUMN_PGMRECEIVERLOSSES 17 #define COLUMN_PGMRECEIVERBYTESDELIVEREDTOAPP 18 #define COLUMN_PGMRECEIVERMSGSDELIVEREDTOAPP 19 #define COLUMN_PGMRECEIVERDUPSPMS 20 #define COLUMN_PGMRECEIVERDUPDATAS 21 #define COLUMN_PGMRECEIVERDUPPARITIES 22 #define COLUMN_PGMRECEIVERNAKPACKETSSENT 23 #define COLUMN_PGMRECEIVERPARITYNAKPACKETSSENT 24 #define COLUMN_PGMRECEIVERSELECTIVENAKPACKETSSENT 25 #define COLUMN_PGMRECEIVERPARITYNAKSSENT 26 #define COLUMN_PGMRECEIVERSELECTIVENAKSSENT 27 #define COLUMN_PGMRECEIVERPARITYNAKSRETRANSMITTED 28 #define COLUMN_PGMRECEIVERSELECTIVENAKSRETRANSMITTED 29 #define COLUMN_PGMRECEIVERNAKSFAILED 30 #define COLUMN_PGMRECEIVERPARITYNAKSFAILED 31 #define COLUMN_PGMRECEIVERSELECTIVENAKSFAILED 32 #define COLUMN_PGMRECEIVERNAKSFAILEDRXWADVANCED 33 #define COLUMN_PGMRECEIVERNAKSFALEDNCFRETRIESEXCEEDED 34 #define COLUMN_PGMRECEIVERNAKSFAILEDDATARETRIESEXCEEDED 35 #define COLUMN_PGMRECEIVERNAKSFAILEDGENEXPIRED 36 #define COLUMN_PGMRECEIVERNAKFAILURESDELIVERED 37 #define COLUMN_PGMRECEIVERPARITYNAKSSUPPRESSED 38 #define COLUMN_PGMRECEIVERSELECTIVENAKSSUPPRESSED 39 #define COLUMN_PGMRECEIVERNAKERRORS 40 #define COLUMN_PGMRECEIVEROUTSTANDINGPARITYNAKS 41 #define COLUMN_PGMRECEIVEROUTSTANDINGSELECTIVENAKS 42 #define COLUMN_PGMRECEIVERLASTACTIVITY 43 #define COLUMN_PGMRECEIVERNAKSVCTIMEMIN 44 #define COLUMN_PGMRECEIVERNAKSVCTIMEMEAN 45 #define COLUMN_PGMRECEIVERNAKSVCTIMEMAX 46 #define COLUMN_PGMRECEIVERNAKFAILTIMEMIN 47 #define COLUMN_PGMRECEIVERNAKFAILTIMEMEAN 48 #define COLUMN_PGMRECEIVERNAKFAILTIMEMAX 49 #define COLUMN_PGMRECEIVERNAKTRANSMITMIN 50 #define COLUMN_PGMRECEIVERNAKTRANSMITMEAN 51 #define COLUMN_PGMRECEIVERNAKTRANSMITMAX 52 #define COLUMN_PGMRECEIVERACKSSENT 53 #define COLUMN_PGMRECEIVERRXWTRAIL 54 #define COLUMN_PGMRECEIVERRXWLEAD 55 #define COLUMN_PGMRECEIVERNAKFAILURESLASTINTERVAL 56 #define COLUMN_PGMRECEIVERLASTINTERVALNAKFAILURES 57 /* column number definitions for table pgmDlrSourceTable */ #define COLUMN_PGMDLRSOURCEGLOBALID 1 #define COLUMN_PGMDLRSOURCESOURCEPORT 2 #define COLUMN_PGMDLRSOURCEGROUPADDRESS 3 #define COLUMN_PGMDLRSOURCESOURCEGSI 4 #define COLUMN_PGMDLRSOURCESOURCEPORTNUMBER 5 /* column number definitions for table pgmDlrSourceConfigTable */ #define COLUMN_PGMDLRSOURCECONFIGGLOBALID 1 #define COLUMN_PGMDLRSOURCECONFIGSOURCEPORT 2 #define COLUMN_PGMDLRSOURCEGROUPTTL 3 #define COLUMN_PGMDLRSOURCERDATABACKOFFIVL 4 /* column number definitions for table pgmDlrSourcePerformanceTable */ #define COLUMN_PGMDLRSOURCEPERFORMANCEGLOBALID 1 #define COLUMN_PGMDLRSOURCEPERFORMANCESOURCEPORT 2 #define COLUMN_PGMDLRSOURCERDATAMSGSSENT 3 #define COLUMN_PGMDLRSOURCERDATABYTESSENT 4 #define COLUMN_PGMDLRSOURCEBYTESSENT 5 #define COLUMN_PGMDLRSOURCENAKSRCVD 6 #define COLUMN_PGMDLRSOURCENAKSIGNORED 7 #define COLUMN_PGMDLRSOURCENAKERRORS 8 #define COLUMN_PGMDLRSOURCEDISCARDS 9 #define COLUMN_PGMDLRSOURCECKSUMERRORS 10 #define COLUMN_PGMDLRSOURCENNAKSSENT 11 #define COLUMN_PGMDLRSOURCEBYTESBUFFERED 12 #define COLUMN_PGMDLRSOURCEMSGSBUFFERED 13 #define COLUMN_PGMDLRSOURCEPARITYBYTESRETRANSMITTED 14 #define COLUMN_PGMDLRSOURCESELECTIVEBYTESRETRANSMITED 15 #define COLUMN_PGMDLRSOURCEPARITYMSGSRETRANSMITTED 16 #define COLUMN_PGMDLRSOURCESELECTIVEMSGSRETRANSMITTED 17 #define COLUMN_PGMDLRSOURCEBYTESADMIT 18 #define COLUMN_PGMDLRSOURCEMSGSADMIT 19 #define COLUMN_PGMDLRSOURCENAKPACKETSRECEIVED 20 #define COLUMN_PGMDLRSOURCEPARITYNAKPACKETSRECEIVED 21 #define COLUMN_PGMDLRSOURCESELECTIVENAKPACKETSRECEIVED 22 #define COLUMN_PGMDLRSOURCEPARITYNAKSRECEIVED 23 #define COLUMN_PGMDLRSOURCESELECTIVENAKSRECEIVED 24 #define COLUMN_PGMDLRSOURCEPARITYNAKSIGNORED 25 #define COLUMN_PGMDLRSOURCESELECTIVENAKSIGNORED 26 #define COLUMN_PGMDLRSOURCEACKERRORS 27 #define COLUMN_PGMDLRSOURCENNAKERRORS 28 #define COLUMN_PGMDLRSOURCEACKPACKETSRECEIVED 29 #define COLUMN_PGMDLRSOURCENNAKPACKETSRECEIVED 30 #define COLUMN_PGMDLRSOURCEPARITYNNAKPACKETSRECEIVED 31 #define COLUMN_PGMDLRSOURCESELECTIVENNAKPACKETSRECEIVED 32 #define COLUMN_PGMDLRSOURCENNAKSRECEIVED 33 #define COLUMN_PGMDLRSOURCEPARITYNNAKSRECEIVED 34 #define COLUMN_PGMDLRSOURCESELECTIVENNAKSRECEIVED 35 #endif /* PGMMIB_COLUMNS_H */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/rwspinlock.h0000644000175000017500000000753611640407352022504 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * read-write spinlock. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_RWSPINLOCK_H__ #define __PGM_IMPL_RWSPINLOCK_H__ typedef struct pgm_rwspinlock_t pgm_rwspinlock_t; #include #include PGM_BEGIN_DECLS struct pgm_rwspinlock_t { pgm_ticket_t lock; volatile uint32_t readers; }; /* read-write lock */ static inline void pgm_rwspinlock_init (pgm_rwspinlock_t* rwspinlock) { pgm_ticket_init (&rwspinlock->lock); rwspinlock->readers = 0; } static inline void pgm_rwspinlock_free (pgm_rwspinlock_t* rwspinlock) { pgm_ticket_free (&rwspinlock->lock); } static inline void pgm_rwspinlock_reader_lock (pgm_rwspinlock_t* rwspinlock) { for (;;) { #if defined( _WIN32 ) || defined( __i386__ ) || defined( __i386 ) || defined( __x86_64__ ) || defined( __amd64 ) unsigned spins = 0; while (!pgm_ticket_is_unlocked (&rwspinlock->lock)) if (!pgm_smp_system || (++spins > PGM_ADAPTIVE_MUTEX_SPINCOUNT)) # ifdef _WIN32 SwitchToThread(); # else sched_yield(); # endif else /* hyper-threading pause */ # ifdef _MSC_VER /* not implemented in Mingw */ YieldProcessor(); # else __asm volatile ("pause" ::: "memory"); # endif #else while (!pgm_ticket_is_unlocked (&rwspinlock->lock)) sched_yield(); #endif /* speculative lock */ pgm_atomic_inc32 (&rwspinlock->readers); if (pgm_ticket_is_unlocked (&rwspinlock->lock)) return; pgm_atomic_dec32 (&rwspinlock->readers); } } static inline bool pgm_rwspinlock_reader_trylock (pgm_rwspinlock_t* rwspinlock) { pgm_atomic_inc32 (&rwspinlock->readers); if (pgm_ticket_is_unlocked (&rwspinlock->lock)) return TRUE; pgm_atomic_dec32 (&rwspinlock->readers); return FALSE; } static inline void pgm_rwspinlock_reader_unlock (pgm_rwspinlock_t* rwspinlock) { pgm_atomic_dec32 (&rwspinlock->readers); } static inline void pgm_rwspinlock_writer_lock (pgm_rwspinlock_t* rwspinlock) { #if defined( _WIN32 ) || defined( __i386__ ) || defined( __i386 ) || defined( __x86_64__ ) || defined( __amd64 ) unsigned spins = 0; pgm_ticket_lock (&rwspinlock->lock); while (rwspinlock->readers) if (!pgm_smp_system || (++spins > PGM_ADAPTIVE_MUTEX_SPINCOUNT)) # ifdef _WIN32 SwitchToThread(); # else sched_yield(); # endif else /* hyper-threading pause */ # ifdef _MSC_VER YieldProcessor(); # else __asm volatile ("pause" ::: "memory"); # endif #else pgm_ticket_lock (&rwspinlock->lock); while (rwspinlock->readers) sched_yield(); #endif } static inline bool pgm_rwspinlock_writer_trylock (pgm_rwspinlock_t* rwspinlock) { if (rwspinlock->readers) return FALSE; if (!pgm_ticket_trylock (&rwspinlock->lock)) return FALSE; if (rwspinlock->readers) { pgm_ticket_unlock (&rwspinlock->lock); return FALSE; } return TRUE; } static inline void pgm_rwspinlock_writer_unlock (pgm_rwspinlock_t* rwspinlock) { pgm_ticket_unlock (&rwspinlock->lock); } PGM_END_DECLS #endif /* __PGM_IMPL_RWSPINLOCK_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/getprotobyname.h0000644000175000017500000000267111640407352023343 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable getprotobyname * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_GETPROTOBYNAME_H__ #define __PGM_IMPL_GETPROTOBYNAME_H__ struct pgm_protoent_t; #include PGM_BEGIN_DECLS struct pgm_protoent_t { char* p_name; /* Official protocol name */ char** p_aliases; /* Alias list */ int p_proto; /* Protocol number */ }; struct pgm_protoent_t* pgm_getprotobyname (const char*); PGM_END_DECLS #endif /* __PGM_IMPL_GETPROTOBYNAME_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/security.h0000644000175000017500000001400211640407352022142 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable security-enhanced CRT functions. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_SECURITY_H__ #define __PGM_IMPL_SECURITY_H__ #include #include #include #include #include #include #include #include PGM_BEGIN_DECLS #ifdef CONFIG_HAVE_FTIME static inline errno_t # ifndef _WIN32 pgm_ftime_s (struct timeb *timeptr) # elif !defined( _MSC_VER ) pgm_ftime_s (struct _timeb *timeptr) # else pgm_ftime_s (struct __timeb64 *timeptr) # endif { # ifndef _WIN32 return ftime (timeptr); # elif !defined( _MSC_VER ) _ftime (timeptr); return 0; # elif defined( CONFIG_HAVE_SECURITY_ENHANCED_CRT ) return _ftime64_s (timeptr); # else _ftime64 (timeptr); return 0; # endif } #endif /* CONFIG_HAVE_FTIME */ #ifndef _TRUNCATE # define _TRUNCATE (size_t)-1 #endif static inline errno_t pgm_strncpy_s (char *dest, size_t size, const char *src, size_t count) { #ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT if (_TRUNCATE == count) { strncpy (dest, src, size); if (size > 0) dest[size - 1] = 0; return 0; } strncpy (dest, src, count + 1); dest[count] = 0; return 0; #else return strncpy_s (dest, size, src, count); #endif } static inline int pgm_vsnprintf_s (char*, size_t, size_t, const char*, va_list) PGM_GNUC_PRINTF(4, 0); static inline int pgm_vsnprintf_s (char *str, size_t size, size_t count, const char *format, va_list ap) { #ifndef _WIN32 if (_TRUNCATE == count) { const int retval = vsnprintf (str, size, format, ap); if (size > 0) str[size - 1] = 0; return retval; } const int retval = vsnprintf (str, count + 1, format, ap); str[count] = 0; return retval; #elif !defined( CONFIG_HAVE_SECURITY_ENHANCED_CRT ) if (_TRUNCATE == count) { const int retval = _vsnprintf (str, size, format, ap); if (size > 0) str[size - 1] = 0; return retval; } const int retval = _vsnprintf (str, count + 1, format, ap); str[count] = 0; return retval; #else return _vsnprintf_s (str, size, count, format, ap); #endif } #ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT static inline int pgm_snprintf_s (char*, size_t, size_t, const char*, ...) PGM_GNUC_PRINTF(4, 5); static inline int pgm_sscanf_s (const char*, const char*, ...) PGM_GNUC_SCANF(2, 3); static inline int pgm_snprintf_s (char *str, size_t size, size_t count, const char *format, ...) { va_list ap; int retval; va_start (ap, format); retval = pgm_vsnprintf_s (str, size, count, format, ap); va_end (ap); return retval; } static inline int pgm_sscanf_s (const char *buffer, const char *format, ...) { va_list ap; int retval; va_start (ap, format); retval = vsscanf (buffer, format, ap); va_end (ap); return retval; } #else # define pgm_snprintf_s _snprintf_s # define pgm_sscanf_s sscanf_s #endif /* CONFIG_HAVE_SECURITY_ENHANCED_CRT */ static inline char* pgm_strerror_s (char *buffer, size_t size, int errnum) { #ifdef CONFIG_HAVE_SECURITY_ENHANCED_CRT if (0 != strerror_s (buffer, size, errnum)) pgm_snprintf_s (buffer, size, _TRUNCATE, _("Unknown error %d"), errnum); return buffer; #elif defined( _WIN32 ) pgm_strncpy_s (buffer, size, strerror (errnum), _TRUNCATE); return buffer; #elif defined( CONFIG_HAVE_GNU_STRERROR_R ) /* GNU-specific, failure is noted within buffer contents */ return strerror_r (errnum, buffer, size); #else /* XSI-compliant */ if (0 != strerror_r (errnum, buffer, size)) pgm_snprintf_s (buffer, size, _TRUNCATE, _("Unknown error %d"), errnum); return buffer; #endif } static inline errno_t pgm_fopen_s (FILE **pFile, const char *filename, const char *mode) { #ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT FILE* stream; if (NULL == (stream = fopen (filename, mode))) return errno; *pFile = stream; return 0; #else return fopen_s (pFile, filename, mode); #endif } /* Security-only APIs */ static inline errno_t pgm_dupenv_s (char **buffer, size_t *count, const char* name) { #ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT const char *val = getenv (name); /* not found */ if (NULL == val) { *buffer = NULL; *count = 0; return 0; } *buffer = pgm_strdup (val); /* out of memory */ if (NULL == *buffer) { *buffer = NULL; *count = 0; return errno; /* ENOMEM */ } *count = strlen (*buffer) + 1; return 0; #else char *pValue; const errno_t err = _dupenv_s (&pValue, count, name); if (err) return err; *buffer = pgm_strdup (pValue); free (pValue); return err; #endif } /* Win32 specific APIs */ #ifdef _WIN32 static inline errno_t pgm_wcstombs_s (size_t *retval, char *dest, size_t size, const wchar_t *src, size_t count) { # ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT size_t characters; if (_TRUNCATE == count) { characters = wcstombs (dest, src, size); /* may invalidate last multi-byte character */ if (size > 0) dest[size - 1] = 0; } else { characters = wcstombs (dest, src, count + 1); dest[count] = 0; } if ((size_t)-1 == characters) { *retval = 0; return errno; } *retval = characters; return 0; # else return wcstombs_s (retval, dest, size, src, count); # endif } #endif /* _WIN32 */ PGM_END_DECLS #endif /* __PGM_IMPL_SECURITY_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/i18n.h0000644000175000017500000000220011640407352021047 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * i18n & l10n support * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_I18N_H__ #define __PGM_IMPL_I18N_H__ #ifdef CONFIG_HAVE_GETTEXT # include # define _(String) dgettext (GETTEXT_PACKAGE, String) #else # define _(String) (String) #endif #endif /* __PGM_IMPL_I18N_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/time.h0000644000175000017500000000325211640407352021236 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * high resolution timers. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_TIME_H__ #define __PGM_IMPL_TIME_H__ #include #include #include PGM_BEGIN_DECLS typedef pgm_time_t (*pgm_time_update_func)(void); #define pgm_time_after(a,b) ( (a) > (b) ) #define pgm_time_before(a,b) ( pgm_time_after((b),(a)) ) #define pgm_time_after_eq(a,b) ( (a) >= (b) ) #define pgm_time_before_eq(a,b) ( pgm_time_after_eq((b),(a)) ) extern pgm_time_update_func pgm_time_update_now; PGM_GNUC_INTERNAL bool pgm_time_init (pgm_error_t**) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_time_shutdown (void); PGM_END_DECLS #endif /* __PGM_IMPL_TIME_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/timer.h0000644000175000017500000000312711640407352021421 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM timer thread. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_TIMER_H__ #define __PGM_IMPL_TIMER_H__ #include #include PGM_BEGIN_DECLS PGM_GNUC_INTERNAL bool pgm_timer_prepare (pgm_sock_t*const); PGM_GNUC_INTERNAL bool pgm_timer_check (pgm_sock_t*const); PGM_GNUC_INTERNAL pgm_time_t pgm_timer_expiration (pgm_sock_t*const); PGM_GNUC_INTERNAL bool pgm_timer_dispatch (pgm_sock_t*const); static inline void pgm_timer_lock ( pgm_sock_t* const sock ) { if (sock->can_send_data) pgm_mutex_lock (&sock->timer_mutex); } static inline void pgm_timer_unlock ( pgm_sock_t* const sock ) { if (sock->can_send_data) pgm_mutex_unlock (&sock->timer_mutex); } PGM_END_DECLS #endif /* __PGM_IMPL_TIMER_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/queue.h0000644000175000017500000000345711640407352021433 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable double-ended queue. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_QUEUE_H__ #define __PGM_IMPL_QUEUE_H__ typedef struct pgm_queue_t pgm_queue_t; #include #include PGM_BEGIN_DECLS struct pgm_queue_t { pgm_list_t* head; /* head & tail equal on 1 element */ pgm_list_t* tail; unsigned length; }; PGM_GNUC_INTERNAL bool pgm_queue_is_empty (const pgm_queue_t*const) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_queue_push_head_link (pgm_queue_t*restrict, pgm_list_t*restrict); PGM_GNUC_INTERNAL pgm_list_t* pgm_queue_pop_tail_link (pgm_queue_t*); PGM_GNUC_INTERNAL pgm_list_t* pgm_queue_peek_tail_link (pgm_queue_t*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_queue_unlink (pgm_queue_t*restrict, pgm_list_t*restrict); PGM_END_DECLS #endif /* __PGM_IMPL_QUEUE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/hashtable.h0000644000175000017500000000476611640407352022246 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable hash table. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_HASHTABLE_H__ #define __PGM_IMPL_HASHTABLE_H__ #include PGM_BEGIN_DECLS typedef struct pgm_hashtable_t pgm_hashtable_t; typedef uint_fast32_t pgm_hash_t; typedef pgm_hash_t (*pgm_hashfunc_t) (const void*); typedef bool (*pgm_equalfunc_t) (const void*restrict, const void*restrict); PGM_GNUC_INTERNAL pgm_hashtable_t* pgm_hashtable_new (pgm_hashfunc_t, pgm_equalfunc_t); PGM_GNUC_INTERNAL void pgm_hashtable_destroy (pgm_hashtable_t*); PGM_GNUC_INTERNAL void pgm_hashtable_insert (pgm_hashtable_t*restrict, const void*restrict, void*restrict); PGM_GNUC_INTERNAL bool pgm_hashtable_remove (pgm_hashtable_t*restrict, const void*restrict); PGM_GNUC_INTERNAL void pgm_hashtable_remove_all (pgm_hashtable_t*); PGM_GNUC_INTERNAL void* pgm_hashtable_lookup (const pgm_hashtable_t*restrict, const void*restrict); PGM_GNUC_INTERNAL void* pgm_hashtable_lookup_extended (const pgm_hashtable_t*restrict, const void*restrict, void*restrict); PGM_GNUC_INTERNAL void pgm_hashtable_unref (pgm_hashtable_t*); /* Hash Functions */ PGM_GNUC_INTERNAL bool pgm_str_equal (const void*restrict, const void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_hash_t pgm_str_hash (const void*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_int_equal (const void*restrict, const void*restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL pgm_hash_t pgm_int_hash (const void*) PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_IMPL_HASHTABLE_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/receiver.h0000644000175000017500000001342111640407352022103 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * PGM receiver socket. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_RECEIVER_H__ #define __PGM_IMPL_RECEIVER_H__ typedef struct pgm_peer_t pgm_peer_t; #ifndef _WIN32 # include #endif #include #include PGM_BEGIN_DECLS /* Performance Counters */ enum { PGM_PC_RECEIVER_DATA_BYTES_RECEIVED, PGM_PC_RECEIVER_DATA_MSGS_RECEIVED, PGM_PC_RECEIVER_NAK_FAILURES, PGM_PC_RECEIVER_BYTES_RECEIVED, /* PGM_PC_RECEIVER_CKSUM_ERRORS, */ /* inherently same as source */ PGM_PC_RECEIVER_MALFORMED_SPMS, PGM_PC_RECEIVER_MALFORMED_ODATA, PGM_PC_RECEIVER_MALFORMED_RDATA, PGM_PC_RECEIVER_MALFORMED_NCFS, PGM_PC_RECEIVER_PACKETS_DISCARDED, PGM_PC_RECEIVER_LOSSES, /* PGM_PC_RECEIVER_BYTES_DELIVERED_TO_APP, */ /* PGM_PC_RECEIVER_MSGS_DELIVERED_TO_APP, */ PGM_PC_RECEIVER_DUP_SPMS, PGM_PC_RECEIVER_DUP_DATAS, PGM_PC_RECEIVER_PARITY_NAK_PACKETS_SENT, PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT, PGM_PC_RECEIVER_PARITY_NAKS_SENT, PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT, PGM_PC_RECEIVER_PARITY_NAKS_RETRANSMITTED, PGM_PC_RECEIVER_SELECTIVE_NAKS_RETRANSMITTED, PGM_PC_RECEIVER_PARITY_NAKS_FAILED, PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED, PGM_PC_RECEIVER_NAKS_FAILED_RXW_ADVANCED, PGM_PC_RECEIVER_NAKS_FAILED_NCF_RETRIES_EXCEEDED, PGM_PC_RECEIVER_NAKS_FAILED_DATA_RETRIES_EXCEEDED, /* PGM_PC_RECEIVER_NAKS_FAILED_GEN_EXPIRED */ PGM_PC_RECEIVER_NAK_FAILURES_DELIVERED, PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED, PGM_PC_RECEIVER_NAK_ERRORS, /* PGM_PC_RECEIVER_LAST_ACTIVITY, */ /* PGM_PC_RECEIVER_NAK_SVC_TIME_MIN, */ PGM_PC_RECEIVER_NAK_SVC_TIME_MEAN, /* PGM_PC_RECEIVER_NAK_SVC_TIME_MAX, */ /* PGM_PC_RECEIVER_NAK_FAIL_TIME_MIN, */ PGM_PC_RECEIVER_NAK_FAIL_TIME_MEAN, /* PGM_PC_RECEIVER_NAK_FAIL_TIME_MAX, */ /* PGM_PC_RECEIVER_TRANSMIT_MIN, */ PGM_PC_RECEIVER_TRANSMIT_MEAN, /* PGM_PC_RECEIVER_TRANSMIT_MAX, */ PGM_PC_RECEIVER_ACKS_SENT, /* marker */ PGM_PC_RECEIVER_MAX }; struct pgm_peer_t { volatile uint32_t ref_count; /* atomic integer */ pgm_tsi_t tsi; struct sockaddr_storage group_nla; struct sockaddr_storage nla, local_nla; /* nla = advertised, local_nla = from packet */ struct sockaddr_storage poll_nla; /* from parent to direct poll-response */ struct sockaddr_storage redirect_nla; /* from dlr */ pgm_time_t polr_expiry; pgm_time_t spmr_expiry; pgm_time_t spmr_tstamp; pgm_rxw_t* restrict window; pgm_list_t peers_link; pgm_slist_t pending_link; unsigned is_fec_enabled:1; unsigned has_proactive_parity:1; /* indicating availability from this source */ unsigned has_ondemand_parity:1; uint32_t spm_sqn; pgm_time_t expiry; pgm_time_t ack_rb_expiry; /* 0 = no ACK pending */ pgm_time_t ack_last_tstamp; /* in source time reference */ pgm_list_t ack_link; uint32_t last_poll_sqn; uint16_t last_poll_round; pgm_time_t last_packet; pgm_time_t last_data_tstamp; /* local timestamp of ack_last_tstamp */ unsigned last_commit; uint32_t lost_count; uint32_t last_cumulative_losses; volatile uint32_t cumulative_stats[PGM_PC_RECEIVER_MAX]; uint32_t snap_stats[PGM_PC_RECEIVER_MAX]; uint32_t min_fail_time; uint32_t max_fail_time; }; PGM_GNUC_INTERNAL pgm_peer_t* pgm_new_peer (pgm_sock_t*const restrict, const pgm_tsi_t*const restrict, const struct sockaddr*const restrict, const socklen_t, const struct sockaddr*const restrict, const socklen_t, const pgm_time_t); PGM_GNUC_INTERNAL void pgm_peer_unref (pgm_peer_t*); PGM_GNUC_INTERNAL int pgm_flush_peers_pending (pgm_sock_t*const restrict, struct pgm_msgv_t**restrict, const struct pgm_msgv_t*const, size_t*const restrict, unsigned*const restrict); PGM_GNUC_INTERNAL bool pgm_peer_has_pending (pgm_peer_t*const) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_peer_set_pending (pgm_sock_t*const restrict, pgm_peer_t*const restrict); PGM_GNUC_INTERNAL bool pgm_check_peer_state (pgm_sock_t*const, const pgm_time_t); PGM_GNUC_INTERNAL void pgm_set_reset_error (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_msgv_t*const restrict); PGM_GNUC_INTERNAL pgm_time_t pgm_min_receiver_expiry (pgm_sock_t*, pgm_time_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_peer_nak (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_data (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_ncf (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_spm (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL bool pgm_on_poll (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict) PGM_GNUC_WARN_UNUSED_RESULT; PGM_END_DECLS #endif /* __PGM_IMPL_RECEIVER_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/rate_control.h0000644000175000017500000000372411640407352022777 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Rate regulation. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_RATE_CONTROL_H__ #define __PGM_IMPL_RATE_CONTROL_H__ typedef struct pgm_rate_t pgm_rate_t; #include #include #include PGM_BEGIN_DECLS struct pgm_rate_t { ssize_t rate_per_sec; ssize_t rate_per_msec; size_t iphdr_len; ssize_t rate_limit; /* signed for math */ pgm_time_t last_rate_check; pgm_spinlock_t spinlock; }; PGM_GNUC_INTERNAL void pgm_rate_create (pgm_rate_t*, const ssize_t, const size_t, const uint16_t); PGM_GNUC_INTERNAL void pgm_rate_destroy (pgm_rate_t*); PGM_GNUC_INTERNAL bool pgm_rate_check2 (pgm_rate_t*, pgm_rate_t*, const size_t, const bool); PGM_GNUC_INTERNAL bool pgm_rate_check (pgm_rate_t*, const size_t, const bool); PGM_GNUC_INTERNAL pgm_time_t pgm_rate_remaining2 (pgm_rate_t*, pgm_rate_t*, const size_t); PGM_GNUC_INTERNAL pgm_time_t pgm_rate_remaining (pgm_rate_t*, const size_t); PGM_END_DECLS #endif /* __PGM_IMPL_RATE_CONTROL_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/getnetbyname.h0000644000175000017500000000266611640407352022772 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable getnetbyname * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_GETNETBYNAME_H__ #define __PGM_IMPL_GETNETBYNAME_H__ struct pgm_netent_t; #include PGM_BEGIN_DECLS struct pgm_netent_t { char* n_name; /* Official network name */ char** n_aliases; /* Alias list */ struct sockaddr_storage n_net; /* Network address */ }; struct pgm_netent_t* pgm_getnetbyname (const char*); PGM_END_DECLS #endif /* __PGM_IMPL_GETNETBYNAME_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/md5.h0000644000175000017500000000364411640407352020772 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * MD5 hashing algorithm. * * MD5 original source GNU C Library: * Includes functions to compute MD5 message digest of files or memory blocks * according to the definition of MD5 in RFC 1321 from April 1992. * * Copyright (C) 1995, 1996, 2001, 2003 Free Software Foundation, Inc. * * This file is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this file; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_MD5_H__ #define __PGM_IMPL_MD5_H__ struct pgm_md5_t; #include PGM_BEGIN_DECLS struct pgm_md5_t { uint32_t A; uint32_t B; uint32_t C; uint32_t D; uint32_t total[2]; uint32_t buflen; char buffer[128] #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) __attribute__ ((__aligned__ (__alignof__ (uint32_t)))) #endif ; }; PGM_GNUC_INTERNAL void pgm_md5_init_ctx (struct pgm_md5_t*); PGM_GNUC_INTERNAL void pgm_md5_process_bytes (struct pgm_md5_t*restrict, const void*restrict, size_t); PGM_GNUC_INTERNAL void* pgm_md5_finish_ctx (struct pgm_md5_t*restrict, void*restrict); PGM_END_DECLS #endif /* __PGM_IMPL_MD5_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/fixed.h0000644000175000017500000000634711640407352021407 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * 8-bit and 16-bit shift fixed point math * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_FIXED_H__ #define __PGM_IMPL_FIXED_H__ #include PGM_BEGIN_DECLS static inline uint_fast32_t pgm_fp8 (unsigned) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp16 (unsigned) PGM_GNUC_CONST; static inline unsigned pgm_fp8tou (uint_fast32_t) PGM_GNUC_CONST; static inline unsigned pgm_fp16tou (uint_fast32_t) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp8mul (uint_fast32_t, uint_fast32_t) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp16mul (uint_fast32_t, uint_fast32_t) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp8div (uint_fast32_t, uint_fast32_t) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp16div (uint_fast32_t, uint_fast32_t) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp16pow (uint_fast32_t, uint_fast32_t) PGM_GNUC_CONST; static inline uint_fast32_t pgm_fp8 ( unsigned v ) { return (uint32_t)(v << 8); } static inline uint_fast32_t pgm_fp16 ( unsigned v ) { return (uint_fast32_t)(v << 16); } static inline unsigned pgm_fp8tou ( uint_fast32_t f ) { return (f + (1 << 7)) >> 8; } static inline unsigned pgm_fp16tou ( uint_fast32_t f ) { return (f + (1 << 15)) >> 16; } static inline uint_fast32_t pgm_fp8mul ( uint_fast32_t a, uint_fast32_t b ) { return ( a * b + 128 ) >> 8; } static inline uint_fast32_t pgm_fp16mul ( uint_fast32_t a, uint_fast32_t b ) { return ( a * b + 32768 ) >> 16; } static inline uint_fast32_t pgm_fp8div ( uint_fast32_t a, uint_fast32_t b ) { return ( ( (a << 9) / b ) + 1 ) / 2; } static inline uint_fast32_t pgm_fp16div ( uint_fast32_t a, uint_fast32_t b ) { return ( ( (a << 17) / b ) + 1 ) / 2; } static inline uint_fast32_t pgm_fp16pow ( uint_fast32_t x, uint_fast32_t y ) { uint_fast32_t result = pgm_fp16 (1); #if defined(__STDC_VERSION__) && (__STDC_VERSION >= 199901L) /* C99 version */ for (uint_fast32_t i = x; y; y >>= 1) { if (y & 1) result = (result * i + 32768) >> 16; i = (i * i + 32768) >> 16; } #else /* C89 version */ { uint_fast32_t i; for (i = x; y; y >>= 1) { if (y & 1) result = (result * i + 32768) >> 16; i = (i * i + 32768) >> 16; } } #endif return result; } PGM_END_DECLS #endif /* __PGM_IMPL_FIXED_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/notify.h0000644000175000017500000001700011640407352021604 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Low kernel overhead event notify mechanism, or standard pipes. * * Copyright (c) 2008-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_NOTIFY_H__ #define __PGM_IMPL_NOTIFY_H__ typedef struct pgm_notify_t pgm_notify_t; #ifndef _WIN32 # include # include # ifdef CONFIG_HAVE_EVENTFD # include # endif #else /* _WIN32 */ # include # include #endif #include #include #include PGM_BEGIN_DECLS struct pgm_notify_t { #if defined(CONFIG_HAVE_EVENTFD) int eventfd; #elif !defined(_WIN32) int pipefd[2]; #else SOCKET s[2]; #endif /* _WIN32 */ }; #if defined(CONFIG_HAVE_EVENTFD) # define PGM_NOTIFY_INIT { -1 } #elif !defined(_WIN32) # define PGM_NOTIFY_INIT { { -1, -1 } } #else # define PGM_NOTIFY_INIT { { INVALID_SOCKET, INVALID_SOCKET } } #endif static inline bool pgm_notify_is_valid ( pgm_notify_t* notify ) { if (PGM_UNLIKELY(NULL == notify)) return FALSE; #if defined(CONFIG_HAVE_EVENTFD) if (PGM_UNLIKELY(-1 == notify->eventfd)) return FALSE; #elif !defined(_WIN32) if (PGM_UNLIKELY(-1 == notify->pipefd[0] || -1 == notify->pipefd[1])) return FALSE; #else if (PGM_UNLIKELY(INVALID_SOCKET == notify->s[0] || INVALID_SOCKET == notify->s[1])) return FALSE; #endif /* _WIN32 */ return TRUE; } static inline int pgm_notify_init ( pgm_notify_t* notify ) { #if defined(CONFIG_HAVE_EVENTFD) pgm_assert (NULL != notify); notify->eventfd = -1; int retval = eventfd (0, 0); if (-1 == retval) return retval; notify->eventfd = retval; const int fd_flags = fcntl (notify->eventfd, F_GETFL); if (-1 != fd_flags) retval = fcntl (notify->eventfd, F_SETFL, fd_flags | O_NONBLOCK); return 0; #elif !defined(_WIN32) pgm_assert (NULL != notify); notify->pipefd[0] = notify->pipefd[1] = -1; int retval = pipe (notify->pipefd); pgm_assert (0 == retval); /* set non-blocking */ /* write-end */ int fd_flags = fcntl (notify->pipefd[1], F_GETFL); if (fd_flags != -1) retval = fcntl (notify->pipefd[1], F_SETFL, fd_flags | O_NONBLOCK); pgm_assert (notify->pipefd[1]); /* read-end */ fd_flags = fcntl (notify->pipefd[0], F_GETFL); if (fd_flags != -1) retval = fcntl (notify->pipefd[0], F_SETFL, fd_flags | O_NONBLOCK); pgm_assert (notify->pipefd[0]); return retval; #else /* use loopback sockets to simulate a pipe suitable for win32/select() */ struct sockaddr_in addr; SOCKET listener; int sockerr; int addrlen = sizeof (addr); unsigned long one = 1; pgm_assert (NULL != notify); notify->s[0] = notify->s[1] = INVALID_SOCKET; listener = socket (AF_INET, SOCK_STREAM, 0); pgm_assert (listener != INVALID_SOCKET); memset (&addr, 0, sizeof (addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = inet_addr ("127.0.0.1"); pgm_assert (addr.sin_addr.s_addr != INADDR_NONE); sockerr = bind (listener, (const struct sockaddr*)&addr, sizeof (addr)); pgm_assert (sockerr != SOCKET_ERROR); sockerr = getsockname (listener, (struct sockaddr*)&addr, &addrlen); pgm_assert (sockerr != SOCKET_ERROR); // Listen for incoming connections. sockerr = listen (listener, 1); pgm_assert (sockerr != SOCKET_ERROR); // Create the socket. notify->s[1] = WSASocket (AF_INET, SOCK_STREAM, 0, NULL, 0, 0); pgm_assert (notify->s[1] != INVALID_SOCKET); // Connect to the remote peer. sockerr = connect (notify->s[1], (struct sockaddr*)&addr, addrlen); pgm_assert (sockerr != SOCKET_ERROR); // Accept connection. notify->s[0] = accept (listener, NULL, NULL); pgm_assert (notify->s[0] != INVALID_SOCKET); // Set read-end to non-blocking mode sockerr = ioctlsocket (notify->s[0], FIONBIO, &one); pgm_assert (sockerr != SOCKET_ERROR); // We don't need the listening socket anymore. Close it. sockerr = closesocket (listener); pgm_assert (sockerr != SOCKET_ERROR); return 0; #endif } static inline int pgm_notify_destroy ( pgm_notify_t* notify ) { pgm_assert (NULL != notify); #if defined(CONFIG_HAVE_EVENTFD) if (-1 != notify->eventfd) { close (notify->eventfd); notify->eventfd = -1; } #elif !defined(_WIN32) if (-1 != notify->pipefd[0]) { close (notify->pipefd[0]); notify->pipefd[0] = -1; } if (-1 != notify->pipefd[1]) { close (notify->pipefd[1]); notify->pipefd[1] = -1; } #else if (INVALID_SOCKET != notify->s[0]) { closesocket (notify->s[0]); notify->s[0] = INVALID_SOCKET; } if (INVALID_SOCKET != notify->s[1]) { closesocket (notify->s[1]); notify->s[1] = INVALID_SOCKET; } #endif return 0; } static inline int pgm_notify_send ( pgm_notify_t* notify ) { #if defined(CONFIG_HAVE_EVENTFD) uint64_t u = 1; pgm_assert (NULL != notify); pgm_assert (-1 != notify->eventfd); ssize_t s = write (notify->eventfd, &u, sizeof(u)); return (s == sizeof(u)); #elif !defined(_WIN32) const char one = '1'; pgm_assert (NULL != notify); pgm_assert (-1 != notify->pipefd[1]); return (1 == write (notify->pipefd[1], &one, sizeof(one))); #else const char one = '1'; pgm_assert (NULL != notify); pgm_assert (INVALID_SOCKET != notify->s[1]); return (1 == send (notify->s[1], &one, sizeof(one), 0)); #endif } static inline int pgm_notify_read ( pgm_notify_t* notify ) { #if defined(CONFIG_HAVE_EVENTFD) uint64_t u; pgm_assert (NULL != notify); pgm_assert (-1 != notify->eventfd); return (sizeof(u) == read (notify->eventfd, &u, sizeof(u))); #elif !defined(_WIN32) char buf; pgm_assert (NULL != notify); pgm_assert (-1 != notify->pipefd[0]); return (sizeof(buf) == read (notify->pipefd[0], &buf, sizeof(buf))); #else char buf; pgm_assert (NULL != notify); pgm_assert (INVALID_SOCKET != notify->s[0]); return (sizeof(buf) == recv (notify->s[0], &buf, sizeof(buf), 0)); #endif } static inline void pgm_notify_clear ( pgm_notify_t* notify ) { #if defined(CONFIG_HAVE_EVENTFD) uint64_t u; pgm_assert (NULL != notify); pgm_assert (-1 != notify->eventfd); while (sizeof(u) == read (notify->eventfd, &u, sizeof(u))); #elif !defined(_WIN32) char buf; pgm_assert (NULL != notify); pgm_assert (-1 != notify->pipefd[0]); while (sizeof(buf) == read (notify->pipefd[0], &buf, sizeof(buf))); #else char buf; pgm_assert (NULL != notify); pgm_assert (INVALID_SOCKET != notify->s[0]); while (sizeof(buf) == recv (notify->s[0], &buf, sizeof(buf), 0)); #endif } static inline SOCKET pgm_notify_get_socket ( pgm_notify_t* notify ) { pgm_assert (NULL != notify); #if defined(CONFIG_HAVE_EVENTFD) pgm_assert (-1 != notify->eventfd); return notify->eventfd; #elif !defined(_WIN32) pgm_assert (-1 != notify->pipefd[0]); return notify->pipefd[0]; #else pgm_assert (INVALID_SOCKET != notify->s[0]); return notify->s[0]; #endif } PGM_END_DECLS #endif /* __PGM_IMPL_NOTIFY_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/rxw.h0000644000175000017500000001637111640407352021126 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * basic receive window. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_RXW_H__ #define __PGM_IMPL_RXW_H__ typedef struct pgm_rxw_state_t pgm_rxw_state_t; typedef struct pgm_rxw_t pgm_rxw_t; #include PGM_BEGIN_DECLS enum { PGM_PKT_STATE_ERROR = 0, PGM_PKT_STATE_BACK_OFF, /* PGM protocol recovery states */ PGM_PKT_STATE_WAIT_NCF, PGM_PKT_STATE_WAIT_DATA, PGM_PKT_STATE_HAVE_DATA, /* data received waiting to commit to application layer */ PGM_PKT_STATE_HAVE_PARITY, /* contains parity information not original data */ PGM_PKT_STATE_COMMIT_DATA, /* commited data waiting for purging */ PGM_PKT_STATE_LOST_DATA /* if recovery fails, but packet has not yet been commited */ }; enum { PGM_RXW_OK = 0, PGM_RXW_INSERTED, PGM_RXW_APPENDED, PGM_RXW_UPDATED, PGM_RXW_MISSING, PGM_RXW_DUPLICATE, PGM_RXW_MALFORMED, PGM_RXW_BOUNDS, PGM_RXW_SLOW_CONSUMER, PGM_RXW_UNKNOWN }; /* must be smaller than PGM skbuff control buffer */ struct pgm_rxw_state_t { pgm_time_t timer_expiry; int pkt_state; uint8_t nak_transmit_count; /* 8-bit for size constraints */ uint8_t ncf_retry_count; uint8_t data_retry_count; /* only valid on tg_sqn::pkt_sqn = 0 */ unsigned is_contiguous:1; /* transmission group */ }; struct pgm_rxw_t { const pgm_tsi_t* tsi; pgm_queue_t ack_backoff_queue; pgm_queue_t nak_backoff_queue; pgm_queue_t wait_ncf_queue; pgm_queue_t wait_data_queue; /* window context counters */ uint32_t lost_count; /* failed to repair */ uint32_t fragment_count; /* incomplete apdu */ uint32_t parity_count; /* parity for repairs */ uint32_t committed_count; /* but still in window */ uint16_t max_tpdu; /* maximum packet size */ uint32_t lead, trail; uint32_t rxw_trail, rxw_trail_init; uint32_t commit_lead; unsigned is_constrained:1; unsigned is_defined:1; unsigned has_event:1; /* edge triggered */ unsigned is_fec_available:1; pgm_rs_t rs; uint32_t tg_size; /* transmission group size for parity recovery */ uint8_t tg_sqn_shift; uint32_t bitmap; /* receive status of last 32 packets */ uint32_t data_loss; /* p */ uint32_t ack_c_p; /* constant Cᵨ */ /* counters all guint32 */ uint32_t min_fill_time; /* restricted from pgm_time_t */ uint32_t max_fill_time; uint32_t min_nak_transmit_count; uint32_t max_nak_transmit_count; uint32_t cumulative_losses; uint32_t bytes_delivered; uint32_t msgs_delivered; size_t size; /* in bytes */ unsigned alloc; /* in pkts */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 flexible array, sizeof() invalid */ struct pgm_sk_buff_t* pdata[]; #elif !defined(__STDC_VERSION__) || defined(__cplusplus) /* C90 and older */ struct pgm_sk_buff_t* pdata[1]; #else /* GNU C variable-length object */ struct pgm_sk_buff_t* pdata[0]; #endif }; PGM_GNUC_INTERNAL pgm_rxw_t* pgm_rxw_create (const pgm_tsi_t*const, const uint16_t, const unsigned, const unsigned, const ssize_t, const uint32_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_rxw_destroy (pgm_rxw_t*const); PGM_GNUC_INTERNAL int pgm_rxw_add (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict, const pgm_time_t, const pgm_time_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_rxw_add_ack (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict, const pgm_time_t); PGM_GNUC_INTERNAL void pgm_rxw_remove_ack (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict); PGM_GNUC_INTERNAL void pgm_rxw_remove_commit (pgm_rxw_t*const); PGM_GNUC_INTERNAL ssize_t pgm_rxw_readv (pgm_rxw_t*const restrict, struct pgm_msgv_t** restrict, const unsigned) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL unsigned pgm_rxw_remove_trail (pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL unsigned pgm_rxw_update (pgm_rxw_t*const, const uint32_t, const uint32_t, const pgm_time_t, const pgm_time_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_rxw_update_fec (pgm_rxw_t*const, const uint8_t); PGM_GNUC_INTERNAL int pgm_rxw_confirm (pgm_rxw_t*const, const uint32_t, const pgm_time_t, const pgm_time_t, const pgm_time_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_rxw_lost (pgm_rxw_t*const, const uint32_t); PGM_GNUC_INTERNAL void pgm_rxw_state (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict, const int); PGM_GNUC_INTERNAL struct pgm_sk_buff_t* pgm_rxw_peek (pgm_rxw_t*const, const uint32_t) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL const char* pgm_pkt_state_string (const int) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL const char* pgm_rxw_returns_string (const int) PGM_GNUC_WARN_UNUSED_RESULT; PGM_GNUC_INTERNAL void pgm_rxw_dump (const pgm_rxw_t*const); /* declare for GCC attributes */ static inline unsigned pgm_rxw_max_length (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_rxw_length (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline size_t pgm_rxw_size (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline bool pgm_rxw_is_empty (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline bool pgm_rxw_is_full (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_rxw_lead (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline uint32_t pgm_rxw_next_lead (const pgm_rxw_t*const) PGM_GNUC_WARN_UNUSED_RESULT; static inline unsigned pgm_rxw_max_length ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return window->alloc; } static inline uint32_t pgm_rxw_length ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return ( 1 + window->lead ) - window->trail; } static inline size_t pgm_rxw_size ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return window->size; } static inline bool pgm_rxw_is_empty ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return pgm_rxw_length (window) == 0; } static inline bool pgm_rxw_is_full ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return pgm_rxw_length (window) == pgm_rxw_max_length (window); } static inline uint32_t pgm_rxw_lead ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return window->lead; } static inline uint32_t pgm_rxw_next_lead ( const pgm_rxw_t* const window ) { pgm_assert (NULL != window); return (uint32_t)(pgm_rxw_lead (window) + 1); } PGM_END_DECLS #endif /* __PGM_IMPL_RXW_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/ticket.h0000644000175000017500000002374411640407352021573 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Ticket spinlocks per Jonathan Corbet on LKML and Leslie Lamport's * Bakery algorithm. * * NB: CMPXCHG requires 80486 microprocessor. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_TICKET_H__ #define __PGM_IMPL_TICKET_H__ typedef union pgm_ticket_t pgm_ticket_t; #if defined( __sun ) # include #elif defined( __APPLE__ ) # include #elif defined( _WIN32 ) # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # include # if defined( _MSC_VER ) /* not implemented in MinGW */ # include # endif #else # include # include #endif #include #include #include PGM_BEGIN_DECLS /* Byte alignment for CAS friendly unions. * NB: Solaris and OpenSolaris don't support #pragma pack(push) even on x86. */ #if defined( __GNUC__ ) && !defined( __sun ) # pragma pack(push) #endif #pragma pack(1) union pgm_ticket_t { #if defined( _WIN64 ) volatile uint64_t pgm_tkt_data64; struct { volatile uint32_t pgm_un_ticket; volatile uint32_t pgm_un_user; } pgm_un; #else volatile uint32_t pgm_tkt_data32; struct { volatile uint16_t pgm_un_ticket; volatile uint16_t pgm_un_user; } pgm_un; #endif }; #define pgm_tkt_ticket pgm_un.pgm_un_ticket #define pgm_tkt_user pgm_un.pgm_un_user #if defined( __GNUC__ ) && !defined( __sun ) # pragma pack(pop) #else # pragma pack() #endif /* additional required atomic ops */ /* 32-bit word CAS, returns TRUE if swap occurred. * * if (*atomic == oldval) { * *atomic = newval; * return TRUE; * } * return FALSE; * * Sun Studio on x86 GCC-compatible assembler not implemented. */ static inline bool pgm_atomic_compare_and_exchange32 ( volatile uint32_t* atomic, const uint32_t newval, const uint32_t oldval ) { #if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) /* GCC assembler */ uint8_t result; __asm__ volatile ("lock; cmpxchgl %2, %0\n\t" "setz %1\n\t" : "+m" (*atomic), "=q" (result) : "ir" (newval), "a" (oldval) : "memory", "cc" ); return (bool)result; #elif defined( __SUNPRO_C ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) /* GCC-compatible assembler */ uint8_t result; __asm__ volatile ("lock; cmpxchgl %2, %0\n\t" "setz %1\n\t" : "+m" (*atomic), "=q" (result) : "r" (newval), "a" (oldval) : "memory", "cc" ); return (bool)result; #elif defined( __sun ) /* Solaris intrinsic */ const uint32_t original = atomic_cas_32 (atomic, oldval, newval); return (oldval == original); #elif defined( __APPLE__ ) /* Darwin intrinsic */ return OSAtomicCompareAndSwap32Barrier ((int32_t)oldval, (int32_t)newval, (volatile int32_t*)atomic); #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* GCC 4.0.1 intrinsic */ return __sync_bool_compare_and_swap (atomic, oldval, newval); #elif defined( _WIN32 ) /* Windows intrinsic */ const uint32_t original = _InterlockedCompareExchange ((volatile LONG*)atomic, newval, oldval); return (oldval == original); #endif } #if defined( _WIN64 ) /* returns TRUE if swap occurred */ static inline bool pgm_atomic_compare_and_exchange64 ( volatile uint64_t* atomic, const uint64_t newval, const uint64_t oldval ) { /* Windows intrinsic */ const uint64_t original = _InterlockedCompareExchange64 ((volatile LONGLONG*)atomic, newval, oldval); return (oldval == original); } /* returns original atomic value */ static inline uint32_t pgm_atomic_fetch_and_inc32 ( volatile uint32_t* atomic ) { const uint32_t nv = _InterlockedIncrement ((volatile LONG*)atomic); return nv - 1; } /* 64-bit word load */ static inline uint64_t pgm_atomic_read64 ( const volatile uint64_t* atomic ) { return *atomic; } #else /* 16-bit word addition. */ static inline void pgm_atomic_add16 ( volatile uint16_t* atomic, const uint16_t val ) { # if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) __asm__ volatile ("lock; addw %1, %0" : "=m" (*atomic) : "ir" (val), "m" (*atomic) : "memory", "cc" ); # elif defined( __SUNPRO_C ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) __asm__ volatile ("lock; addw %0, %1" : : "r" (val), "m" (*atomic) : "memory", "cc" ); # elif defined( __sun ) atomic_add_16 (atomic, val); # elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* interchangable with __sync_fetch_and_add () */ __sync_add_and_fetch (atomic, val); # elif defined( __APPLE__ ) # error "There is no OSAtomicAdd16Barrier() on Darwin." # elif defined( _WIN32 ) /* there is no _InterlockedExchangeAdd16() */ _ReadWriteBarrier(); __asm { mov ecx, atomic mov ax, val lock add ax, word ptr [ecx] } _ReadWriteBarrier(); # endif } /* 16-bit word addition returning original atomic value. */ static inline uint16_t pgm_atomic_fetch_and_add16 ( volatile uint16_t* atomic, const uint16_t val ) { # if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) uint16_t result; __asm__ volatile ("lock; xaddw %0, %1" : "=r" (result), "=m" (*atomic) : "0" (val), "m" (*atomic) : "memory", "cc" ); return result; # elif defined( __SUNPRO_C ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) uint16_t result = val; __asm__ volatile ("lock; xaddw %0, %1" : "+r" (result) : "m" (*atomic) : "memory", "cc" ); return result; # elif defined( __sun ) const uint16_t nv = atomic_add_16_nv (atomic, val); return nv - val; # elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) return __sync_fetch_and_add (atomic, val); # elif defined( __APPLE__ ) # error "There is no OSAtomicAdd16Barrier() on Darwin." # elif defined( _WIN32 ) /* there is no _InterlockedExchangeAdd16() */ uint16_t result; _ReadWriteBarrier(); __asm { mov ecx, atomic mov ax, val lock xadd word ptr [ecx], ax mov result, ax } _ReadWriteBarrier(); return result; # endif } /* 16-bit word increment. */ static inline void pgm_atomic_inc16 ( volatile uint16_t* atomic ) { # if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) __asm__ volatile ("lock; incw %0" : "+m" (*atomic) : : "memory", "cc" ); # elif defined( __SUNPRO_C ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) __asm__ volatile ("lock; incw %0" : "+m" (*atomic) : : "memory", "cc" ); # elif defined( __sun ) atomic_inc_16 (atomic); # elif defined( _WIN32 ) /* _InterlockedIncrement16() operates on 32-bit boundaries */ _ReadWriteBarrier(); __asm { mov ecx, atomic lock inc word ptr [ecx] } _ReadWriteBarrier(); # else /* there is no OSAtomicIncrement16Barrier() on Darwin. */ pgm_atomic_add16 (atomic, 1); # endif } /* 16-bit word increment returning original atomic value. */ static inline uint16_t pgm_atomic_fetch_and_inc16 ( volatile uint16_t* atomic ) { /* _InterlockedIncrement16() operates on 32-bit boundaries. * there is no OSAtomicIncrement16Barrier() on Darwin. * there is no xincw instruction on x86. */ return pgm_atomic_fetch_and_add16 (atomic, 1); } #endif /* !_WIN64 */ /* ticket spinlocks */ static inline void pgm_ticket_init (pgm_ticket_t* ticket) { #ifdef _WIN64 ticket->pgm_tkt_data64 = 0; #else ticket->pgm_tkt_data32 = 0; #endif } static inline void pgm_ticket_free (pgm_ticket_t* ticket) { /* nop */ (void)ticket; } static inline bool pgm_ticket_trylock (pgm_ticket_t* ticket) { #ifdef _WIN64 const uint32_t user = ticket->pgm_tkt_user; #else const uint16_t user = ticket->pgm_tkt_user; #endif pgm_ticket_t exchange, comparand; comparand.pgm_tkt_user = comparand.pgm_tkt_ticket = exchange.pgm_tkt_ticket = user; exchange.pgm_tkt_user = user + 1; #ifdef _WIN64 return pgm_atomic_compare_and_exchange64 (&ticket->pgm_tkt_data64, exchange.pgm_tkt_data64, comparand.pgm_tkt_data64); #else return pgm_atomic_compare_and_exchange32 (&ticket->pgm_tkt_data32, exchange.pgm_tkt_data32, comparand.pgm_tkt_data32); #endif } static inline void pgm_ticket_lock (pgm_ticket_t* ticket) { #ifdef _WIN64 const uint32_t user = pgm_atomic_fetch_and_inc32 (&ticket->pgm_tkt_user); #else const uint16_t user = pgm_atomic_fetch_and_inc16 (&ticket->pgm_tkt_user); #endif #if defined( _WIN32 ) || defined( __i386__ ) || defined( __i386 ) || defined( __x86_64__ ) || defined( __amd64 ) unsigned spins = 0; while (ticket->pgm_tkt_ticket != user) if (!pgm_smp_system || (++spins > PGM_ADAPTIVE_MUTEX_SPINCOUNT)) # ifdef _WIN32 SwitchToThread(); # else sched_yield(); # endif else /* hyper-threading pause */ # ifdef _MSC_VER YieldProcessor(); # else __asm volatile ("pause" ::: "memory"); # endif #else while (ticket->pgm_tkt_ticket != user) sched_yield(); #endif } static inline void pgm_ticket_unlock (pgm_ticket_t* ticket) { #ifdef _WIN64 pgm_atomic_inc32 (&ticket->pgm_tkt_ticket); #else pgm_atomic_inc16 (&ticket->pgm_tkt_ticket); #endif } static inline bool pgm_ticket_is_unlocked (pgm_ticket_t* ticket) { pgm_ticket_t copy; #ifdef _WIN64 copy.pgm_tkt_data64 = pgm_atomic_read64 (&ticket->pgm_tkt_data64); #else copy.pgm_tkt_data32 = pgm_atomic_read32 (&ticket->pgm_tkt_data32); #endif return (copy.pgm_tkt_ticket == copy.pgm_tkt_user); } PGM_END_DECLS #endif /* __PGM_IMPL_TICKET_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/include/impl/math.h0000644000175000017500000000406211640407352021231 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Shared math routines. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined (__PGM_IMPL_FRAMEWORK_H_INSIDE__) && !defined (PGM_COMPILATION) # error "Only can be included directly." #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #ifndef __PGM_IMPL_MATH_H__ #define __PGM_IMPL_MATH_H__ #include PGM_BEGIN_DECLS /* fast log base 2 of power of 2 */ static inline unsigned pgm_power2_log2 (unsigned) PGM_GNUC_CONST; static inline unsigned pgm_power2_log2 ( unsigned v ) { static const unsigned int b[] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 }; unsigned int r = (v & b[0]) != 0; #if defined(__STDC_VERSION__) && (__STDC_VERSION >= 199901L) /* C99 version */ for (unsigned i = 4; i > 0; i--) { r |= ((v & b[i]) != 0) << i; } #else /* C89 version */ { unsigned i; for (i = 4; i > 0; i--) { r |= ((v & b[i]) != 0) << i; } } #endif return r; } /* nearest power of 2 */ static inline size_t pgm_nearest_power (size_t, size_t) PGM_GNUC_CONST; static inline size_t pgm_nearest_power ( size_t b, size_t v ) { if (v > (SIZE_MAX/2)) return SIZE_MAX; while (b < v) b <<= 1; return b; } unsigned pgm_spaced_primes_closest (unsigned) PGM_GNUC_PURE; PGM_END_DECLS #endif /* __PGM_IMPL_MATH_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/configure.ac0000644000175000017500000002250011640407354020030 0ustar locallocal# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # Ubuntu 10 : v2.65 # OSX 10.6 : v2.61 # Solaris 10 : v2.59 AC_PREREQ([2.61]) AC_INIT([OpenPGM], [m4_esyscmd([perl version.pl %major.%minor.%micro])], [openpgm-dev@googlegroups.com], [openpgm], [http://code.google.com/p/openpgm/]) AC_CONFIG_SRCDIR([reed_solomon.c]) AC_CONFIG_MACRO_DIR([m4]) # Ubuntu 10 : v1.11 # OSX 10.6 : v1.10 # Solaris 10 : v1.8 AM_INIT_AUTOMAKE([1.10 no-define foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_SUBST([RELEASE_INFO], [m4_esyscmd([perl version.pl %major.%minor])]) AC_SUBST([VERSION_INFO], [m4_esyscmd([perl version.pl 0:%micro])]) AC_SUBST([VERSION_MAJOR], [m4_esyscmd([perl version.pl %major])]) AC_SUBST([VERSION_MINOR], [m4_esyscmd([perl version.pl %minor])]) AC_SUBST([VERSION_MICRO], [m4_esyscmd([perl version.pl %micro])]) # Checks for programs. AC_PROG_CC AC_PROG_CC_C99 AC_PROG_LIBTOOL AC_PATH_PROG(PERL, perl) AC_PATH_PROG(PYTHON, python) # nb: earliest verifiable version is 2.2. m4_ifdef([LT_PREREQ], [LT_PREREQ([2.2])]) m4_ifdef([LT_INIT], [LT_INIT]) AC_SUBST([LIBTOOL_DEPS]) AC_SUBST(PERL) AC_SUBST(PYTHON) # Apply system specific rules. AC_CANONICAL_HOST CFLAGS="$CFLAGS -D_REENTRANT" case "$host_os" in linux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE" ;; solaris*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" AC_SEARCH_LIBS([socket], [socket]) AC_SEARCH_LIBS([gethostname], [nsl]) AC_SEARCH_LIBS([inet_aton], [resolv]) AC_SEARCH_LIBS([kstat_open], [kstat]) ;; *) ;; esac # Checks for libraries. AC_SEARCH_LIBS([sqrt], [m]) AC_SEARCH_LIBS([pthread_mutex_trylock], [pthread]) AC_SEARCH_LIBS([clock_gettime], [rt]) # Checks for header files. AC_FUNC_ALLOCA AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_TYPE_UID_T AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT64_T AC_TYPE_INT8_T AC_TYPE_MODE_T AC_C_RESTRICT AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T # Checks for library functions. # TODO: gettext() fails out-of-the-box from AutoConf. #AM_GNU_GETTEXT AC_FUNC_MALLOC AC_FUNC_MMAP AC_FUNC_REALLOC AC_FUNC_STRERROR_R AC_CHECK_FUNCS([atexit clock_gettime floor ftime gethostbyaddr gethostbyname gethostname gettimeofday inet_ntoa memmove memset regcomp select setenv setlocale socket sqrt stpcpy strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul strtoull]) # POSIX spinlocks AC_MSG_CHECKING([for pthread_spinlock]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[pthread_spinlock_t spinlock; pthread_spin_lock (&spinlock);]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_POSIX_SPINLOCK"], [AC_MSG_RESULT([no])]) # NSS protocol lookup AC_CHECK_FUNC([getprotobyname_r]) if test "x$ac_cv_func_getprotobyname_r" = "xyes"; then AC_MSG_CHECKING([for 4- or 5-param getprotobyname_r]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[getprotobyname_r ((const char*)0, (struct protoent*)0, (char*)0, (size_t)0, (struct protoent**)0);]])], [AC_MSG_RESULT([5-param]) CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R2"], [AC_MSG_RESULT([4-param]) CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R"]) fi # NSS networks lookup, IPv4 only AC_CHECK_FUNC([getnetent], CFLAGS="$CFLAGS -DCONFIG_HAVE_GETNETENT",) # variadic macros AC_MSG_CHECKING([for C99 variadic macros]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include #define error(...) fprintf (stderr, __VA_ARGS__)]], [[error("moo");]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_ISO_VARARGS"], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for GNU-style variadic macros]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include #define error(x...) fprintf (stderr, x)]], [[error("moo");]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_GNUC_VARARGS"], [AC_MSG_RESULT([no])]) # stack memory api header AC_MSG_CHECKING([for alloca.h]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[void* ptr = alloca (1);]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_ALLOCA_H"], [AC_MSG_RESULT([no])]) # eventfd API AC_MSG_CHECKING([for eventfd]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[eventfd (0, 0);]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_EVENTFD"], [AC_MSG_RESULT([no])]) # useful /proc system AC_CHECK_FILE([/proc/cpuinfo], CFLAGS="$CFLAGS -DCONFIG_HAVE_PROC",) # example: crash handling AC_CHECK_FUNC([backtrace], CFLAGS="$CFLAGS -DCONFIG_HAVE_BACKTRACE",) # timing AC_CHECK_FUNC([pselect], CFLAGS="$CFLAGS -DCONFIG_HAVE_PSELECT",) AC_CHECK_FILE([/dev/rtc], CFLAGS="$CFLAGS -DCONFIG_HAVE_RTC",) AC_MSG_CHECKING([for RDTSC instruction]) case "$host_os" in darwin*) AC_MSG_RESULT([no]) ;; *) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM(,[[unsigned long lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_TSC"], [AC_MSG_RESULT([no])]) ;; esac AC_CHECK_FILE([/dev/hpet], CFLAGS="$CFLAGS -DCONFIG_HAVE_HPET",) # event handling AC_CHECK_FUNC([poll], CFLAGS="$CFLAGS -DCONFIG_HAVE_POLL",) AC_CHECK_FUNC([epoll_ctl], CFLAGS="$CFLAGS -DCONFIG_HAVE_EPOLL",) # interface enumeration AC_CHECK_FUNC([getifaddrs], CFLAGS="$CFLAGS -DCONFIG_HAVE_GETIFADDRS",) AC_MSG_CHECKING([for struct ifreq.ifr_netmask]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include #include ]], [[struct ifaddrs ifa; ifa.ifa_netmask = (struct sockaddr*)0;]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_IFR_NETMASK"], [AC_MSG_RESULT([no])]) # win32 cmsg AC_CHECK_MEMBER([struct _WSAMSG.name], CFLAGS="$CFLAGS -DCONFIG_HAVE_WSACMSGHDR",) # multicast AC_MSG_CHECKING([for struct group_req.gr_interface]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[struct group_req gr; gr.gr_interface = 0;]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_MCAST_JOIN"], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for struct ip_mreqn.imr_ifindex]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[struct ip_mreqn mreqn; mreqn.imr_ifindex = 0;]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_IP_MREQN"], [AC_MSG_RESULT([no])]) # sprintf, caveat http://savannah.gnu.org/patch/?6848 (ax_c_printf_thsep) AC_MSG_CHECKING([for printf thousands' grouping]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM(,[[printf ("%'d", 1000000);]])], [AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HAVE_SPRINTF_GROUPING"], [AC_MSG_RESULT([no])]) AC_CHECK_FUNC([vasprintf], CFLAGS="$CFLAGS -DCONFIG_HAVE_VASPRINTF",) # symbol linking scope # nb: sun x86 ld doesn't support DSO visibility but the compiler raises # warnings and these are easier to detect in autoconf. save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" AC_MSG_CHECKING([for hidden visibility attribute]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#ifdef __SUNPRO_C __hidden #else __attribute__((visibility("hidden"))) #endif void moo (void) {};]], [[moo();]])], [AC_MSG_RESULT([yes]) CFLAGS="$save_CFLAGS -DCONFIG_HAVE_DSO_VISIBILITY"], [AC_MSG_RESULT([no]) CFLAGS="$save_CFLAGS"]) # socket binding CFLAGS="$CFLAGS -DCONFIG_BIND_INADDR_ANY" # IP header order as per IP(4) on FreeBSD AC_MSG_CHECKING([for raw IP sockets ip_{len,off} host byte ordering]) case "$host_os" in *openbsd*) AC_MSG_RESULT([no]) ;; *bsd*|*darwin*|*osf*|*unixware*) AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DCONFIG_HOST_ORDER_IP_LEN -DCONFIG_HOST_ORDER_IP_OFF" ;; *) AC_MSG_RESULT([no]) ;; esac # extended assembler on SPARC case "$host" in sparc-sun-solaris*) AC_MSG_CHECKING([for SPARC extended assembler]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include uint32_t add32_with_carry (uint32_t a, uint32_t b) { __asm__ ( "addcc %2, %0, %0\n\taddx %0, %%g0, %0" : "=r" (a) : "0" (a), "r" (b) : "cc"); return a; }]], [[uint32_t c = add32_with_carry (1, 2);]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([optimization required]) CFLAGS="$CFLAGS -xO1"]) ;; *) ;; esac # ticket spinlock friendly: unaligned pointers & atomic ops (excl. Sun Pro) AC_MSG_CHECKING([for unaligned pointers]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[char* nezumi = "mouse";]], [[short x = *(short*)(nezumi + 2)]])], [AC_MSG_RESULT([yes]) pgm_unaligned_pointers=yes], [AC_MSG_RESULT([no]) pgm_unaligned_pointers=no]) AC_MSG_CHECKING([for intrinsic atomic ops]) # AC_PREPROC_IFELSE not always portable AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[#if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) /* GCC assembler */ #elif defined( __sun ) /* Solaris intrinsic */ #elif defined( __APPLE__ ) /* Darwin intrinsic */ #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* GCC 4.0.1 intrinsic */ #elif defined( _WIN32 ) /* Windows intrinsic */ #else # error "Unsupported atomic ops." #endif]])], [AC_MSG_RESULT([yes]) if test "$pgm_unaligned_pointers" = yes; then CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK -DCONFIG_DUMB_RWSPINLOCK" else CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK" fi], [AC_MSG_RESULT([no])]) AC_CONFIG_FILES([Makefile openpgm-${RELEASE_INFO}.pc openpgm.spec]) AC_OUTPUT libpgm-5.1.118-1~dfsg/openpgm/pgm/slist.c0000644000175000017500000000542011640407354017046 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable singly-linked list. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include //#define SLIST_DEBUG PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_append ( pgm_slist_t* restrict list, void* restrict data ) { pgm_slist_t* new_list; pgm_slist_t* last; new_list = pgm_new (pgm_slist_t, 1); new_list->data = data; new_list->next = NULL; if (list) { last = pgm_slist_last (list); last->next = new_list; return list; } else return new_list; } PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_prepend ( pgm_slist_t* restrict list, void* restrict data ) { pgm_slist_t *new_list; new_list = pgm_new (pgm_slist_t, 1); new_list->data = data; new_list->next = list; return new_list; } PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_prepend_link ( pgm_slist_t* restrict list, pgm_slist_t* restrict link_ ) { pgm_slist_t *new_list; new_list = link_; new_list->next = list; return new_list; } PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_remove ( pgm_slist_t* restrict list, const void* restrict data ) { pgm_slist_t *tmp = list, *prev = NULL; while (tmp) { if (tmp->data == data) { if (prev) prev->next = tmp->next; else list = tmp->next; pgm_free (tmp); break; } prev = tmp; tmp = prev->next; } return list; } PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_remove_first ( pgm_slist_t* list ) { pgm_slist_t *tmp; if (PGM_LIKELY (NULL != list)) { tmp = list->next; list->data = NULL; list->next = NULL; return tmp; } else return NULL; } PGM_GNUC_INTERNAL void pgm_slist_free ( pgm_slist_t* list ) { while (list) { pgm_slist_t* current = list; list = list->next; pgm_free (current); } } PGM_GNUC_INTERNAL pgm_slist_t* pgm_slist_last ( pgm_slist_t* list ) { if (PGM_LIKELY (NULL != list)) { while (list->next) list = list->next; } return list; } PGM_GNUC_INTERNAL unsigned pgm_slist_length ( pgm_slist_t* list ) { unsigned length = 0; while (list) { length++; list = list->next; } return length; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.0970000644000175000017500000002431311640407354020116 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 0, 97 ) SConsignFile('scons.signatures'+ '-' + platform.system() + '-' + platform.machine()); opt = Options(None, ARGUMENTS) opt.AddOptions ( (EnumOption ('BUILD', 'build environment', 'debug', ('release', 'debug', 'profile'))), (EnumOption ('BRANCH', 'branch prediction', 'none', ('none', 'profile', 'seed'))), (EnumOption ('WITH_GETTEXT', 'l10n support via libintl', 'false', ('true', 'false'))), (EnumOption ('WITH_GLIB', 'Build GLib dependent modules', 'false', ('true', 'false'))), (EnumOption ('COVERAGE', 'test coverage', 'none', ('none', 'full'))), (EnumOption ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', ('true', 'false'))), (EnumOption ('WITH_HTTP', 'HTTP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_SNMP', 'SNMP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_CHECK', 'Check test system', 'false', ('true', 'false'))), (EnumOption ('WITH_TEST', 'Network test system', 'false', ('true', 'false'))), (EnumOption ('WITH_CC', 'C++ Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_EXAMPLES', 'Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_NCURSES', 'NCURSES examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', ('true', 'false'))), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment(ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_XOPEN_SOURCE=600', '-D_BSD_SOURCE', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system '-DCONFIG_HAVE_PROC', # example: crash handling '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # event handling '-DCONFIG_HAVE_POLL', '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT', # temporary for pgmping # '-DCONFIG_WITH_HEATMAP', # '-DCONFIG_WITH_BUSYWAIT', # '-DCONFIG_HAVE_SCHEDPARAM' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt' ], PROTOBUF_CCFLAGS = '-I/miru/projects/protobuf/protobuf-2.3.0/gcc64/include', PROTOBUF_LIBS = '/miru/projects/protobuf/protobuf-2.3.0/gcc64/lib/libprotobuf.a', PROTOBUF_PROTOC = '/miru/projects/protobuf/protobuf-2.3.0/gcc64/bin/protoc' ) opt.Update (env) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O0','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --cflags --agent-libs'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/getprotobyname_unittest.c0000644000175000017500000000557611640407354022722 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for portable function to enumerate protocol names. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _WIN32 # include # include #else # include #endif #include #include /* mock state */ #define GETPROTOBYNAME_DEBUG #include "getprotobyname.c" static void mock_setup (void) { } static void mock_teardown (void) { } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * struct protoent* * pgm_getprotobyname ( * const char* name * ) */ START_TEST (test_getprotobyname_pass_001) { const char ipv6[] = "ipv6"; fail_if (NULL == pgm_getprotobyname (ipv6), "getprotobyname failed"); } END_TEST START_TEST (test_getprotobyname_fail_001) { fail_unless (NULL == pgm_getprotobyname (NULL), "getprotobyname failed"); } END_TEST START_TEST (test_getprotobyname_fail_002) { const char unknown[] = "qwertyuiop"; fail_unless (NULL == pgm_getprotobyname (unknown), "getprotobyname failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_getprotobyname = tcase_create ("getprotobyname"); suite_add_tcase (s, tc_getprotobyname); tcase_add_checked_fixture (tc_getprotobyname, mock_setup, mock_teardown); tcase_add_test (tc_getprotobyname, test_getprotobyname_pass_001); tcase_add_test (tc_getprotobyname, test_getprotobyname_fail_001); tcase_add_test (tc_getprotobyname, test_getprotobyname_fail_002); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/getnetbyname.c0000644000175000017500000001471311640407354020377 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable implementation of getnetbyname * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include //#define GETNETBYNAME_DEBUG /* locals */ #define MAXALIASES 35 #ifndef _WIN32 # define PATH_NETWORKS "/etc/networks" #else /* NB: 32-bit applications may read %systemroot%\SysWOW64\drivers\etc */ # define PATH_NETWORKS "%systemroot%\\system32\\drivers\\etc\\networks" #endif static FILE* netfh = NULL; static char line[BUFSIZ+1]; static char *net_aliases[MAXALIASES]; static struct pgm_netent_t net; static void _pgm_compat_setnetent (void); static struct pgm_netent_t *_pgm_compat_getnetent (void); static void _pgm_compat_endnetent (void); static struct pgm_netent_t* _pgm_compat_getnetbyname (const char*); static void _pgm_compat_setnetent (void) { if (NULL == netfh) { char* netdb; size_t envlen; errno_t err; /* permit path override */ err = pgm_dupenv_s (&netdb, &envlen, "PGM_NETDB"); if (0 != err || 0 == envlen) { netdb = pgm_strdup (PATH_NETWORKS); } #ifdef _WIN32 { char expanded[MAX_PATH]; if (0 == ExpandEnvironmentStrings ((LPCTSTR)netdb, (LPTSTR)expanded, sizeof (expanded))) { const DWORD save_errno = GetLastError(); char winstr[1024]; pgm_warn (_("Cannot expand netdb path \"%s\": %s"), netdb, pgm_win_strerror (winstr, sizeof (winstr), save_errno)); /* fall through on original string */ } else { free (netdb); netdb = pgm_strdup (expanded); } } #endif err = pgm_fopen_s (&netfh, netdb, "r"); if (0 != err) { char errbuf[1024]; pgm_warn (_("Opening netdb file \"%s\" failed: %s"), netdb, pgm_strerror_s (errbuf, sizeof (errbuf), err)); } free (netdb); } else { rewind (netfh); } } static void _pgm_compat_endnetent (void) { if (NULL != netfh) { fclose (netfh); netfh = NULL; } } /* link-local 169.254.0.0 alias1 alias2 * * returns address in host-byte order */ static struct pgm_netent_t* _pgm_compat_getnetent (void) { struct in_addr sin; char *p, *cp, **q; if (NULL == netfh) { _pgm_compat_setnetent(); if (NULL == netfh) return NULL; } again: if (NULL == (p = fgets (line, BUFSIZ, netfh))) return NULL; if ('#' == *p) /* comment */ goto again; cp = strpbrk (p, "#\n"); if (NULL == cp) goto again; *cp = '\0'; net.n_name = p; cp = strpbrk (p, " \t"); if (NULL == cp) goto again; *cp++ = '\0'; while (' ' == *cp || '\t' == *cp) cp++; p = strpbrk (cp, " \t"); if (NULL != p) *p++ = '\0'; /* returns address in network order */ if (0 == pgm_inet_network (cp, &sin)) { struct sockaddr_in sa; memset (&sa, 0, sizeof (sa)); sa.sin_family = AF_INET; sa.sin_addr.s_addr = ntohl (sin.s_addr); memcpy (&net.n_net, &sa, sizeof (sa)); } else if (0 != pgm_sa6_network (cp, (struct sockaddr_in6*)&net.n_net)) { /* cannot resolve address, fail instead of returning junk address */ return NULL; } q = net.n_aliases = net_aliases; if (NULL != p) { /* some versions stick the address as the first alias, some default to NULL */ cp = p; while (cp && *cp) { if (' ' == *cp || '\t' == *cp) { cp++; continue; } if (q < &net_aliases[MAXALIASES - 1]) *q++ = cp; cp = strpbrk (cp, " \t"); if (NULL != cp) *cp++ = '\0'; } } *q = NULL; return &net; } /* Lookup network by name in the /etc/networks database. * * returns 0 on success, returns -1 on invalid address. */ static struct pgm_netent_t* _pgm_compat_getnetbyname ( const char* name ) { struct pgm_netent_t *p; char **cp; if (NULL == name) return NULL; _pgm_compat_setnetent (); while (NULL != (p = _pgm_compat_getnetent())) { if (!strncmp (p->n_name, name, BUFSIZ)) break; for (cp = p->n_aliases; *cp != 0; cp++) if (!strncmp (*cp, name, BUFSIZ)) goto found; } found: _pgm_compat_endnetent(); return p; } #ifdef CONFIG_HAVE_GETNETENT static struct pgm_netent_t* _pgm_native_getnetbyname ( const char* name ) { struct sockaddr_in sa; struct in_addr addr; struct netent *ne; char **cp, **q, **r; size_t len; if (NULL == name) return NULL; setnetent (0); while (NULL != (ne = getnetent())) { if (!strncmp (ne->n_name, name, BUFSIZ)) goto found; for (cp = ne->n_aliases; *cp != 0; cp++) if (!strncmp (*cp, name, BUFSIZ)) goto found; } endnetent(); return NULL; found: /* copy result into own global static buffer */ len = strlen (ne->n_name) + 1; if (len > BUFSIZ) return NULL; net.n_name = memcpy (line, ne->n_name, len); q = net.n_aliases = net_aliases; r = ne->n_aliases; while (*r) { const size_t alias_len = strlen (*r) + 1; if ((len + alias_len) > BUFSIZ) break; *q++ = memcpy (line + len, *r++, alias_len); len += alias_len; } *q = NULL; if (AF_INET != ne->n_addrtype) return NULL; memset (&sa, 0, sizeof (sa)); sa.sin_family = ne->n_addrtype; addr = pgm_inet_makeaddr (ne->n_net, 0); sa.sin_addr.s_addr = ntohl (addr.s_addr); memcpy (&net.n_net, &sa, sizeof (sa)); endnetent(); return &net; } #endif /* returns addresses in CIDR format in host-byte order, native implementations * use pre-CIDR aligned format. * * ::getnetbyname(loopback) = 0.0.0.127 * pgm_getnetbyname(loopback) = 127.0.0.0 * * returns first matching entry, whilst networks file could potentially contain * multiple matching entries the native APIs do not support such functionality. * * cf. networks vs. hosts which getaddrinfo may return a list of results. */ struct pgm_netent_t* pgm_getnetbyname ( const char* name ) { #ifdef CONFIG_HAVE_GETNETENT char* netdb; size_t envlen; errno_t err; err = pgm_dupenv_s (&netdb, &envlen, "PGM_NETDB"); free (netdb); if (0 != err || 0 == envlen) { /* default use native implementation */ return _pgm_native_getnetbyname (name); } #endif return _pgm_compat_getnetbyname (name); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/recv_unittest.c0000644000175000017500000014256711640407354020624 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for transport recv api * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include #include #include #ifndef _WIN32 # include # include # include /* _GNU_SOURCE for in6_pktinfo */ # include #else # include # include #endif #include #include /* mock state */ #define TEST_NETWORK "" #define TEST_DPORT 7500 #define TEST_SPORT 1000 #define TEST_XPORT 1001 #define TEST_SRC_ADDR "127.0.0.1" #define TEST_END_ADDR "127.0.0.2" #define TEST_GROUP_ADDR "239.192.0.1" #define TEST_PEER_ADDR "127.0.0.6" #define TEST_DLR_ADDR "127.0.0.9" #define TEST_MAX_TPDU 1500 #define TEST_TXW_SQNS 32 #define TEST_RXW_SQNS 32 #define TEST_HOPS 16 #define TEST_SPM_AMBIENT ( pgm_secs(30) ) #define TEST_SPM_HEARTBEAT_INIT { pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(100), pgm_msecs(1300), pgm_secs(7), pgm_secs(16), pgm_secs(25), pgm_secs(30) } #define TEST_PEER_EXPIRY ( pgm_secs(300) ) #define TEST_SPMR_EXPIRY ( pgm_msecs(250) ) #define TEST_NAK_BO_IVL ( pgm_msecs(50) ) #define TEST_NAK_RPT_IVL ( pgm_secs(2) ) #define TEST_NAK_RDATA_IVL ( pgm_secs(2) ) #define TEST_NAK_DATA_RETRIES 5 #define TEST_NAK_NCF_RETRIES 2 struct mock_recvmsg_t { #ifndef _WIN32 struct msghdr* mr_msg; #else WSAMSG* mr_msg; #endif ssize_t mr_retval; int mr_errno; }; struct pgm_peer_t; GList* mock_recvmsg_list = NULL; static int mock_pgm_type = -1; static gboolean mock_reset_on_spmr = FALSE; static gboolean mock_data_on_spmr = FALSE; static struct pgm_peer_t* mock_peer = NULL; GList* mock_data_list = NULL; unsigned mock_pgm_loss_rate = 0; #ifndef _WIN32 static ssize_t mock_recvmsg (int, struct msghdr*, int); #else static int mock_recvfrom (SOCKET, char*, int, int, struct sockaddr*, int*); #endif #define pgm_parse_raw mock_pgm_parse_raw #define pgm_parse_udp_encap mock_pgm_parse_udp_encap #define pgm_verify_spm mock_pgm_verify_spm #define pgm_verify_nak mock_pgm_verify_nak #define pgm_verify_ncf mock_pgm_verify_ncf #define pgm_select_info mock_pgm_select_info #define pgm_poll_info mock_pgm_poll_info #define pgm_set_reset_error mock_pgm_set_reset_error #define pgm_flush_peers_pending mock_pgm_flush_peers_pending #define pgm_peer_has_pending mock_pgm_peer_has_pending #define pgm_peer_set_pending mock_pgm_peer_set_pending #define pgm_txw_retransmit_is_empty mock_pgm_txw_retransmit_is_empty #define pgm_rxw_create mock_pgm_rxw_create #define pgm_rxw_readv mock_pgm_rxw_readv #define pgm_new_peer mock_pgm_new_peer #define pgm_on_data mock_pgm_on_data #define pgm_on_spm mock_pgm_on_spm #define pgm_on_ack mock_pgm_on_ack #define pgm_on_nak mock_pgm_on_nak #define pgm_on_deferred_nak mock_pgm_on_deferred_nak #define pgm_on_peer_nak mock_pgm_on_peer_nak #define pgm_on_nnak mock_pgm_on_nnak #define pgm_on_ncf mock_pgm_on_ncf #define pgm_on_spmr mock_pgm_on_spmr #define pgm_sendto mock_pgm_sendto #define pgm_timer_prepare mock_pgm_timer_prepare #define pgm_timer_check mock_pgm_timer_check #define pgm_timer_expiration mock_pgm_timer_expiration #define pgm_timer_dispatch mock_pgm_timer_dispatch #define pgm_time_now mock_pgm_time_now #define pgm_time_update_now mock_pgm_time_update_now #define recvmsg mock_recvmsg #define recvfrom mock_recvfrom #define pgm_WSARecvMsg mock_pgm_WSARecvMsg #define pgm_loss_rate mock_pgm_loss_rate #define RECV_DEBUG #include "recv.c" pgm_rxw_t* mock_pgm_rxw_create (const pgm_tsi_t*, const uint16_t, const unsigned, const unsigned, const ssize_t, const uint32_t); static pgm_time_t _mock_pgm_time_update_now (void); pgm_time_update_func mock_pgm_time_update_now = _mock_pgm_time_update_now; static void mock_setup (void) { if (!g_thread_supported ()) g_thread_init (NULL); } /* cleanup test state */ static void mock_teardown (void) { mock_recvmsg_list = NULL; mock_pgm_type = -1; mock_reset_on_spmr = FALSE; mock_data_on_spmr = FALSE; mock_peer = NULL; mock_data_list = NULL; mock_pgm_loss_rate = 0; } static struct pgm_sock_t* generate_sock (void) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, g_htons((guint16)TEST_SPORT) }; struct pgm_sock_t* sock = g_new0 (struct pgm_sock_t, 1); sock->window = g_new0 (pgm_txw_t, 1); memcpy (&sock->tsi, &tsi, sizeof(pgm_tsi_t)); sock->is_nonblocking = TRUE; sock->is_bound = TRUE; sock->is_destroyed = FALSE; sock->is_reset = FALSE; sock->rx_buffer = pgm_alloc_skb (TEST_MAX_TPDU); sock->max_tpdu = TEST_MAX_TPDU; sock->rxw_sqns = TEST_RXW_SQNS; sock->dport = g_htons((guint16)TEST_DPORT); sock->can_send_data = TRUE; sock->can_send_nak = TRUE; sock->can_recv_data = TRUE; sock->peers_hashtable = pgm_hashtable_new (pgm_tsi_hash, pgm_tsi_equal); pgm_rand_create (&sock->rand_); sock->nak_bo_ivl = 100*1000; pgm_notify_init (&sock->pending_notify); pgm_notify_init (&sock->rdata_notify); pgm_mutex_init (&sock->receiver_mutex); pgm_rwlock_init (&sock->lock); pgm_rwlock_init (&sock->peers_lock); return sock; } static struct pgm_sk_buff_t* generate_packet (void) { struct pgm_sk_buff_t* skb; skb = pgm_alloc_skb (TEST_MAX_TPDU); skb->data = skb->head; skb->len = sizeof(struct pgm_ip) + sizeof(struct pgm_header); skb->tail = (guint8*)skb->data + skb->len; /* add IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_hl = sizeof(struct pgm_ip) / 4; iphdr->ip_v = 4; iphdr->ip_tos = 0; iphdr->ip_id = 0; iphdr->ip_off = 0; iphdr->ip_ttl = 16; iphdr->ip_p = IPPROTO_PGM; iphdr->ip_sum = 0; iphdr->ip_src.s_addr = inet_addr (TEST_SRC_ADDR); iphdr->ip_dst.s_addr = inet_addr (TEST_GROUP_ADDR); /* add PGM header */ struct pgm_header* pgmhdr = (gpointer)(iphdr + 1); pgmhdr->pgm_sport = g_htons ((guint16)TEST_XPORT); pgmhdr->pgm_dport = g_htons ((guint16)TEST_DPORT); pgmhdr->pgm_options = 0; pgmhdr->pgm_gsi[0] = 1; pgmhdr->pgm_gsi[1] = 2; pgmhdr->pgm_gsi[2] = 3; pgmhdr->pgm_gsi[3] = 4; pgmhdr->pgm_gsi[4] = 5; pgmhdr->pgm_gsi[5] = 6; pgmhdr->pgm_tsdu_length = 0; pgmhdr->pgm_checksum = 0; skb->pgm_header = pgmhdr; return skb; } static void generate_odata ( const char* source, const guint source_len, const guint32 data_sqn, const guint32 data_trail, gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); pgm_skb_put (skb, sizeof(struct pgm_data) + source_len); /* add ODATA header */ struct pgm_data* datahdr = (gpointer)(skb->pgm_header + 1); datahdr->data_sqn = g_htonl (data_sqn); datahdr->data_trail = g_htonl (data_trail); /* add payload */ gpointer data = (gpointer)(datahdr + 1); memcpy (data, source, source_len); /* finalize PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_type = PGM_ODATA; pgmhdr->pgm_tsdu_length = g_htons (source_len); /* finalize IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_spm ( const guint32 spm_sqn, const guint32 spm_trail, const guint32 spm_lead, gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); pgm_skb_put (skb, sizeof(struct pgm_spm)); /* add SPM header */ struct pgm_spm* spm = (gpointer)(skb->pgm_header + 1); spm->spm_sqn = g_htonl (spm_sqn); spm->spm_trail = g_htonl (spm_trail); spm->spm_lead = g_htonl (spm_lead); /* finalize PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_type = PGM_SPM; /* finalize IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_nak ( const guint32 nak_sqn, gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); pgm_skb_put (skb, sizeof(struct pgm_spm)); /* update IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_src.s_addr = inet_addr (TEST_END_ADDR); iphdr->ip_dst.s_addr = inet_addr (TEST_SRC_ADDR); /* update PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_sport = g_htons ((guint16)TEST_DPORT); pgmhdr->pgm_dport = g_htons ((guint16)TEST_SPORT); /* add NAK header */ struct pgm_nak* nak = (gpointer)(skb->pgm_header + 1); nak->nak_sqn = g_htonl (nak_sqn); /* finalize PGM header */ pgmhdr->pgm_type = PGM_NAK; /* finalize IP header */ iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_peer_nak ( const guint32 nak_sqn, gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); pgm_skb_put (skb, sizeof(struct pgm_spm)); /* update IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_src.s_addr = inet_addr (TEST_PEER_ADDR); iphdr->ip_dst.s_addr = inet_addr (TEST_GROUP_ADDR); /* update PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_sport = g_htons ((guint16)TEST_DPORT); pgmhdr->pgm_dport = g_htons ((guint16)TEST_SPORT); /* add NAK header */ struct pgm_nak* nak = (gpointer)(skb->pgm_header + 1); nak->nak_sqn = g_htonl (nak_sqn); /* finalize PGM header */ pgmhdr->pgm_type = PGM_NAK; /* finalize IP header */ iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_nnak ( const guint32 nak_sqn, gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); pgm_skb_put (skb, sizeof(struct pgm_nak)); /* update IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_src.s_addr = inet_addr (TEST_DLR_ADDR); iphdr->ip_dst.s_addr = inet_addr (TEST_SRC_ADDR); /* update PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_sport = g_htons ((guint16)TEST_DPORT); pgmhdr->pgm_dport = g_htons ((guint16)TEST_SPORT); /* add NNAK header */ struct pgm_nak* nak = (gpointer)(skb->pgm_header + 1); nak->nak_sqn = g_htonl (nak_sqn); /* finalize PGM header */ pgmhdr->pgm_type = PGM_NNAK; /* finalize IP header */ iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_ncf ( const guint32 nak_sqn, gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); pgm_skb_put (skb, sizeof(struct pgm_nak)); /* add NAK header */ struct pgm_nak* nak = (gpointer)(skb->pgm_header + 1); nak->nak_sqn = g_htonl (nak_sqn); /* finalize PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_type = PGM_NCF; /* finalize IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_spmr ( gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); /* update IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_src.s_addr = inet_addr (TEST_END_ADDR); iphdr->ip_dst.s_addr = inet_addr (TEST_SRC_ADDR); /* update PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_sport = g_htons ((guint16)TEST_DPORT); pgmhdr->pgm_dport = g_htons ((guint16)TEST_SPORT); /* finalize PGM header */ pgmhdr->pgm_type = PGM_SPMR; /* finalize IP header */ iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_peer_spmr ( gpointer* packet, gsize* len ) { struct pgm_sk_buff_t* skb = generate_packet (); /* update IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_src.s_addr = inet_addr (TEST_PEER_ADDR); iphdr->ip_dst.s_addr = inet_addr (TEST_GROUP_ADDR); /* update PGM header */ struct pgm_header* pgmhdr = skb->pgm_header; pgmhdr->pgm_sport = g_htons ((guint16)TEST_DPORT); pgmhdr->pgm_dport = g_htons ((guint16)TEST_SPORT); /* finalize PGM header */ pgmhdr->pgm_type = PGM_SPMR; /* finalize IP header */ iphdr->ip_len = g_htons (skb->len); *packet = skb->head; *len = skb->len; } static void generate_msghdr ( const gpointer packet, const gsize packet_len ) { struct pgm_ip* iphdr = packet; struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr.s_addr = iphdr->ip_src.s_addr }; struct pgm_iovec iov = { .iov_base = packet, .iov_len = packet_len }; struct pgm_cmsghdr* packet_cmsg = g_malloc0 (sizeof(struct pgm_cmsghdr) + sizeof(struct in_pktinfo)); packet_cmsg->cmsg_len = sizeof(*packet_cmsg) + sizeof(struct in_pktinfo); packet_cmsg->cmsg_level = IPPROTO_IP; packet_cmsg->cmsg_type = IP_PKTINFO; struct in_pktinfo packet_info = { .ipi_ifindex = 2, #if !defined(_WIN32) && !defined(__CYGWIN__) .ipi_spec_dst = iphdr->ip_src.s_addr, /* local address */ #endif .ipi_addr = iphdr->ip_dst.s_addr /* destination address */ }; memcpy ((char*)(packet_cmsg + 1), &packet_info, sizeof(struct in_pktinfo)); #ifndef _WIN32 struct msghdr packet_msg = { .msg_name = g_memdup (&addr, sizeof(addr)), /* source address */ .msg_namelen = sizeof(addr), .msg_iov = g_memdup (&iov, sizeof(iov)), .msg_iovlen = 1, .msg_control = &packet_cmsg, .msg_controllen = sizeof(struct cmsghdr) + sizeof(struct in_pktinfo), .msg_flags = 0 }; #else WSAMSG packet_msg = { .name = (LPSOCKADDR)g_memdup (&addr, sizeof(addr)), .namelen = sizeof(addr), .lpBuffers = (LPWSABUF)g_memdup (&iov, sizeof(iov)), .dwBufferCount = 1, .dwFlags = 0 }; packet_msg.Control.buf = (char*)&packet_cmsg; packet_msg.Control.len = sizeof(struct pgm_cmsghdr) + sizeof(struct in_pktinfo); #endif struct mock_recvmsg_t* mr = g_malloc (sizeof(struct mock_recvmsg_t)); mr->mr_msg = g_memdup (&packet_msg, sizeof(packet_msg)); mr->mr_errno = 0; mr->mr_retval = packet_len; mock_recvmsg_list = g_list_append (mock_recvmsg_list, mr); } static void push_block_event (void) { /* block */ struct mock_recvmsg_t* mr = g_malloc (sizeof(struct mock_recvmsg_t)); mr->mr_msg = NULL; mr->mr_errno = PGM_SOCK_EAGAIN; mr->mr_retval = SOCKET_ERROR; mock_recvmsg_list = g_list_append (mock_recvmsg_list, mr); } /** packet module */ bool mock_pgm_parse_raw ( struct pgm_sk_buff_t* const skb, struct sockaddr* const dst, pgm_error_t** error ) { const struct pgm_ip* ip = (struct pgm_ip*)skb->data; struct sockaddr_in* sin = (struct sockaddr_in*)dst; sin->sin_family = AF_INET; sin->sin_addr.s_addr = ip->ip_dst.s_addr; const gsize ip_header_length = ip->ip_hl * 4; skb->pgm_header = (gpointer)( (guint8*)skb->data + ip_header_length ); skb->data = skb->pgm_header; skb->len -= ip_header_length; memcpy (&skb->tsi.gsi, skb->pgm_header->pgm_gsi, sizeof(pgm_gsi_t)); skb->tsi.sport = skb->pgm_header->pgm_sport; return TRUE; } bool mock_pgm_parse_udp_encap ( struct pgm_sk_buff_t* const skb, pgm_error_t** error ) { skb->pgm_header = skb->data; memcpy (&skb->tsi.gsi, skb->pgm_header->pgm_gsi, sizeof(pgm_gsi_t)); skb->tsi.sport = skb->pgm_header->pgm_sport; return TRUE; } bool mock_pgm_verify_spm ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } bool mock_pgm_verify_nak ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } bool mock_pgm_verify_ncf ( const struct pgm_sk_buff_t* const skb ) { return TRUE; } /** socket module */ #ifdef CONFIG_HAVE_POLL int mock_pgm_poll_info ( pgm_sock_t* const sock, struct pollfd* fds, int* n_fds, short events ) { } #else int mock_pgm_select_info ( pgm_sock_t* const sock, fd_set*const readfds, fd_set*const writefds, int*const n_fds ) { } #endif pgm_peer_t* mock__pgm_peer_ref ( pgm_peer_t* peer ) { pgm_atomic_inc32 (&peer->ref_count); return peer; } PGM_GNUC_INTERNAL pgm_peer_t* mock_pgm_new_peer ( pgm_sock_t* const sock, const pgm_tsi_t* const tsi, const struct sockaddr* const src_addr, const socklen_t src_addr_len, const struct sockaddr* const dst_addr, const socklen_t dst_addr_len, const pgm_time_t now ) { pgm_peer_t* peer = g_malloc0 (sizeof(pgm_peer_t)); peer->expiry = now + sock->peer_expiry; memcpy (&peer->tsi, tsi, sizeof(pgm_tsi_t)); memcpy (&peer->group_nla, dst_addr, dst_addr_len); memcpy (&peer->local_nla, src_addr, src_addr_len); ((struct sockaddr_in*)&peer->local_nla)->sin_port = g_htons (sock->udp_encap_ucast_port); ((struct sockaddr_in*)&peer->nla)->sin_port = g_htons (sock->udp_encap_ucast_port); peer->window = mock_pgm_rxw_create (&peer->tsi, sock->max_tpdu, sock->rxw_sqns, sock->rxw_secs, sock->rxw_max_rte, sock->ack_c_p); peer->spmr_expiry = now + sock->spmr_expiry; gpointer entry = mock__pgm_peer_ref(peer); pgm_hashtable_insert (sock->peers_hashtable, &peer->tsi, entry); peer->peers_link.next = sock->peers_list; peer->peers_link.data = peer; if (sock->peers_list) sock->peers_list->prev = &peer->peers_link; sock->peers_list = &peer->peers_link; return peer; } PGM_GNUC_INTERNAL void mock_pgm_set_reset_error ( pgm_sock_t* const sock, pgm_peer_t* const source, struct pgm_msgv_t* const msgv ) { } PGM_GNUC_INTERNAL int mock_pgm_flush_peers_pending ( pgm_sock_t* const sock, struct pgm_msgv_t** pmsg, const struct pgm_msgv_t* const msg_end, size_t* const bytes_read, unsigned* const data_read ) { if (mock_data_list) { size_t len = 0; unsigned count = 0; while (mock_data_list && *pmsg <= msg_end) { struct pgm_msgv_t* mock_msgv = mock_data_list->data; (*pmsg)->msgv_len = mock_msgv->msgv_len; for (unsigned i = 0; i < mock_msgv->msgv_len; i++) { (*pmsg)->msgv_skb[i] = mock_msgv->msgv_skb[i]; len += mock_msgv->msgv_skb[i]->len; } count++; (*pmsg)++; mock_data_list = g_list_delete_link (mock_data_list, mock_data_list); } *bytes_read = len; *data_read = count; if (*pmsg > msg_end) return -PGM_SOCK_ENOBUFS; } return 0; } PGM_GNUC_INTERNAL bool mock_pgm_peer_has_pending ( pgm_peer_t* const peer ) { return FALSE; } PGM_GNUC_INTERNAL void mock_pgm_peer_set_pending ( pgm_sock_t* const sock, pgm_peer_t* const peer ) { g_assert (NULL != sock); g_assert (NULL != peer); if (peer->pending_link.data) return; peer->pending_link.data = peer; peer->pending_link.next = sock->peers_pending; sock->peers_pending = &peer->pending_link; } PGM_GNUC_INTERNAL bool mock_pgm_on_data ( pgm_sock_t* const sock, pgm_peer_t* const sender, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_data (sock:%p sender:%p skb:%p)", (gpointer)sock, (gpointer)sender, (gpointer)skb); mock_pgm_type = PGM_ODATA; ((pgm_rxw_t*)sender->window)->has_event = 1; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_ack ( pgm_sock_t* const sock, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_ack (sock:%p skb:%p)", (gpointer)sock, (gpointer)skb); mock_pgm_type = PGM_ACK; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_deferred_nak ( pgm_sock_t* const sock ) { return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_nak ( pgm_sock_t* const sock, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_nak (sock:%p skb:%p)", (gpointer)sock, (gpointer)skb); mock_pgm_type = PGM_NAK; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_peer_nak ( pgm_sock_t* const sock, pgm_peer_t* const sender, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_peer_nak (sock:%p sender:%p skb:%p)", (gpointer)sock, (gpointer)sender, (gpointer)skb); mock_pgm_type = PGM_NAK; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_ncf ( pgm_sock_t* const sock, pgm_peer_t* const sender, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_ncf (sock:%p sender:%p skb:%p)", (gpointer)sock, (gpointer)sender, (gpointer)skb); mock_pgm_type = PGM_NCF; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_nnak ( pgm_sock_t* const sock, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_nnak (sock:%p skb:%p)", (gpointer)sock, (gpointer)skb); mock_pgm_type = PGM_NNAK; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_spm ( pgm_sock_t* const sock, pgm_peer_t* const sender, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_spm (sock:%p sender:%p skb:%p)", (gpointer)sock, (gpointer)sender, (gpointer)skb); mock_pgm_type = PGM_SPM; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_on_spmr ( pgm_sock_t* const sock, pgm_peer_t* const peer, struct pgm_sk_buff_t* const skb ) { g_debug ("mock_pgm_on_spmr (sock:%p peer:%p skb:%p)", (gpointer)sock, (gpointer)peer, (gpointer)skb); mock_pgm_type = PGM_SPMR; if (mock_reset_on_spmr) { sock->is_reset = TRUE; mock_pgm_peer_set_pending (sock, mock_peer); } if (mock_data_on_spmr) { mock_pgm_peer_set_pending (sock, mock_peer); } return TRUE; } /** transmit window */ PGM_GNUC_INTERNAL bool mock_pgm_txw_retransmit_is_empty ( const pgm_txw_t*const window ) { return TRUE; } /** receive window */ pgm_rxw_t* mock_pgm_rxw_create ( const pgm_tsi_t* tsi, const uint16_t tpdu_size, const unsigned sqns, const unsigned secs, const ssize_t max_rte, const uint32_t ack_c_p ) { return g_new0 (pgm_rxw_t, 1); } ssize_t mock_pgm_rxw_readv ( pgm_rxw_t* const window, struct pgm_msgv_t** pmsg, const unsigned pmsglen ) { return -1; } /** net module */ PGM_GNUC_INTERNAL ssize_t mock_pgm_sendto ( pgm_sock_t* sock, bool use_rate_limit, bool use_router_alert, const void* buf, size_t len, const struct sockaddr* to, socklen_t tolen ) { return len; } /** timer module */ PGM_GNUC_INTERNAL bool mock_pgm_timer_prepare ( pgm_sock_t* const sock ) { return FALSE; } PGM_GNUC_INTERNAL bool mock_pgm_timer_check ( pgm_sock_t* const sock ) { return FALSE; } PGM_GNUC_INTERNAL pgm_time_t mock_pgm_timer_expiration ( pgm_sock_t* const sock ) { return 100L; } PGM_GNUC_INTERNAL bool mock_pgm_timer_dispatch ( pgm_sock_t* const sock ) { return TRUE; } /** time module */ static pgm_time_t mock_pgm_time_now = 0x1; static pgm_time_t _mock_pgm_time_update_now (void) { return mock_pgm_time_now; } /** libc */ #ifndef _WIN32 static ssize_t mock_recvmsg ( int s, struct msghdr* msg, int flags ) { g_assert (NULL != msg); g_assert (NULL != mock_recvmsg_list); g_debug ("mock_recvmsg (s:%d msg:%p flags:%d)", s, (gpointer)msg, flags); struct mock_recvmsg_t* mr = mock_recvmsg_list->data; struct msghdr* mock_msg = mr->mr_msg; ssize_t mock_retval = mr->mr_retval; int mock_errno = mr->mr_errno; mock_recvmsg_list = g_list_delete_link (mock_recvmsg_list, mock_recvmsg_list); if (mock_msg) { g_assert_cmpuint (mock_msg->msg_namelen, <=, msg->msg_namelen); g_assert_cmpuint (mock_msg->msg_iovlen, <=, msg->msg_iovlen); g_assert_cmpuint (mock_msg->msg_controllen, <=, msg->msg_controllen); if (mock_msg->msg_namelen) memcpy (msg->msg_name, mock_msg->msg_name, mock_msg->msg_namelen); if (mock_msg->msg_iovlen) { for (unsigned i = 0; i < mock_msg->msg_iovlen; i++) { g_assert (mock_msg->msg_iov[i].iov_len <= msg->msg_iov[i].iov_len); memcpy (msg->msg_iov[i].iov_base, mock_msg->msg_iov[i].iov_base, mock_msg->msg_iov[i].iov_len); } } if (mock_msg->msg_controllen) memcpy (msg->msg_control, mock_msg->msg_control, mock_msg->msg_controllen); msg->msg_controllen = mock_msg->msg_controllen; msg->msg_flags = mock_msg->msg_flags; } errno = mock_errno; return mock_retval; } #else static int mock_WSARecvMsg ( SOCKET s, LPWSAMSG lpMsg, LPDWORD lpdwNumberOfBytesRecvd, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) { g_assert (NULL != lpMsg); g_assert (NULL != mock_recvmsg_list); g_debug ("mock_WSARecvMsg (s:%d msg:%p recvd:%d ol:%p cr:%p)", s, (gpointer)lpMsg, lpdwNumberOfBytesRecvd, (gpointer)lpOverlapped, (gpointer)lpCompletionRoutine); struct mock_recvmsg_t* mr = mock_recvmsg_list->data; WSAMSG* mock_msg = mr->mr_msg; /* only return 0 on success, not bytes received */ ssize_t mock_retval = mr->mr_retval < 0 ? mr->mr_retval : 0; int mock_errno = mr->mr_errno; mock_recvmsg_list = g_list_delete_link (mock_recvmsg_list, mock_recvmsg_list); if (mock_msg) { g_assert_cmpuint (mock_msg->namelen, <=, lpMsg->namelen); g_assert_cmpuint (mock_msg->dwBufferCount, <=, lpMsg->dwBufferCount); if (mock_msg->namelen) memcpy (lpMsg->name, mock_msg->name, mock_msg->namelen); if (mock_msg->dwBufferCount) { for (unsigned i = 0; i < mock_msg->dwBufferCount; i++) { g_assert (mock_msg->lpBuffers[i].len <= lpMsg->lpBuffers[i].len); memcpy (lpMsg->lpBuffers[i].buf, mock_msg->lpBuffers[i].buf, mock_msg->lpBuffers[i].len); } } if (mr->mr_retval >= 0) *lpdwNumberOfBytesRecvd = mr->mr_retval; if (mock_msg->Control.len) memcpy (lpMsg->Control.buf, mock_msg->Control.buf, mock_msg->Control.len); lpMsg->Control.len = mock_msg->Control.len; lpMsg->dwFlags = mock_msg->dwFlags; g_debug ("namelen %d buffers %d", mock_msg->namelen, mock_msg->dwBufferCount); } g_debug ("returning %d (errno:%d)", mock_retval, mock_errno); WSASetLastError (mock_errno); return mock_retval; } LPFN_WSARECVMSG mock_pgm_WSARecvMsg = mock_WSARecvMsg; static int mock_recvfrom ( SOCKET s, char* buf, int len, int flags, struct sockaddr* from, int* fromlen ) { g_assert (NULL != buf); g_assert (NULL != mock_recvmsg_list); g_debug ("mock_recvfrom (s:%d buf:%p len:%d flags:%d from:%p fromlen:%p)", s, (gpointer)buf, len, flags, (gpointer)from, (gpointer)fromlen); struct mock_recvmsg_t* mr = mock_recvmsg_list->data; WSAMSG* mock_msg = mr->mr_msg; /* only return 0 on success, not bytes received */ int mock_retval = mr->mr_retval < 0 ? mr->mr_retval : 0; int mock_errno = mr->mr_errno; mock_recvmsg_list = g_list_delete_link (mock_recvmsg_list, mock_recvmsg_list); if (mock_msg) { if (NULL != fromlen) { g_assert_cmpuint (mock_msg->namelen, <=, *fromlen); *fromlen = mock_msg->namelen; } if (NULL != from && mock_msg->namelen) { memcpy (from, mock_msg->name, mock_msg->namelen); } if (mock_msg->dwBufferCount) { for (unsigned i = 0; i < mock_msg->dwBufferCount; i++) { const size_t count = MIN(len, mock_msg->lpBuffers[i].len); memcpy (buf, mock_msg->lpBuffers[i].buf, count); buf += count; len -= count; mock_retval += count; } } } g_debug ("returning %d (errno:%d)", mock_retval, mock_errno); WSASetLastError (mock_errno); return mock_retval; } #endif /* _WIN32 */ /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * int * pgm_recv ( * pgm_sock_t* sock, * void* data, * size_t len, * int flags, * size_t* bytes_read, * pgm_error_t** error * ) * * Most tests default to PGM_IO_STATUS_TIMER_PENDING, PGM_IO_STATUS_WOULD_BLOCK is not expected due * to peer state engine and SPM broadcasts. */ START_TEST (test_block_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* recv -> on_data */ START_TEST (test_data_pass_001) { const char source[] = "i am not a string"; pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_odata (source, sizeof(source), 0 /* sqn */, -1 /* trail */, &packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_ODATA == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on_spm */ START_TEST (test_spm_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_spm (200 /* spm-sqn */, -1 /* trail */, 0 /* lead */, &packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_SPM == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on_nak */ START_TEST (test_nak_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_nak (0 /* sqn */, &packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_NAK == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on_peer_nak */ START_TEST (test_peer_nak_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_peer_nak (0 /* sqn */, &packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_NAK == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on_nnak */ START_TEST (test_nnak_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_nnak (0 /* sqn */, &packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_NNAK == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on_ncf */ START_TEST (test_ncf_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_ncf (0 /* sqn */, &packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_NCF == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on_spmr */ START_TEST (test_spmr_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_SPMR == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> on (peer) spmr */ START_TEST (test_peer_spmr_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gpointer packet; gsize packet_len; generate_peer_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); push_block_event (); gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (PGM_SPMR == mock_pgm_type, "unexpected PGM packet"); } END_TEST /* recv -> lost data */ START_TEST (test_lost_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); sock->is_reset = TRUE; const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; pgm_peer_t* peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == peer, "new_peer failed"); mock_pgm_peer_set_pending (sock, peer); push_block_event (); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_RESET == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); if (err) { g_message ("%s", err->message); pgm_error_free (err); err = NULL; } push_block_event (); fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* recv -> lost data and abort transport */ START_TEST (test_abort_on_lost_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); sock->is_reset = TRUE; sock->is_abort_on_reset = TRUE; const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; pgm_peer_t* peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == peer, "new_peer failed"); mock_pgm_peer_set_pending (sock, peer); push_block_event (); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_RESET == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); if (err) { g_message ("%s", err->message); pgm_error_free (err); err = NULL; } push_block_event (); fail_unless (PGM_IO_STATUS_RESET == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* recv -> (spmr) & loss */ START_TEST (test_then_lost_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); mock_reset_on_spmr = TRUE; gpointer packet; gsize packet_len; generate_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; mock_peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == mock_peer, "new_peer failed"); push_block_event (); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_RESET == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); if (err) { g_message ("%s", err->message); pgm_error_free (err); err = NULL; } push_block_event (); fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* recv -> data & loss & abort transport */ START_TEST (test_then_abort_on_lost_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); mock_reset_on_spmr = TRUE; sock->is_abort_on_reset = TRUE; gpointer packet; gsize packet_len; generate_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; mock_peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == mock_peer, "new_peer failed"); push_block_event (); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_RESET == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); if (err) { g_message ("%s", err->message); pgm_error_free (err); err = NULL; } push_block_event (); fail_unless (PGM_IO_STATUS_RESET == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* new waiting peer -> return data */ START_TEST (test_on_data_pass_001) { const char source[] = "i am not a string"; pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); mock_data_on_spmr = TRUE; gpointer packet; gsize packet_len; generate_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; mock_peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == mock_peer, "new_peer failed"); struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_put (skb, sizeof(source)); memcpy (skb->data, source, sizeof(source)); struct pgm_msgv_t* msgv = g_new0 (struct pgm_msgv_t, 1); msgv->msgv_len = 1; msgv->msgv_skb[0] = skb; mock_data_list = g_list_append (mock_data_list, msgv); push_block_event (); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_NORMAL == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (NULL == err, "error raised"); fail_unless ((gsize)sizeof(source) == bytes_read, "unexpected data length"); push_block_event (); fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* zero length data waiting */ START_TEST (test_on_zero_pass_001) { pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); mock_data_on_spmr = TRUE; gpointer packet; gsize packet_len; generate_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; mock_peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == mock_peer, "new_peer failed"); struct pgm_sk_buff_t* skb = pgm_alloc_skb (TEST_MAX_TPDU); struct pgm_msgv_t* msgv = g_new0 (struct pgm_msgv_t, 1); msgv->msgv_len = 1; msgv->msgv_skb[0] = skb; mock_data_list = g_list_append (mock_data_list, msgv); push_block_event (); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_NORMAL == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (NULL == err, "error raised"); fail_unless ((gsize)0 == bytes_read, "unexpected data length"); push_block_event (); fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST /* more than vector length data waiting */ START_TEST (test_on_many_data_pass_001) { const char* source[] = { "i am not a string", "i am not an iguana", "i am not a peach" }; pgm_sock_t* sock = generate_sock(); fail_if (NULL == sock, "generate_sock failed"); mock_data_on_spmr = TRUE; gpointer packet; gsize packet_len; generate_spmr (&packet, &packet_len); generate_msghdr (packet, packet_len); const pgm_tsi_t peer_tsi = { { 9, 8, 7, 6, 5, 4 }, g_htons(9000) }; struct sockaddr_in grp_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_GROUP_ADDR) }, peer_addr = { .sin_family = AF_INET, .sin_addr.s_addr = inet_addr(TEST_END_ADDR) }; mock_peer = mock_pgm_new_peer (sock, &peer_tsi, (struct sockaddr*)&grp_addr, sizeof(grp_addr), (struct sockaddr*)&peer_addr, sizeof(peer_addr), mock_pgm_time_now); fail_if (NULL == mock_peer, "new_peer failed"); struct pgm_sk_buff_t* skb; struct pgm_msgv_t* msgv; /* #1 */ msgv = g_new0 (struct pgm_msgv_t, 1); skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_put (skb, strlen(source[0]) + 1); memcpy (skb->data, source[0], strlen(source[0])); msgv->msgv_len = 1; msgv->msgv_skb[0] = skb; mock_data_list = g_list_append (mock_data_list, msgv); /* #2 */ msgv = g_new0 (struct pgm_msgv_t, 1); skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_put (skb, strlen(source[1]) + 1); memcpy (skb->data, source[1], strlen(source[1])); msgv->msgv_len = 1; msgv->msgv_skb[0] = skb; mock_data_list = g_list_append (mock_data_list, msgv); /* #3 */ msgv = g_new0 (struct pgm_msgv_t, 1); skb = pgm_alloc_skb (TEST_MAX_TPDU); pgm_skb_put (skb, strlen(source[2]) + 1); memcpy (skb->data, source[2], strlen(source[2])); msgv->msgv_len = 1; msgv->msgv_skb[0] = skb; mock_data_list = g_list_append (mock_data_list, msgv); guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; gsize bytes_read; pgm_error_t* err = NULL; fail_unless (PGM_IO_STATUS_NORMAL == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (NULL == err, "error raised"); fail_unless ((gsize)(strlen(source[0]) + 1) == bytes_read, "unexpected data length"); g_message ("#1 = \"%s\"", buffer); fail_unless (PGM_IO_STATUS_NORMAL == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (NULL == err, "error raised"); fail_unless ((gsize)(strlen(source[1]) + 1) == bytes_read, "unexpected data length"); g_message ("#2 = \"%s\"", buffer); fail_unless (PGM_IO_STATUS_NORMAL == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); fail_unless (NULL == err, "error raised"); fail_unless ((gsize)(strlen(source[2]) + 1) == bytes_read, "unexpected data length"); g_message ("#3 = \"%s\"", buffer); push_block_event (); fail_unless (PGM_IO_STATUS_TIMER_PENDING == pgm_recv (sock, buffer, sizeof(buffer), MSG_DONTWAIT, &bytes_read, &err), "recv failed"); } END_TEST START_TEST (test_recv_fail_001) { guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; fail_unless (PGM_IO_STATUS_ERROR == pgm_recv (NULL, buffer, sizeof(buffer), 0, NULL, NULL), "recv failed"); } END_TEST /* target: * int * pgm_recvfrom ( * pgm_sock_t* sock, * void* data, * size_t len, * int flags, * size_t* bytes_read, * struct pgm_sockaddr_t* from, * socklen_t* fromlen, * pgm_error_t** error * ) */ START_TEST (test_recvfrom_fail_001) { guint8 buffer[ TEST_TXW_SQNS * TEST_MAX_TPDU ]; struct pgm_sockaddr_t from; socklen_t fromlen = sizeof(from); fail_unless (PGM_IO_STATUS_ERROR == pgm_recvfrom (NULL, buffer, sizeof(buffer), 0, NULL, &from, &fromlen, NULL), "recvfrom failed"); } END_TEST /* target: * int * pgm_recvmsg ( * pgm_sock_t* sock, * pgm_msgv_t* msgv, * int flags, * size_t* bytes_read, * pgm_error_t** error * ) */ START_TEST (test_recvmsg_fail_001) { struct pgm_msgv_t msgv; fail_unless (PGM_IO_STATUS_ERROR == pgm_recvmsg (NULL, &msgv, 0, NULL, NULL), "recvmsg failed"); } END_TEST /* target: * int * pgm_recvmsgv ( * pgm_sock_t* sock, * pgm_msgv_t* msgv, * unsigned msgv_length, * int flags, * size_t* bytes_read, * pgm_error_t** error * ) */ START_TEST (test_recvmsgv_fail_001) { struct pgm_msgv_t msgv[1]; fail_unless (PGM_IO_STATUS_ERROR == pgm_recvmsgv (NULL, msgv, G_N_ELEMENTS(msgv), 0, NULL, NULL), "recvmsgv failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_block = tcase_create ("block"); suite_add_tcase (s, tc_block); tcase_add_checked_fixture (tc_block, mock_setup, mock_teardown); tcase_add_test (tc_block, test_block_pass_001); TCase* tc_data = tcase_create ("data"); suite_add_tcase (s, tc_data); tcase_add_checked_fixture (tc_data, mock_setup, mock_teardown); tcase_add_test (tc_data, test_data_pass_001); TCase* tc_spm = tcase_create ("spm"); suite_add_tcase (s, tc_spm); tcase_add_checked_fixture (tc_spm, mock_setup, mock_teardown); tcase_add_test (tc_spm, test_spm_pass_001); TCase* tc_nak = tcase_create ("nak"); suite_add_tcase (s, tc_nak); tcase_add_checked_fixture (tc_nak, mock_setup, mock_teardown); tcase_add_test (tc_nak, test_nak_pass_001); TCase* tc_peer_nak = tcase_create ("peer-nak"); suite_add_tcase (s, tc_peer_nak); tcase_add_checked_fixture (tc_peer_nak, mock_setup, mock_teardown); tcase_add_test (tc_peer_nak, test_peer_nak_pass_001); TCase* tc_nnak = tcase_create ("nnak"); suite_add_tcase (s, tc_nnak); tcase_add_checked_fixture (tc_nnak, mock_setup, mock_teardown); tcase_add_test (tc_nnak, test_nnak_pass_001); TCase* tc_ncf = tcase_create ("ncf"); suite_add_tcase (s, tc_ncf); tcase_add_checked_fixture (tc_ncf, mock_setup, mock_teardown); tcase_add_test (tc_ncf, test_ncf_pass_001); TCase* tc_spmr = tcase_create ("spmr"); suite_add_tcase (s, tc_spmr); tcase_add_checked_fixture (tc_spmr, mock_setup, mock_teardown); tcase_add_test (tc_spmr, test_spmr_pass_001); TCase* tc_peer_spmr = tcase_create ("peer-spmr"); suite_add_tcase (s, tc_peer_spmr); tcase_add_checked_fixture (tc_peer_spmr, mock_setup, mock_teardown); tcase_add_test (tc_peer_spmr, test_peer_spmr_pass_001); TCase* tc_lost = tcase_create ("lost"); suite_add_tcase (s, tc_lost); tcase_add_checked_fixture (tc_lost, mock_setup, mock_teardown); tcase_add_test (tc_lost, test_lost_pass_001); TCase* tc_abort_on_lost = tcase_create ("abort-on-lost"); suite_add_tcase (s, tc_abort_on_lost); tcase_add_checked_fixture (tc_abort_on_lost, mock_setup, mock_teardown); tcase_add_test (tc_abort_on_lost, test_abort_on_lost_pass_001); TCase* tc_then_lost = tcase_create ("then-lost"); suite_add_tcase (s, tc_then_lost); tcase_add_checked_fixture (tc_then_lost, mock_setup, mock_teardown); tcase_add_test (tc_then_lost, test_then_lost_pass_001); TCase* tc_then_abort_on_lost = tcase_create ("then-abort-on-lost"); suite_add_tcase (s, tc_then_abort_on_lost); tcase_add_checked_fixture (tc_then_abort_on_lost, mock_setup, mock_teardown); tcase_add_test (tc_then_abort_on_lost, test_then_abort_on_lost_pass_001); TCase* tc_on_data = tcase_create ("on-data"); suite_add_tcase (s, tc_on_data); tcase_add_checked_fixture (tc_on_data, mock_setup, mock_teardown); tcase_add_test (tc_on_data, test_on_data_pass_001); TCase* tc_on_zero = tcase_create ("on-zero"); suite_add_tcase (s, tc_on_zero); tcase_add_checked_fixture (tc_on_zero, mock_setup, mock_teardown); tcase_add_test (tc_on_zero, test_on_zero_pass_001); TCase* tc_on_many_data = tcase_create ("on-many-data"); suite_add_tcase (s, tc_on_many_data); tcase_add_checked_fixture (tc_on_many_data, mock_setup, mock_teardown); tcase_add_test (tc_on_many_data, test_on_many_data_pass_001); TCase* tc_recv = tcase_create ("recv"); suite_add_tcase (s, tc_recv); tcase_add_checked_fixture (tc_recv, mock_setup, mock_teardown); tcase_add_test (tc_recv, test_recv_fail_001); TCase* tc_recvfrom = tcase_create ("recvfrom"); suite_add_tcase (s, tc_recvfrom); tcase_add_checked_fixture (tc_recvfrom, mock_setup, mock_teardown); tcase_add_test (tc_recvfrom, test_recvfrom_fail_001); TCase* tc_recvmsg = tcase_create ("recvmsg"); suite_add_tcase (s, tc_recvmsg); tcase_add_checked_fixture (tc_recvmsg, mock_setup, mock_teardown); tcase_add_test (tc_recvmsg, test_recvmsg_fail_001); TCase* tc_recvmsgv = tcase_create ("recvmsgv"); suite_add_tcase (s, tc_recvmsgv); tcase_add_checked_fixture (tc_recvmsgv, mock_setup, mock_teardown); tcase_add_test (tc_recvmsgv, test_recvmsgv_fail_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif g_assert (pgm_time_init (NULL)); pgm_rand_init(); pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); pgm_rand_shutdown(); g_assert (pgm_time_shutdown()); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/rate_control.c0000644000175000017500000002356111640407354020411 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Rate regulation. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include /* create machinery for rate regulation. * the rate_per_sec is ammortized over millisecond time periods. * * NB: bucket MUST be memset 0 before calling. */ PGM_GNUC_INTERNAL void pgm_rate_create ( pgm_rate_t* bucket, const ssize_t rate_per_sec, /* 0 = disable */ const size_t iphdr_len, const uint16_t max_tpdu ) { /* pre-conditions */ pgm_assert (NULL != bucket); pgm_assert (rate_per_sec >= max_tpdu); bucket->rate_per_sec = rate_per_sec; bucket->iphdr_len = iphdr_len; bucket->last_rate_check = pgm_time_update_now (); /* pre-fill bucket */ if ((rate_per_sec / 1000) >= max_tpdu) { bucket->rate_per_msec = bucket->rate_per_sec / 1000; bucket->rate_limit = bucket->rate_per_msec; } else { bucket->rate_limit = bucket->rate_per_sec; } pgm_spinlock_init (&bucket->spinlock); } PGM_GNUC_INTERNAL void pgm_rate_destroy ( pgm_rate_t* bucket ) { /* pre-conditions */ pgm_assert (NULL != bucket); pgm_spinlock_free (&bucket->spinlock); } /* check bit bucket whether an operation can proceed or should wait. * * returns TRUE when leaky bucket permits unless non-blocking flag is set. * returns FALSE if operation should block and non-blocking flag is set. */ PGM_GNUC_INTERNAL bool pgm_rate_check2 ( pgm_rate_t* major_bucket, pgm_rate_t* minor_bucket, const size_t data_size, const bool is_nonblocking ) { int64_t new_major_limit, new_minor_limit; pgm_time_t now; /* pre-conditions */ pgm_assert (NULL != major_bucket); pgm_assert (NULL != minor_bucket); pgm_assert (data_size > 0); if (0 == major_bucket->rate_per_sec && 0 == minor_bucket->rate_per_sec) return TRUE; if (0 != major_bucket->rate_per_sec) { pgm_spinlock_lock (&major_bucket->spinlock); now = pgm_time_update_now(); if (major_bucket->rate_per_msec) { const pgm_time_t time_since_last_rate_check = now - major_bucket->last_rate_check; if (time_since_last_rate_check > pgm_msecs(1)) new_major_limit = major_bucket->rate_per_msec; else { new_major_limit = major_bucket->rate_limit + ((major_bucket->rate_per_msec * time_since_last_rate_check) / 1000UL); if (new_major_limit > major_bucket->rate_per_msec) new_major_limit = major_bucket->rate_per_msec; } } else { const pgm_time_t time_since_last_rate_check = now - major_bucket->last_rate_check; if (time_since_last_rate_check > pgm_secs(1)) new_major_limit = major_bucket->rate_per_sec; else { new_major_limit = major_bucket->rate_limit + ((major_bucket->rate_per_sec * time_since_last_rate_check) / 1000000UL); if (new_major_limit > major_bucket->rate_per_sec) new_major_limit = major_bucket->rate_per_sec; } } new_major_limit -= ( major_bucket->iphdr_len + data_size ); if (is_nonblocking && new_major_limit < 0) { pgm_spinlock_unlock (&major_bucket->spinlock); return FALSE; } if (new_major_limit < 0) { const pgm_time_t wait_start = now; ssize_t sleep_amount; do { pgm_thread_yield(); now = pgm_time_update_now(); sleep_amount = (ssize_t)pgm_to_secs (major_bucket->rate_per_sec * (now - wait_start)); } while (sleep_amount + new_major_limit < 0); new_major_limit += sleep_amount; } } else { /* ensure we have a timestamp */ now = pgm_time_update_now(); } if (0 != minor_bucket->rate_per_sec) { if (minor_bucket->rate_per_msec) { const pgm_time_t time_since_last_rate_check = now - minor_bucket->last_rate_check; if (time_since_last_rate_check > pgm_msecs(1)) new_minor_limit = minor_bucket->rate_per_msec; else { new_minor_limit = minor_bucket->rate_limit + ((minor_bucket->rate_per_msec * time_since_last_rate_check) / 1000UL); if (new_minor_limit > minor_bucket->rate_per_msec) new_minor_limit = minor_bucket->rate_per_msec; } } else { const pgm_time_t time_since_last_rate_check = now - minor_bucket->last_rate_check; if (time_since_last_rate_check > pgm_secs(1)) new_minor_limit = minor_bucket->rate_per_sec; else { new_minor_limit = minor_bucket->rate_limit + ((minor_bucket->rate_per_sec * time_since_last_rate_check) / 1000000UL); if (new_minor_limit > minor_bucket->rate_per_sec) new_minor_limit = minor_bucket->rate_per_sec; } } new_minor_limit -= ( minor_bucket->iphdr_len + data_size ); if (is_nonblocking && new_minor_limit < 0) { if (0 != major_bucket->rate_per_sec) pgm_spinlock_unlock (&major_bucket->spinlock); return FALSE; } /* commit new rate limit */ minor_bucket->rate_limit = new_minor_limit; minor_bucket->last_rate_check = now; } if (0 != major_bucket->rate_per_sec) { major_bucket->rate_limit = new_major_limit; major_bucket->last_rate_check = now; pgm_spinlock_unlock (&major_bucket->spinlock); } /* sleep on minor bucket outside of lock */ if (minor_bucket->rate_limit < 0) { ssize_t sleep_amount; do { pgm_thread_yield(); now = pgm_time_update_now(); sleep_amount = (ssize_t)pgm_to_secs (minor_bucket->rate_per_sec * (now - minor_bucket->last_rate_check)); } while (sleep_amount + minor_bucket->rate_limit < 0); minor_bucket->rate_limit += sleep_amount; minor_bucket->last_rate_check = now; } return TRUE; } PGM_GNUC_INTERNAL bool pgm_rate_check ( pgm_rate_t* bucket, const size_t data_size, const bool is_nonblocking ) { int64_t new_rate_limit; /* pre-conditions */ pgm_assert (NULL != bucket); pgm_assert (data_size > 0); if (0 == bucket->rate_per_sec) return TRUE; pgm_spinlock_lock (&bucket->spinlock); pgm_time_t now = pgm_time_update_now(); if (bucket->rate_per_msec) { const pgm_time_t time_since_last_rate_check = now - bucket->last_rate_check; if (time_since_last_rate_check > pgm_msecs(1)) new_rate_limit = bucket->rate_per_msec; else { new_rate_limit = bucket->rate_limit + ((bucket->rate_per_msec * time_since_last_rate_check) / 1000UL); if (new_rate_limit > bucket->rate_per_msec) new_rate_limit = bucket->rate_per_msec; } } else { const pgm_time_t time_since_last_rate_check = now - bucket->last_rate_check; if (time_since_last_rate_check > pgm_secs(1)) new_rate_limit = bucket->rate_per_sec; else { new_rate_limit = bucket->rate_limit + ((bucket->rate_per_sec * time_since_last_rate_check) / 1000000UL); if (new_rate_limit > bucket->rate_per_sec) new_rate_limit = bucket->rate_per_sec; } } new_rate_limit -= ( bucket->iphdr_len + data_size ); if (is_nonblocking && new_rate_limit < 0) { pgm_spinlock_unlock (&bucket->spinlock); return FALSE; } bucket->rate_limit = new_rate_limit; bucket->last_rate_check = now; if (bucket->rate_limit < 0) { ssize_t sleep_amount; do { pgm_thread_yield(); now = pgm_time_update_now(); sleep_amount = (ssize_t)pgm_to_secs (bucket->rate_per_sec * (now - bucket->last_rate_check)); } while (sleep_amount + bucket->rate_limit < 0); bucket->rate_limit += sleep_amount; bucket->last_rate_check = now; } pgm_spinlock_unlock (&bucket->spinlock); return TRUE; } PGM_GNUC_INTERNAL pgm_time_t pgm_rate_remaining2 ( pgm_rate_t* major_bucket, pgm_rate_t* minor_bucket, const size_t n ) { pgm_time_t remaining = 0; pgm_time_t now; /* pre-conditions */ pgm_assert (NULL != major_bucket); pgm_assert (NULL != minor_bucket); if (PGM_UNLIKELY(0 == major_bucket->rate_per_sec && 0 == minor_bucket->rate_per_sec)) return remaining; if (0 != major_bucket->rate_per_sec) { pgm_spinlock_lock (&major_bucket->spinlock); now = pgm_time_update_now(); const int64_t bucket_bytes = major_bucket->rate_limit + pgm_to_secs (major_bucket->rate_per_sec * (now - major_bucket->last_rate_check)) - n; if (bucket_bytes < 0) { const int64_t outstanding_bytes = -bucket_bytes; const pgm_time_t major_remaining = (1000000UL * outstanding_bytes) / major_bucket->rate_per_sec; remaining = major_remaining; } } else { /* ensure we have a timestamp */ now = pgm_time_update_now(); } if (0 != minor_bucket->rate_per_sec) { const int64_t bucket_bytes = minor_bucket->rate_limit + pgm_to_secs (minor_bucket->rate_per_sec * (now - minor_bucket->last_rate_check)) - n; if (bucket_bytes < 0) { const int64_t outstanding_bytes = -bucket_bytes; const pgm_time_t minor_remaining = (1000000UL * outstanding_bytes) / minor_bucket->rate_per_sec; remaining = remaining > 0 ? MIN(remaining, minor_remaining) : minor_remaining; } } if (0 != major_bucket->rate_per_sec) { pgm_spinlock_unlock (&major_bucket->spinlock); } return remaining; } PGM_GNUC_INTERNAL pgm_time_t pgm_rate_remaining ( pgm_rate_t* bucket, const size_t n ) { /* pre-conditions */ pgm_assert (NULL != bucket); if (PGM_UNLIKELY(0 == bucket->rate_per_sec)) return 0; pgm_spinlock_lock (&bucket->spinlock); const pgm_time_t now = pgm_time_update_now(); const pgm_time_t time_since_last_rate_check = now - bucket->last_rate_check; const int64_t bucket_bytes = bucket->rate_limit + pgm_to_secs (bucket->rate_per_sec * time_since_last_rate_check) - n; pgm_spinlock_unlock (&bucket->spinlock); if (bucket_bytes >= 0) return 0; const int64_t outstanding_bytes = -bucket_bytes; const pgm_time_t remaining = (1000000UL * outstanding_bytes) / bucket->rate_per_sec; return remaining; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/messages.c0000644000175000017500000001132711640407354017522 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * basic message reporting. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #ifndef _WIN32 # include #else # include #endif #include /* globals */ /* bit mask for trace role modules */ int pgm_log_mask PGM_GNUC_READ_MOSTLY = 0xffff; int pgm_min_log_level PGM_GNUC_READ_MOSTLY = PGM_LOG_LEVEL_NORMAL; /* locals */ static const char log_levels[8][7] = { "Uknown", "Debug", "Trace", "Minor", "Info", "Warn", "Error", "Fatal" }; static volatile uint32_t messages_ref_count = 0; static pgm_mutex_t messages_mutex; static pgm_log_func_t log_handler PGM_GNUC_READ_MOSTLY = NULL; static void* log_handler_closure PGM_GNUC_READ_MOSTLY = NULL; static inline const char* log_level_text (const int) PGM_GNUC_PURE; static inline const char* log_level_text ( const int log_level ) { switch (log_level) { default: return log_levels[0]; case PGM_LOG_LEVEL_DEBUG: return log_levels[1]; case PGM_LOG_LEVEL_TRACE: return log_levels[2]; case PGM_LOG_LEVEL_MINOR: return log_levels[3]; case PGM_LOG_LEVEL_NORMAL: return log_levels[4]; case PGM_LOG_LEVEL_WARNING: return log_levels[5]; case PGM_LOG_LEVEL_ERROR: return log_levels[6]; case PGM_LOG_LEVEL_FATAL: return log_levels[7]; } } /* reference counted init and shutdown */ void pgm_messages_init (void) { char *log_mask, *min_log_level; size_t len; errno_t err; if (pgm_atomic_exchange_and_add32 (&messages_ref_count, 1) > 0) return; pgm_mutex_init (&messages_mutex); err = pgm_dupenv_s (&log_mask, &len, "PGM_LOG_MASK"); if (!err && len > 0) { unsigned int value = 0; if (1 == pgm_sscanf_s (log_mask, "0x%4x", &value)) pgm_log_mask = value; pgm_free (log_mask); } err = pgm_dupenv_s (&min_log_level, &len, "PGM_MIN_LOG_LEVEL"); if (!err && len > 0) { switch (min_log_level[0]) { case 'D': pgm_min_log_level = PGM_LOG_LEVEL_DEBUG; break; case 'T': pgm_min_log_level = PGM_LOG_LEVEL_TRACE; break; case 'M': pgm_min_log_level = PGM_LOG_LEVEL_MINOR; break; case 'N': pgm_min_log_level = PGM_LOG_LEVEL_NORMAL; break; case 'W': pgm_min_log_level = PGM_LOG_LEVEL_WARNING; break; case 'E': pgm_min_log_level = PGM_LOG_LEVEL_ERROR; break; case 'F': pgm_min_log_level = PGM_LOG_LEVEL_FATAL; break; default: break; } pgm_free (min_log_level); } } void pgm_messages_shutdown (void) { pgm_return_if_fail (pgm_atomic_read32 (&messages_ref_count) > 0); if (pgm_atomic_exchange_and_add32 (&messages_ref_count, (uint32_t)-1) != 1) return; pgm_mutex_free (&messages_mutex); } /* set application handler for log messages, returns previous value, * default handler value is NULL. */ pgm_log_func_t pgm_log_set_handler ( pgm_log_func_t handler, void* closure ) { pgm_log_func_t previous_handler; const uint32_t count = pgm_atomic_read32 (&messages_ref_count); /* cannot use mutexes for initialising log handler before pgm_init() for * locking systems that do not accept static initialization, e.g. Windows * critical sections. */ if (count > 0) pgm_mutex_lock (&messages_mutex); previous_handler = log_handler; log_handler = handler; log_handler_closure = closure; if (count > 0) pgm_mutex_unlock (&messages_mutex); return previous_handler; } PGM_GNUC_INTERNAL void pgm__log ( const int log_level, const char* format, ... ) { va_list args; va_start (args, format); pgm__logv (log_level, format, args); va_end (args); } PGM_GNUC_INTERNAL void pgm__logv ( const int log_level, const char* format, va_list args ) { char tbuf[1024]; pgm_mutex_lock (&messages_mutex); const int offset = pgm_snprintf_s (tbuf, sizeof (tbuf), _TRUNCATE, "%s: ", log_level_text (log_level)); pgm_vsnprintf_s (tbuf + offset, sizeof(tbuf) - offset, _TRUNCATE, format, args); if (log_handler) log_handler (log_level, tbuf, log_handler_closure); else { /* ignore return value */ (void) write (STDOUT_FILENO, tbuf, strlen (tbuf)); (void) write (STDOUT_FILENO, "\n", 1); } pgm_mutex_unlock (&messages_mutex); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConscript.libpgm890000644000175000017500000001351611640407354021215 0ustar locallocal# -*- mode: python -*- # OpenPGM build script # $Id$ import os; import string; Import('env') src = Split(""" thread.c mem.c string.c list.c slist.c queue.c hashtable.c messages.c error.c math.c packet_parse.c packet_test.c sockaddr.c time.c if.c getifaddrs.c get_nprocs.c getnetbyname.c getnodeaddr.c getprotobyname.c indextoaddr.c indextoname.c nametoindex.c inet_network.c md5.c rand.c gsi.c tsi.c txw.c rxw.c skbuff.c socket.c source.c receiver.c recv.c engine.c timer.c net.c rate_control.c checksum.c reed_solomon.c galois_tables.c wsastrerror.c histogram.c """) e = env.Clone(); e.Append(CCFLAGS = '-DGETTEXT_PACKAGE=\'"pgm"\''); # Galois tables e.Command ('galois_tables.c', 'galois_generator.pl', "perl $SOURCE > $TARGET"); # Version stamping e.Command ('version.c', 'version_generator.py', "python $SOURCE > $TARGET"); e.Depends ('version.c', src); src += ['version.c']; # C89 degrading c89source = Builder(action = 'cp $SOURCE $TARGET && if test -f "${SOURCE}.c89.patch"; then patch -i ${SOURCE}.c89.patch $TARGET; fi', suffix = '.c89.c', src_suffix = '.c', single_source = 1); e.Append(BUILDERS = {'C89Source' : c89source}) c89src = [] for c99file in src: c89file = c99file.replace('.c', '.c89.c'); c89src += [ c89file ]; patchFile = c99file + '.c89.patch'; if os.path.exists (patchFile): e.Depends (c89file, patchFile); e.C89Source(c99file); e.StaticLibrary('libpgm89', c89src); e.StaticSharedLibrary('libpgm89-pic', c89src); #----------------------------------------------------------------------------- # unit testing if env['WITH_CHECK'] == 'true': te = e.Clone(); # add new suffix so we can re-use libpgm objects te['SHOBJSUFFIX'] = '.libpgm' + te['SHOBJSUFFIX']; te['OBJSUFFIX'] = '.libpgm' + te['OBJSUFFIX']; te.MergeFlags(env['GLIB_FLAGS']); te.MergeFlags(env['CHECK_FLAGS']); newCCFLAGS = [ '-DSKB_DEBUG' ]; for flag in te['CCFLAGS']: if ("-W" != flag[:2]) and ("-pedantic" != flag[:9]): newCCFLAGS.append(flag); te['CCFLAGS'] = newCCFLAGS; # log dependencies tlog = [ te.Object('messages.c'), te.Object('thread.c'), te.Object('galois_tables.c'), te.Object('mem.c'), te.Object('histogram.c'), te.Object('string.c'), te.Object('slist.c'), te.Object('wsastrerror.c') ]; # framework te.Program (['atomic_unittest.c']); te.Program (['checksum_unittest.c'] + tlog); te.Program (['error_unittest.c'] + tlog); te.Program (['md5_unittest.c'] + tlog); te.Program (['getifaddrs_unittest.c', te.Object('error.c'), te.Object('sockaddr.c'), te.Object('list.c'), # mingw linking te.Object('indextoaddr.c'), te.Object('nametoindex.c') ] + tlog); te.Program (['getnetbyname_unittest.c', te.Object('inet_network.c'), te.Object('sockaddr.c'), # mingw linking te.Object('error.c'), te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c') ] + tlog); te.Program (['getnodeaddr_unittest.c', te.Object('error.c'), te.Object('sockaddr.c'), # mingw linking te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c') ] + tlog); te.Program (['getprotobyname_unittest.c', te.Object('sockaddr.c'), # mingw linking te.Object('error.c'), te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c') ] + tlog); te.Program (['indextoaddr_unittest.c', te.Object('error.c'), te.Object('sockaddr.c')] + tlog); te.Program (['inet_network_unittest.c', te.Object('sockaddr.c'), # mingw linking te.Object('error.c'), te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c') ] + tlog); te.Program (['rate_control_unittest.c'] + tlog); te.Program (['reed_solomon_unittest.c'] + tlog); te.Program (['time_unittest.c', te.Object('error.c')] + tlog); # collate tframework = [ te.Object('checksum.c'), te.Object('error.c'), te.Object('galois_tables.c'), te.Object('getifaddrs.c'), te.Object('getnetbyname.c'), te.Object('getnodeaddr.c'), te.Object('getprotobyname.c'), te.Object('hashtable.c'), te.Object('histogram.c'), te.Object('indextoaddr.c'), te.Object('indextoname.c'), te.Object('inet_network.c'), te.Object('list.c'), te.Object('math.c'), te.Object('md5.c'), te.Object('mem.c'), te.Object('messages.c'), te.Object('nametoindex.c'), te.Object('queue.c'), te.Object('rand.c'), te.Object('rate_control.c'), te.Object('reed_solomon.c'), te.Object('slist.c'), te.Object('sockaddr.c'), te.Object('string.c'), te.Object('thread.c'), te.Object('time.c'), te.Object('wsastrerror.c') ]; # library te.Program (['txw_unittest.c', te.Object('tsi.c'), te.Object('skbuff.c')] + tframework); te.Program (['rxw_unittest.c', te.Object('tsi.c'), te.Object('skbuff.c')] + tframework); te.Program (['engine_unittest.c', te.Object('version.c')] + tframework); te.Program (['gsi_unittest.c', te.Object('if.c')] + tframework); te.Program (['tsi_unittest.c'] + tframework); te.Program (['if_unittest.c'] + tframework); te.Program (['socket_unittest.c', te.Object('if.c'), te.Object('tsi.c')] + tframework); te.Program (['source_unittest.c', te.Object('skbuff.c')] + tframework); te.Program (['receiver_unittest.c', te.Object('tsi.c')] + tframework); te.Program (['recv_unittest.c', te.Object('tsi.c'), te.Object('gsi.c'), te.Object('skbuff.c')] + tframework); te.Program (['net_unittest.c'] + tframework); te.Program (['timer_unittest.c'] + tframework); te.Program (['packet_parse_unittest.c'] + tframework); te.Program (['packet_test_unittest.c'] + tframework); te.Program (['ip_unittest.c', te.Object('if.c')] + tframework); # performance tests te.Program (['checksum_perftest.c', te.Object('time.c'), te.Object('error.c')] + tlog); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/indextoaddr.c.c89.patch0000644000175000017500000000165211640407354021720 0ustar locallocal--- indextoaddr.c 2011-03-12 10:12:29.000000000 +0800 +++ indextoaddr.c89.c 2011-03-12 10:39:57.000000000 +0800 @@ -45,7 +45,9 @@ if (0 == ifindex) /* any interface or address */ { +#pragma warning( disable : 4244 ) ifsa->sa_family = iffamily; +#pragma warning( default : 4244 ) switch (iffamily) { case AF_INET: ((struct sockaddr_in*)ifsa)->sin_addr.s_addr = INADDR_ANY; @@ -62,6 +64,7 @@ return TRUE; } + { struct pgm_ifaddrs_t *ifap, *ifa; if (!pgm_getifaddrs (&ifap, error)) { pgm_prefix_error (error, @@ -75,6 +78,7 @@ ifa->ifa_addr->sa_family != iffamily) continue; + { const unsigned i = pgm_if_nametoindex (iffamily, ifa->ifa_name); pgm_assert (0 != i); if (i == ifindex) @@ -85,6 +89,7 @@ pgm_freeifaddrs (ifap); return TRUE; } + } } pgm_set_error (error, @@ -94,6 +99,7 @@ ifindex); pgm_freeifaddrs (ifap); return FALSE; + } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/checksum_unittest.c0000644000175000017500000001724611640407354021462 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM checksum routines * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #if defined( BYTE_ORDER ) # define PGM_BYTE_ORDER BYTE_ORDER # define PGM_BIG_ENDIAN BIG_ENDIAN # define PGM_LITTLE_ENDIAN LITTLE_ENDIAN #elif defined( __BYTE_ORDER ) # define PGM_BYTE_ORDER __BYTE_ORDER # define PGM_BIG_ENDIAN __BIG_ENDIAN # define PGM_LITTLE_ENDIAN __LITTLE_ENDIAN #elif defined( __sun ) # define PGM_LITTLE_ENDIAN 1234 # define PGM_BIG_ENDIAN 4321 # if defined( _BIT_FIELDS_LTOH ) # define PGM_BYTE_ORDER PGM_LITTLE_ENDIAN # elif defined( _BIT_FIELDS_HTOL ) # define PGM_BYTE_ORDER PGM_BIG_ENDIAN # else # error "Unknown bit field order for Sun Solaris." # endif #else # error "BYTE_ORDER not supported." #endif #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } #define CHECKSUM_DEBUG #include "checksum.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * uint16_t * pgm_inet_checksum ( * const void* src, * uint16_t len, * uint16_t csum * ) */ START_TEST (test_inet_pass_001) { const char source[] = "i am not a string"; const guint16 answer = 0x1fda; /* network order */ guint16 csum = pgm_inet_checksum (source, sizeof(source), 0); /* function calculates answer in host order */ csum = g_htons (csum); g_message ("IP checksum of \"%s\" (%u) is %u (%u)", source, (unsigned)sizeof(source), csum, answer); fail_unless (answer == csum, "checksum mismatch"); } END_TEST START_TEST (test_inet_pass_002) { char* source = alloca (65535); for (unsigned i = 0, j = 0; i < 65535; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = 0x3fc0; /* network order */ guint16 csum = pgm_inet_checksum (source, 65535, 0); /* function calculates answer in host order */ csum = g_htons (csum); g_message ("IP checksum of 64KB is %u (%u)", csum, answer); fail_unless (answer == csum, "checksum mismatch"); } END_TEST START_TEST (test_inet_fail_001) { pgm_inet_checksum (NULL, 0, 0); fail ("reached"); } END_TEST /* target: * guint16 * pgm_csum_fold ( * guint32 csum * ) */ START_TEST (test_fold_pass_001) { const guint32 csum = 0xdd250300; /* network order */ const guint16 answer = 0x1fda; guint16 folded_csum = pgm_csum_fold (g_ntohl (csum)); folded_csum = g_htons (folded_csum); g_message ("32-bit checksum %u folds into %u (%u)", csum, folded_csum, answer); fail_unless (answer == folded_csum, "folded checksum mismatch"); } END_TEST /* target: * guint32 * pgm_csum_partial ( * const void* src, * guint len, * guint32 sum * ) */ START_TEST (test_partial_pass_001) { const char source[] = "i am not a string"; #if PGM_BYTE_ORDER == PGM_BIG_ENDIAN const guint32 answer = 0x0000e025; /* network order */ #elif PGM_BYTE_ORDER == PGM_LITTLE_ENDIAN const guint32 answer = 0xe0250000; /* network order */ #else # error "PGM_BYTE_ORDER not supported." #endif guint32 csum = pgm_csum_partial (source, sizeof(source), 0); csum = g_htonl (csum); g_message ("Partial checksum of \"%s\" is %u (%u)", source, csum, answer); fail_unless (answer == csum, "checksum mismatch"); } END_TEST START_TEST (test_partial_fail_001) { pgm_csum_partial (NULL, 0, 0); fail ("reached"); } END_TEST /* target: * guint32 * pgm_csum_partial_copy ( * const void* src, * void* dst, * guint len, * guint32 sum * ) */ START_TEST (test_partial_copy_pass_001) { const char source[] = "i am not a string"; #if PGM_BYTE_ORDER == PGM_BIG_ENDIAN const guint32 answer = 0x0000e025; /* network order */ #elif PGM_BYTE_ORDER == PGM_LITTLE_ENDIAN const guint32 answer = 0xe0250000; /* network order */ #else # error "BYTE_ORDER not supported." #endif char dest[1024]; guint32 csum_source = pgm_csum_partial_copy (source, dest, sizeof(source), 0); csum_source = g_htonl (csum_source); guint32 csum_dest = pgm_csum_partial (dest, sizeof(source), 0); csum_dest = g_htonl (csum_dest); g_message ("Partial copy checksum of \"%s\" is %u, partial checksum is %u (%u)", source, csum_source, csum_dest, answer); fail_unless (answer == csum_source, "checksum mismatch in partial-copy"); fail_unless (answer == csum_dest, "checksum mismatch in partial"); } END_TEST START_TEST (test_partial_copy_fail_001) { pgm_csum_partial_copy (NULL, NULL, 0, 0); fail ("reached"); } END_TEST /* target: * guint32 * pgm_csum_block_add ( * guint32 csum, * guint32 csum2, * guint offset * ) */ START_TEST (test_block_add_pass_001) { const char source[] = "i am not a string"; const guint16 answer = 0x1fda; /* network order */ guint32 csum_a = pgm_csum_partial (source, sizeof(source) / 2, 0); guint32 csum_b = pgm_csum_partial (source + (sizeof(source) / 2), sizeof(source) - (sizeof(source) / 2), 0); guint32 csum = pgm_csum_block_add (csum_a, csum_b, sizeof(source) / 2); guint16 fold = pgm_csum_fold (csum); /* convert to display in network order */ csum_a = g_htonl (csum_a); csum_b = g_htonl (csum_b); csum = g_htonl (csum); fold = g_htons (fold); g_message ("Checksum A:%u + B:%u = %u -> %u (%u)", csum_a, csum_b, csum, fold, answer); fail_unless (answer == fold, "checksum mismatch"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_inet = tcase_create ("inet"); suite_add_tcase (s, tc_inet); tcase_add_test (tc_inet, test_inet_pass_001); tcase_add_test (tc_inet, test_inet_pass_002); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_inet, test_inet_fail_001, SIGABRT); #endif TCase* tc_fold = tcase_create ("fold"); suite_add_tcase (s, tc_fold); tcase_add_test (tc_fold, test_fold_pass_001); TCase* tc_block_add = tcase_create ("block-add"); suite_add_tcase (s, tc_block_add); tcase_add_test (tc_block_add, test_block_add_pass_001); TCase* tc_partial = tcase_create ("partial"); suite_add_tcase (s, tc_partial); tcase_add_test (tc_partial, test_partial_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_partial, test_partial_fail_001, SIGABRT); #endif TCase* tc_partial_copy = tcase_create ("partial-copy"); suite_add_tcase (s, tc_partial_copy); tcase_add_test (tc_partial_copy, test_partial_copy_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_partial_copy, test_partial_copy_fail_001, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/packet_parse_unittest.c0000644000175000017500000002262311640407354022314 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM packet handling. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #ifndef _WIN32 # include # include # include # include #else # include # include #endif #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ #define PACKET_DEBUG #include "packet_parse.c" static struct pgm_sk_buff_t* generate_raw_pgm (void) { const char source[] = "i am not a string"; const guint source_len = sizeof(source); struct pgm_sk_buff_t* skb; GError* err = NULL; skb = pgm_alloc_skb (1500); skb->sock = (pgm_sock_t*)0x1; skb->tstamp = 0x1; skb->data = skb->head; skb->len = sizeof(struct pgm_ip) + sizeof(struct pgm_header) + sizeof(struct pgm_data) + source_len; skb->tail = (guint8*)skb->data + skb->len; /* add IP header */ struct pgm_ip* iphdr = skb->data; iphdr->ip_hl = sizeof(struct pgm_ip) / 4; iphdr->ip_v = 4; iphdr->ip_tos = 0; iphdr->ip_len = g_htons (skb->len); iphdr->ip_id = 0; iphdr->ip_off = 0; iphdr->ip_ttl = 16; iphdr->ip_p = IPPROTO_PGM; iphdr->ip_sum = 0; iphdr->ip_src.s_addr = inet_addr ("127.0.0.1"); iphdr->ip_dst.s_addr = inet_addr ("127.0.0.2"); /* add PGM header */ struct pgm_header* pgmhdr = (gpointer)(iphdr + 1); pgmhdr->pgm_sport = g_htons ((guint16)1000); pgmhdr->pgm_dport = g_htons ((guint16)7500); pgmhdr->pgm_type = PGM_ODATA; pgmhdr->pgm_options = 0; pgmhdr->pgm_gsi[0] = 1; pgmhdr->pgm_gsi[1] = 2; pgmhdr->pgm_gsi[2] = 3; pgmhdr->pgm_gsi[3] = 4; pgmhdr->pgm_gsi[4] = 5; pgmhdr->pgm_gsi[5] = 6; pgmhdr->pgm_tsdu_length = g_htons (source_len); /* add ODATA header */ struct pgm_data* datahdr = (gpointer)(pgmhdr + 1); datahdr->data_sqn = g_htonl ((guint32)0); datahdr->data_trail = g_htonl ((guint32)-1); /* add payload */ gpointer data = (gpointer)(datahdr + 1); memcpy (data, source, source_len); /* finally PGM checksum */ pgmhdr->pgm_checksum = 0; pgmhdr->pgm_checksum = pgm_csum_fold (pgm_csum_partial (pgmhdr, sizeof(struct pgm_header) + sizeof(struct pgm_data) + source_len, 0)); /* and IP checksum */ iphdr->ip_sum = pgm_inet_checksum (skb->head, skb->len, 0); return skb; } static struct pgm_sk_buff_t* generate_udp_encap_pgm (void) { const char source[] = "i am not a string"; const guint source_len = sizeof(source); struct pgm_sk_buff_t* skb; GError* err = NULL; skb = pgm_alloc_skb (1500); skb->sock = (pgm_sock_t*)0x1; skb->tstamp = 0x1; skb->data = skb->head; skb->len = sizeof(struct pgm_header) + sizeof(struct pgm_data) + source_len; skb->tail = (guint8*)skb->data + skb->len; /* add PGM header */ struct pgm_header* pgmhdr = skb->head; pgmhdr->pgm_sport = g_htons ((guint16)1000); pgmhdr->pgm_dport = g_htons ((guint16)7500); pgmhdr->pgm_type = PGM_ODATA; pgmhdr->pgm_options = 0; pgmhdr->pgm_gsi[0] = 1; pgmhdr->pgm_gsi[1] = 2; pgmhdr->pgm_gsi[2] = 3; pgmhdr->pgm_gsi[3] = 4; pgmhdr->pgm_gsi[4] = 5; pgmhdr->pgm_gsi[5] = 6; pgmhdr->pgm_tsdu_length = g_htons (source_len); /* add ODATA header */ struct pgm_data* datahdr = (gpointer)(pgmhdr + 1); datahdr->data_sqn = g_htonl ((guint32)0); datahdr->data_trail = g_htonl ((guint32)-1); /* add payload */ gpointer data = (gpointer)(datahdr + 1); memcpy (data, source, source_len); /* finally PGM checksum */ pgmhdr->pgm_checksum = 0; pgmhdr->pgm_checksum = pgm_csum_fold (pgm_csum_partial (pgmhdr, sizeof(struct pgm_header) + sizeof(struct pgm_data) + source_len, 0)); return skb; } /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * bool * pgm_parse_raw ( * struct pgm_sk_buff_t* const skb, * struct sockaddr* const addr, * pgm_error_t** error * ) */ START_TEST (test_parse_raw_pass_001) { struct sockaddr_storage addr; pgm_error_t* err = NULL; struct pgm_sk_buff_t* skb = generate_raw_pgm (); gboolean success = pgm_parse_raw (skb, (struct sockaddr*)&addr, &err); if (!success && err) { g_error ("Parsing raw packet: %s", err->message); } fail_unless (TRUE == success, "parse_raw failed"); char saddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&addr, saddr, sizeof(saddr)); g_message ("Decoded destination NLA: %s", saddr); } END_TEST START_TEST (test_parse_raw_fail_001) { struct sockaddr_storage addr; pgm_error_t* err = NULL; pgm_parse_raw (NULL, (struct sockaddr*)&addr, &err); fail ("reached"); } END_TEST /* target: * bool * pgm_parse_udp_encap ( * struct pgm_sk_buff_t* const skb, * pgm_error_t** error * ) */ START_TEST (test_parse_udp_encap_pass_001) { pgm_error_t* err = NULL; struct pgm_sk_buff_t* skb = generate_udp_encap_pgm (); gboolean success = pgm_parse_udp_encap (skb, &err); if (!success && err) { g_error ("Parsing UDP encapsulated packet: %s", err->message); } fail_unless (TRUE == success, "parse_udp_encap failed"); } END_TEST START_TEST (test_parse_udp_encap_fail_001) { pgm_error_t* err = NULL; pgm_parse_udp_encap (NULL, &err); fail ("reached"); } END_TEST /* target: * bool * pgm_verify_spm ( * struct pgm_sk_buff_t* const skb * ) */ START_TEST (test_verify_spm_pass_001) { } END_TEST START_TEST (test_verify_spm_fail_001) { pgm_verify_spm (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_verify_spmr ( * struct pgm_sk_buff_t* const skb * ) */ START_TEST (test_verify_spmr_pass_001) { } END_TEST START_TEST (test_verify_spmr_fail_001) { pgm_verify_spmr (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_verify_nak ( * struct pgm_sk_buff_t* const skb * ) */ START_TEST (test_verify_nak_pass_001) { } END_TEST START_TEST (test_verify_nak_fail_001) { pgm_verify_nak (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_verify_nnak ( * struct pgm_sk_buff_t* const skb * ) */ START_TEST (test_verify_nnak_pass_001) { } END_TEST START_TEST (test_verify_nnak_fail_001) { pgm_verify_nnak (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_verify_ncf ( * struct pgm_sk_buff_t* const skb * ) */ START_TEST (test_verify_ncf_pass_001) { } END_TEST START_TEST (test_verify_ncf_fail_001) { pgm_verify_ncf (NULL); fail ("reached"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_parse_raw = tcase_create ("parse-raw"); suite_add_tcase (s, tc_parse_raw); tcase_add_test (tc_parse_raw, test_parse_raw_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_parse_raw, test_parse_raw_fail_001, SIGABRT); #endif TCase* tc_parse_udp_encap = tcase_create ("parse-udp-encap"); suite_add_tcase (s, tc_parse_udp_encap); tcase_add_test (tc_parse_udp_encap, test_parse_udp_encap_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_parse_udp_encap, test_parse_udp_encap_fail_001, SIGABRT); #endif TCase* tc_verify_spm = tcase_create ("verify-spm"); suite_add_tcase (s, tc_verify_spm); tcase_add_test (tc_verify_spm, test_verify_spm_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_spm, test_verify_spm_fail_001, SIGABRT); #endif TCase* tc_verify_spmr = tcase_create ("verify-spmr"); suite_add_tcase (s, tc_verify_spmr); tcase_add_test (tc_verify_spmr, test_verify_spmr_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_spmr, test_verify_spmr_fail_001, SIGABRT); #endif TCase* tc_verify_nak = tcase_create ("verify-nak"); suite_add_tcase (s, tc_verify_nak); tcase_add_test (tc_verify_nak, test_verify_nak_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_nak, test_verify_nak_fail_001, SIGABRT); #endif TCase* tc_verify_nnak = tcase_create ("verify-nnak"); suite_add_tcase (s, tc_verify_nnak); tcase_add_test (tc_verify_nnak, test_verify_nnak_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_nnak, test_verify_nnak_fail_001, SIGABRT); #endif TCase* tc_verify_ncf = tcase_create ("verify-ncf"); suite_add_tcase (s, tc_verify_ncf); tcase_add_test (tc_verify_ncf, test_verify_ncf_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_verify_ncf, test_verify_ncf_fail_001, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/getnetbyname_unittest.c0000644000175000017500000001334111640407354022332 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for portable function to enumerate network names. * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _WIN32 # include # include #else # include #endif #include #include /* mock state */ #ifndef _WIN32 # define COMPARE_GETNETENT #endif #define GETNETBYNAME_DEBUG #include "getnetbyname.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } static void mock_setup (void) { } static void mock_teardown (void) { } /* target: * struct netent* * pgm_getnetbyname ( * const char* name * ) */ START_TEST (test_getnetbyname_pass_001) { const char loopback[] = "loopback"; fail_if (NULL == pgm_getnetbyname (loopback), "getnetbyname failed"); } END_TEST START_TEST (test_getnetbyname_fail_001) { fail_unless (NULL == pgm_getnetbyname (NULL), "getnetbyname failed"); } END_TEST START_TEST (test_getnetbyname_fail_002) { const char unknown[] = "qwertyuiop"; fail_unless (NULL == pgm_getnetbyname (unknown), "getnetbyname failed"); } END_TEST /* target: * struct pgm_netent_t* * _pgm_compat_getnetent (void) */ START_TEST (test_getnetent_pass_001) { int i = 1; struct pgm_netent_t* ne; #ifdef COMPARE_GETNETENT struct netent* nne; #endif _pgm_compat_setnetent(); #ifdef COMPARE_GETNETENT setnetent (0); #endif while (ne = _pgm_compat_getnetent()) { char buffer[1024]; char **p; #ifdef COMPARE_GETNETENT nne = getnetent(); if (NULL == nne) g_warning ("native ne = (null"); #endif /* official network name */ fail_if (NULL == ne->n_name, "no official name"); g_debug ("%-6dn_name = %s", i++, ne->n_name); #ifdef COMPARE_GETNETENT if (NULL != nne) fail_unless (0 == strcmp (ne->n_name, nne->n_name), "official name mismatch"); #endif /* alias list */ fail_if (NULL == ne->n_aliases, "invalid aliases pointer"); p = ne->n_aliases; if (*p) { strcpy (buffer, *p++); while (*p) { strcat (buffer, ", "); strcat (buffer, *p++); } } else strcpy (buffer, "(nil)"); g_debug (" n_aliases = %s", buffer); #ifdef COMPARE_GETNETENT if (NULL != nne) { char nbuffer[1024]; fail_if (NULL == nne->n_aliases, "invalid aliases pointer"); p = nne->n_aliases; if (*p) { strcpy (nbuffer, *p++); while (*p) { strcat (nbuffer, ", "); strcat (nbuffer, *p++); } } else strcpy (nbuffer, "(nil)"); fail_unless (0 == strcmp (buffer, nbuffer), "aliases mismatch"); } #endif /* net address type */ fail_unless (AF_INET == ne->n_net.ss_family || AF_INET6 == ne->n_net.ss_family, "invalid address family"); if (AF_INET == ne->n_net.ss_family) { struct sockaddr_in sa; struct in_addr net; g_debug (" n_addrtype = AF_INET"); #ifdef COMPARE_GETNETENT fail_unless (ne->n_net.ss_family == nne->n_addrtype, "address family mismatch"); #endif /* network number */ memcpy (&sa, &ne->n_net, sizeof (sa)); fail_unless (0 == getnameinfo ((struct sockaddr*)&sa, sizeof (sa), buffer, sizeof (buffer), NULL, 0, NI_NUMERICHOST), "getnameinfo failed"); g_debug (" n_net = %s", buffer); #ifdef COMPARE_GETNETENT net = pgm_inet_makeaddr (nne->n_net, 0); fail_unless (0 == memcmp (&sa.sin_addr, &net, sizeof (struct in_addr)), "network address mismatch"); #endif } else { struct sockaddr_in6 sa6; g_debug (" n_addrtype = AF_INET6"); #ifdef COMPARE_GETNETENT if (ne->n_net.ss_family != nne->n_addrtype) g_warning ("native address type not AF_INET6"); #endif memcpy (&sa6, &ne->n_net, sizeof (sa6)); fail_unless (0 == getnameinfo ((struct sockaddr*)&sa6, sizeof (sa6), buffer, sizeof (buffer), NULL, 0, NI_NUMERICHOST), "getnameinfo failed"); g_debug (" n_net = %s", buffer); } } _pgm_compat_endnetent(); #ifdef COMPARE_GETNETENT endnetent(); #endif } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_getnetbyname = tcase_create ("getnetbyname"); suite_add_tcase (s, tc_getnetbyname); tcase_add_checked_fixture (tc_getnetbyname, mock_setup, mock_teardown); tcase_add_test (tc_getnetbyname, test_getnetbyname_pass_001); tcase_add_test (tc_getnetbyname, test_getnetbyname_fail_001); tcase_add_test (tc_getnetbyname, test_getnetbyname_fail_002); tcase_add_test (tc_getnetbyname, test_getnetent_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.OSX1060000644000175000017500000002457611640407354020512 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine()); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('COVERAGE', 'test coverage', 'none', allowed_values=('none', 'full')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks # '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header # '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', # '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast # '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD '-DCONFIG_HOST_ORDER_IP_LEN', '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # POSIX threads 'pthread' ], PROTOBUF_CCFLAGS = '-I/usr/local/include/google/protobuf', PROTOBUF_LIBS = '/usr/local/lib/libprotobuf.a', PROTOBUF_PROTOC = 'protoc' ) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': # You may need to add -I${includedir} to Cflags in glib-2.0.pc for gi18n-lib env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --cflags --agent-libs'); def restore_env(env, backup): for var in backup.keys(): env[var] = backup[var]; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/SConscript.libpgm0000644000175000017500000001515011640407354021030 0ustar locallocal# -*- mode: python -*- # OpenPGM build script # $Id$ import os; Import('env') src = Split(""" thread.c mem.c string.c list.c slist.c queue.c hashtable.c messages.c error.c math.c packet_parse.c packet_test.c sockaddr.c time.c if.c getifaddrs.c get_nprocs.c getnetbyname.c getnodeaddr.c getprotobyname.c indextoaddr.c indextoname.c nametoindex.c inet_network.c md5.c rand.c gsi.c tsi.c txw.c rxw.c skbuff.c socket.c source.c receiver.c recv.c engine.c timer.c net.c rate_control.c checksum.c reed_solomon.c galois_tables.c wsastrerror.c histogram.c """) e = env.Clone(); e.Append(CCFLAGS = '-DGETTEXT_PACKAGE=\'"pgm"\''); # Galois tables e.Command ('galois_tables.c', 'galois_generator.pl', "perl $SOURCE > $TARGET"); # Version stamping e.Command ('version.c', 'version_generator.py', "python $SOURCE > $TARGET"); e.Depends ('version.c', src); src += ['version.c']; e.StaticLibrary('libpgm', src); e.StaticSharedLibrary('libpgm-pic', src); #----------------------------------------------------------------------------- # unit testing if env['WITH_CHECK'] == 'true': te = e.Clone(); # add new suffix so we can re-use libpgm objects te['SHOBJSUFFIX'] = '.libpgm' + te['SHOBJSUFFIX']; te['OBJSUFFIX'] = '.libpgm' + te['OBJSUFFIX']; te.MergeFlags(env['GLIB_FLAGS']); te.MergeFlags(env['CHECK_FLAGS']); newCCFLAGS = [ '-DSKB_DEBUG' ]; for flag in te['CCFLAGS']: if ("-W" != flag[:2]) and ("-pedantic" != flag[:9]): newCCFLAGS.append(flag); te['CCFLAGS'] = newCCFLAGS; # log dependencies tlog = [ te.Object('messages.c'), te.Object('thread.c'), te.Object('galois_tables.c'), te.Object('mem.c'), te.Object('histogram.c'), te.Object('string.c'), te.Object('slist.c'), te.Object('wsastrerror.c') ]; # framework te.Program (['atomic_unittest.c']); te.Program (['thread_unittest.c', te.Object('messages.c'), te.Object('galois_tables.c'), te.Object('mem.c'), te.Object('histogram.c'), te.Object('string.c'), te.Object('slist.c'), te.Object('wsastrerror.c'), te.Object('skbuff.c') ]); te.Program (['checksum_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['error_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['md5_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['getifaddrs_unittest.c', te.Object('error.c'), te.Object('sockaddr.c'), te.Object('list.c'), # mingw linking te.Object('indextoaddr.c'), te.Object('nametoindex.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['getnetbyname_unittest.c', te.Object('inet_network.c'), te.Object('sockaddr.c'), # mingw linking te.Object('error.c'), te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['getnodeaddr_unittest.c', te.Object('error.c'), te.Object('sockaddr.c'), # mingw linking te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['getprotobyname_unittest.c', te.Object('sockaddr.c'), # mingw linking te.Object('error.c'), te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['indextoaddr_unittest.c', te.Object('error.c'), te.Object('sockaddr.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['inet_network_unittest.c', te.Object('sockaddr.c'), # mingw linking te.Object('error.c'), te.Object('getifaddrs.c'), te.Object('indextoaddr.c'), te.Object('nametoindex.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['rate_control_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['reed_solomon_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tlog); te.Program (['time_unittest.c', te.Object('error.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); # collate tframework = [ te.Object('checksum.c'), te.Object('error.c'), te.Object('galois_tables.c'), te.Object('getifaddrs.c'), te.Object('getnetbyname.c'), te.Object('getnodeaddr.c'), te.Object('getprotobyname.c'), te.Object('hashtable.c'), te.Object('histogram.c'), te.Object('indextoaddr.c'), te.Object('indextoname.c'), te.Object('inet_network.c'), te.Object('list.c'), te.Object('math.c'), te.Object('md5.c'), te.Object('mem.c'), te.Object('messages.c'), te.Object('nametoindex.c'), te.Object('queue.c'), te.Object('rand.c'), te.Object('rate_control.c'), te.Object('reed_solomon.c'), te.Object('slist.c'), te.Object('sockaddr.c'), te.Object('string.c'), te.Object('thread.c'), te.Object('time.c'), te.Object('wsastrerror.c') ]; # library te.Program (['txw_unittest.c', te.Object('tsi.c'), te.Object('skbuff.c') ] + tframework); te.Program (['rxw_unittest.c', te.Object('tsi.c'), te.Object('skbuff.c') ] + tframework); te.Program (['engine_unittest.c', te.Object('version.c'), # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['gsi_unittest.c', te.Object('if.c'), # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['tsi_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['if_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['socket_unittest.c', te.Object('if.c'), te.Object('tsi.c'), # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['source_unittest.c', te.Object('skbuff.c') ] + tframework); te.Program (['receiver_unittest.c', te.Object('tsi.c'), # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['recv_unittest.c', te.Object('tsi.c'), te.Object('gsi.c'), te.Object('skbuff.c') ] + tframework); te.Program (['net_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['timer_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['packet_parse_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['packet_test_unittest.c', # sunpro linking te.Object('skbuff.c') ] + tframework); te.Program (['ip_unittest.c', te.Object('if.c'), # sunpro linking te.Object('skbuff.c') ] + tframework); # performance tests te.Program (['checksum_perftest.c', te.Object('time.c'), te.Object('error.c'), # sunpro linking te.Object('skbuff.c') ] + tlog); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/getnodeaddr.c0000644000175000017500000002025311640407354020171 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable function to return the nodes IP address. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #ifndef _WIN32 # include #endif #include #include //#define GETNODEADDR_DEBUG /* globals */ static const char* pgm_family_string (const sa_family_t); /* return node addresses, similar to getaddrinfo('..localmachine") on Win2003. * * returns TRUE on success, returns FALSE on failure. */ PGM_GNUC_INTERNAL bool pgm_getnodeaddr ( const sa_family_t family, /* requested address family, AF_INET, AF_INET6, or AF_UNSPEC */ struct addrinfo** restrict res, /* return list of addresses */ pgm_error_t** restrict error ) { struct addrinfo* na; size_t na_len = 0; pgm_return_val_if_fail (AF_INET == family || AF_INET6 == family || AF_UNSPEC == family, FALSE); pgm_return_val_if_fail (NULL != res, FALSE); pgm_debug ("pgm_getnodeaddr (family:%s res:%p error:%p)", pgm_family_string (family), (const void*)res, (const void*)error); char hostname[NI_MAXHOST + 1]; struct hostent* he; if (0 != gethostname (hostname, sizeof(hostname))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Resolving hostname: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno) ); return FALSE; } struct addrinfo hints = { .ai_family = family, .ai_socktype = SOCK_STREAM, /* not really */ .ai_protocol = IPPROTO_TCP, /* not really */ .ai_flags = AI_ADDRCONFIG, }, *result, *ai; int e = getaddrinfo (hostname, NULL, &hints, &result); if (0 == e) { /* NB: getaddrinfo may return multiple addresses, the sorting order of the * list defined by RFC 3484 and /etc/gai.conf */ for (ai = result; NULL != ai; ai = ai->ai_next) { if (!(AF_INET == ai->ai_family || AF_INET6 == ai->ai_family)) continue; if (NULL == ai->ai_addr || 0 == ai->ai_addrlen) continue; na_len += sizeof (struct addrinfo) + ai->ai_addrlen; } na = pgm_malloc0 (na_len); char* p = (char*)na + na_len; /* point to end of block */ struct addrinfo* prev = NULL; for (ai = result; NULL != ai; ai = ai->ai_next) { if (!(AF_INET == ai->ai_family || AF_INET6 == ai->ai_family)) continue; if (NULL == ai->ai_addr || 0 == ai->ai_addrlen) continue; p -= ai->ai_addrlen; memcpy (p, ai->ai_addr, ai->ai_addrlen); struct addrinfo* t = (struct addrinfo*)(p - sizeof (struct addrinfo)); t->ai_family = ai->ai_family; t->ai_addrlen = ai->ai_addrlen; t->ai_addr = (struct sockaddr*)p; t->ai_next = prev; prev = t; p -= sizeof (struct addrinfo); } freeaddrinfo (result); *res = na; return TRUE; } else if (EAI_NONAME != e) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_eai_errno (e, errno), _("Resolving hostname address: %s"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), e)); return FALSE; } else if (AF_UNSPEC == family) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NONAME, _("Resolving hostname address family.")); return FALSE; } /* Common case a dual stack host has incorrect IPv6 configuration, i.e. * hostname is only IPv4 and despite one or more IPv6 addresses. Workaround * for this case is to resolve the IPv4 hostname, find the matching interface * and from that interface find an active IPv6 address taking global scope as * preference over link scoped addresses. */ he = gethostbyname (hostname); if (NULL == he) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_h_errno (h_errno), #ifndef _WIN32 _("Resolving IPv4 hostname address: %s"), hstrerror (h_errno) #else _("Resolving IPv4 hostname address: %s"), pgm_wsastrerror (WSAGetLastError()) #endif ); return FALSE; } struct pgm_ifaddrs_t *ifap, *ifa, *ifa6; if (!pgm_getifaddrs (&ifap, error)) { pgm_prefix_error (error, _("Enumerating network interfaces: ")); return FALSE; } /* hunt for IPv4 interface */ for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (NULL == ifa->ifa_addr || AF_INET != ifa->ifa_addr->sa_family) continue; if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == ((struct in_addr*)(he->h_addr_list[0]))->s_addr) { goto ipv4_found; } } pgm_freeifaddrs (ifap); pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NONET, _("Discovering primary IPv4 network interface.")); return FALSE; ipv4_found: /* hunt for IPv6 interface */ for (ifa6 = ifap; ifa6; ifa6 = ifa6->ifa_next) { if (AF_INET6 != ifa6->ifa_addr->sa_family) continue; if (0 == strcmp (ifa->ifa_name, ifa6->ifa_name)) { goto ipv6_found; } } pgm_freeifaddrs (ifap); pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NONET, _("Discovering primary IPv6 network interface.")); return FALSE; ipv6_found: na_len = sizeof (struct addrinfo) + pgm_sockaddr_len (ifa6->ifa_addr); na = pgm_malloc0 (na_len); na->ai_family = AF_INET6; na->ai_addrlen = pgm_sockaddr_len (ifa6->ifa_addr); na->ai_addr = (struct sockaddr*)((char*)na + sizeof (struct addrinfo)); memcpy (na->ai_addr, ifa6->ifa_addr, na->ai_addrlen); pgm_freeifaddrs (ifap); *res = na; return TRUE; } PGM_GNUC_INTERNAL void pgm_freenodeaddr ( struct addrinfo* res ) { pgm_free (res); } /* pick a node address that supports mulitcast traffic iff more than one * address exists. */ PGM_GNUC_INTERNAL bool pgm_get_multicast_enabled_node_addr ( const sa_family_t family, /* requested address family, AF_INET, AF_INET6, or AF_UNSPEC */ struct sockaddr* restrict addr, const socklen_t cnt, /* size of address pointed to by addr */ pgm_error_t** restrict error ) { struct addrinfo *result, *res; struct pgm_ifaddrs_t *ifap, *ifa; if (!pgm_getnodeaddr (family, &result, error)) { pgm_prefix_error (error, _("Enumerating node address: ")); return FALSE; } /* iff one address return that independent of multicast support */ if (NULL == result->ai_next) { pgm_return_val_if_fail (cnt >= (socklen_t)result->ai_addrlen, FALSE); memcpy (addr, result->ai_addr, result->ai_addrlen); pgm_freenodeaddr (result); return TRUE; } if (!pgm_getifaddrs (&ifap, error)) { pgm_prefix_error (error, _("Enumerating network interfaces: ")); return FALSE; } for (res = result; NULL != res; res = res->ai_next) { /* for each node address find matching interface and test flags */ for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (NULL == ifa->ifa_addr || 0 != pgm_sockaddr_cmp (ifa->ifa_addr, res->ai_addr)) continue; if (ifa->ifa_flags & IFF_MULTICAST) { pgm_return_val_if_fail (cnt >= (socklen_t)res->ai_addrlen, FALSE); memcpy (addr, res->ai_addr, res->ai_addrlen); pgm_freenodeaddr (result); return TRUE; } else break; } /* use last address as fallback */ if (NULL == res->ai_next) { pgm_return_val_if_fail (cnt >= (socklen_t)res->ai_addrlen, FALSE); memcpy (addr, res->ai_addr, res->ai_addrlen); pgm_freenodeaddr (result); return TRUE; } } pgm_freeifaddrs (ifap); pgm_freenodeaddr (result); return FALSE; } static const char* pgm_family_string ( const sa_family_t family ) { const char* c; switch (family) { case AF_UNSPEC: c = "AF_UNSPEC"; break; case AF_INET: c = "AF_INET"; break; case AF_INET6: c = "AF_INET6"; break; default: c = "(unknown)"; break; } return c; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/sockaddr.c.c89.patch0000644000175000017500000000350011640407354021177 0ustar locallocal--- sockaddr.c 2011-04-28 14:30:32.000000000 +0800 +++ sockaddr.c89.c 2011-04-28 14:36:27.000000000 +0800 @@ -139,7 +139,7 @@ ) { return getnameinfo (sa, pgm_sockaddr_len (sa), - host, hostlen, + host, (DWORD)hostlen, NULL, 0, NI_NUMERICHOST); } @@ -151,12 +151,13 @@ struct sockaddr* restrict dst /* will error on wrong size */ ) { - struct addrinfo hints = { - .ai_family = AF_UNSPEC, - .ai_socktype = SOCK_STREAM, /* not really */ - .ai_protocol = IPPROTO_TCP, /* not really */ - .ai_flags = AI_NUMERICHOST - }, *result = NULL; + struct addrinfo hints, *result; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; /* not really */ + hints.ai_protocol = IPPROTO_TCP; /* not really */ + hints.ai_flags = AI_NUMERICHOST; + { const int status = getaddrinfo (src, NULL, &hints, &result); if (PGM_LIKELY(0 == status)) { memcpy (dst, result->ai_addr, result->ai_addrlen); @@ -164,6 +165,7 @@ return 1; } return 0; + } } /* returns tri-state value: 1 if sa is multicast, 0 if sa is not multicast, -1 on error @@ -1170,13 +1172,14 @@ pgm_assert (NULL != src); pgm_assert (NULL != dst); - struct addrinfo hints = { - .ai_family = af, - .ai_socktype = SOCK_STREAM, /* not really */ - .ai_protocol = IPPROTO_TCP, /* not really */ - .ai_flags = AI_NUMERICHOST - }, *result = NULL; - + { + struct addrinfo hints, *result; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = af; + hints.ai_socktype = SOCK_STREAM; /* not really */ + hints.ai_protocol = IPPROTO_TCP; /* not really */ + hints.ai_flags = AI_NUMERICHOST; + { const int e = getaddrinfo (src, NULL, &hints, &result); if (0 != e) { return 0; /* error */ @@ -1207,6 +1210,8 @@ freeaddrinfo (result); return 1; /* success */ + } + } } PGM_GNUC_INTERNAL libpgm-5.1.118-1~dfsg/openpgm/pgm/aclocal.m40000644000175000017500000122705511644640130017412 0ustar locallocal# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3293 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4]) m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4' macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR libpgm-5.1.118-1~dfsg/openpgm/pgm/gcov-parse.pl0000755000175000017500000000150511640407354020152 0ustar locallocal#!/usr/bin/perl $type = ''; $target = ''; while (<>) { chomp; if (/^(Function|File) '(.+)'/) { $type = $1; $target = $2; } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/) { # print "$type,$target,$1,$2\n"; if ($type cmp 'File') { $files{$target} = $1; } else { $functions{$target} = $1; } } } #@sorted = sort { $files{$a} <=> $files{$b} } keys %files; #foreach $name (@sorted) #{ # print "$name:$files{$name}\n"; #} @sorted = sort { $functions{$a} <=> $functions{$b} } keys %functions; $total = 0; $count = 0; foreach $name (@sorted) { next if $name =~ m#^/#; next if $name =~ m#.+\.h$#; next if $name =~ m#_unittest\.c$#; print sprintf("%20s: %3.1f%%\n", $name, $functions{$name}); $total += $functions{$name}; $count++; } $total /= $count; print "\n TOTAL: ~" . int($total) . "%\n\n"; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/engine.c0000644000175000017500000001442211640407354017157 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM engine. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* getprotobyname_r */ #ifndef _BSD_SOURCE # define _BSD_SOURCE 1 #endif #ifndef _WIN32 # include #endif #include #include #include #include #include #include #include //#define ENGINE_DEBUG /* globals */ int pgm_ipproto_pgm PGM_GNUC_READ_MOSTLY = IPPROTO_PGM; #ifdef _WIN32 LPFN_WSARECVMSG pgm_WSARecvMsg PGM_GNUC_READ_MOSTLY = NULL; #endif #ifdef PGM_DEBUG unsigned pgm_loss_rate PGM_GNUC_READ_MOSTLY = 0; #endif /* locals */ static bool pgm_is_supported = FALSE; static volatile uint32_t pgm_ref_count = 0; #ifdef _WIN32 # ifndef WSAID_WSARECVMSG /* http://cvs.winehq.org/cvsweb/wine/include/mswsock.h */ # define WSAID_WSARECVMSG {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}} # endif #endif /* startup PGM engine, mainly finding PGM protocol definition, if any from NSS * * returns TRUE on success, returns FALSE if an error occurred, implying some form of * system re-configuration is required to resolve before trying again. * * NB: Valgrind loves generating errors in getprotobyname(). */ bool pgm_init ( pgm_error_t** error ) { if (pgm_atomic_exchange_and_add32 (&pgm_ref_count, 1) > 0) return TRUE; /* initialise dependent modules */ pgm_messages_init(); pgm_minor ("OpenPGM %d.%d.%d%s%s%s %s %s %s %s", pgm_major_version, pgm_minor_version, pgm_micro_version, pgm_build_revision ? " (" : "", pgm_build_revision ? pgm_build_revision : "", pgm_build_revision ? ")" : "", pgm_build_date, pgm_build_time, pgm_build_system, pgm_build_machine); pgm_thread_init(); pgm_mem_init(); pgm_rand_init(); #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; if (WSAStartup (wVersionRequested, &wsaData) != 0) { const int save_errno = WSAGetLastError (); pgm_set_error (error, PGM_ERROR_DOMAIN_ENGINE, pgm_error_from_wsa_errno (save_errno), _("WSAStartup failure: %s"), pgm_wsastrerror (save_errno)); goto err_shutdown; } if (LOBYTE (wsaData.wVersion) != 2 || HIBYTE (wsaData.wVersion) != 2) { WSACleanup(); pgm_set_error (error, PGM_ERROR_DOMAIN_ENGINE, PGM_ERROR_FAILED, _("WSAStartup failed to provide requested version 2.2.")); goto err_shutdown; } # ifndef CONFIG_TARGET_WINE /* find WSARecvMsg API */ if (NULL == pgm_WSARecvMsg) { GUID WSARecvMsg_GUID = WSAID_WSARECVMSG; DWORD cbBytesReturned; const SOCKET sock = socket (AF_INET, SOCK_DGRAM, 0); if (INVALID_SOCKET == sock) { WSACleanup(); pgm_set_error (error, PGM_ERROR_DOMAIN_ENGINE, PGM_ERROR_FAILED, _("Cannot open socket.")); goto err_shutdown; } if (SOCKET_ERROR == WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, &WSARecvMsg_GUID, sizeof(WSARecvMsg_GUID), &pgm_WSARecvMsg, sizeof(pgm_WSARecvMsg), &cbBytesReturned, NULL, NULL)) { closesocket (sock); WSACleanup(); pgm_set_error (error, PGM_ERROR_DOMAIN_ENGINE, PGM_ERROR_FAILED, _("WSARecvMsg function not found.")); goto err_shutdown; } pgm_debug ("Retrieved address of WSARecvMsg."); closesocket (sock); } # endif #endif /* _WIN32 */ /* find PGM protocol id overriding default value, use first value from NIS */ const struct pgm_protoent_t *proto = pgm_getprotobyname ("pgm"); if (proto != NULL) { if (proto->p_proto != pgm_ipproto_pgm) { pgm_minor (_("Setting PGM protocol number to %i from the protocols database."), proto->p_proto); pgm_ipproto_pgm = proto->p_proto; } } /* ensure timing enabled */ pgm_error_t* sub_error = NULL; if (!pgm_time_init (&sub_error)) { if (sub_error) pgm_propagate_error (error, sub_error); #ifdef _WIN32 WSACleanup(); #endif goto err_shutdown; } /* receiver simulated loss rate */ #ifdef PGM_DEBUG char* env; size_t envlen; const errno_t err = pgm_dupenv_s (&env, &envlen, "PGM_LOSS_RATE"); if (0 == err && envlen > 0) { const int loss_rate = atoi (env); if (loss_rate > 0 && loss_rate <= 100) { pgm_loss_rate = loss_rate; pgm_minor (_("Setting PGM packet loss rate to %i%%."), pgm_loss_rate); } pgm_free (env); } #endif /* create global sock list lock */ pgm_rwlock_init (&pgm_sock_list_lock); pgm_is_supported = TRUE; return TRUE; err_shutdown: pgm_rand_shutdown(); pgm_mem_shutdown(); pgm_thread_shutdown(); pgm_messages_shutdown(); pgm_atomic_dec32 (&pgm_ref_count); return FALSE; } /* returns TRUE if PGM engine has been initialized */ bool pgm_supported (void) { return ( pgm_is_supported == TRUE ); } /* returns TRUE on success, returns FALSE if an error occurred. */ bool pgm_shutdown (void) { /* cannot use pgm_return_val_if_fail() as logging may not be started */ if (0 == pgm_atomic_read32 (&pgm_ref_count)) return FALSE; if (pgm_atomic_exchange_and_add32 (&pgm_ref_count, (uint32_t)-1) != 1) return TRUE; pgm_is_supported = FALSE; /* destroy all open socks */ while (pgm_sock_list) { pgm_close ((pgm_sock_t*)pgm_sock_list->data, FALSE); } pgm_rwlock_free (&pgm_sock_list_lock); pgm_time_shutdown(); #ifdef _WIN32 WSACleanup(); #endif pgm_rand_shutdown(); pgm_mem_shutdown(); pgm_thread_shutdown(); pgm_messages_shutdown(); return TRUE; } /* helper to drop out of setuid 0 after creating PGM sockets */ void pgm_drop_superuser (void) { #ifndef _WIN32 if (0 == getuid()) { setuid((gid_t)65534); setgid((uid_t)65534); } #endif } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/inet_network.c.c89.patch0000644000175000017500000000410211640407354022114 0ustar locallocal--- inet_network.c 2011-03-12 10:13:27.000000000 +0800 +++ inet_network.c89.c 2011-03-12 10:41:57.000000000 +0800 @@ -112,13 +112,16 @@ //g_trace ("bit mask %i", val); /* zero out host bits */ - const struct in_addr netaddr = { .s_addr = cidr_to_netmask (val) }; + { + struct in_addr netaddr; + netaddr.s_addr = cidr_to_netmask (val); #ifdef INET_NETWORK_DEBUG { g_debug ("netaddr %s", inet_ntoa (netaddr)); } #endif in->s_addr &= netaddr.s_addr; + } return 0; } else if (*p == 'x' || *p == 'X') { /* skip number, e.g. 1.x.x.x */ @@ -223,11 +226,16 @@ pgm_debug ("subnet size %i", val); /* zero out host bits */ + { const unsigned suffix_length = 128 - val; - for (int i = suffix_length, j = 15; i > 0; i -= 8, --j) + { + int i, j; + for (i = suffix_length, j = 15; i > 0; i -= 8, --j) { in6->s6_addr[ j ] &= i >= 8 ? 0x00 : (unsigned)(( 0xffU << i ) & 0xffU ); } + } + } pgm_debug ("effective IPv6 network address after subnet mask: %s", pgm_inet_ntop(AF_INET6, in6, s2, sizeof(s2))); @@ -253,12 +261,12 @@ char s2[INET6_ADDRSTRLEN]; char *p2 = s2; unsigned val = 0; - struct addrinfo hints = { - .ai_family = AF_INET6, - .ai_socktype = SOCK_STREAM, /* not really */ - .ai_protocol = IPPROTO_TCP, /* not really */ - .ai_flags = AI_NUMERICHOST - }, *result = NULL; + struct addrinfo hints, *result = NULL; + + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_STREAM; /* not really */ + hints.ai_protocol = IPPROTO_TCP; /* not really */ + hints.ai_flags = AI_NUMERICHOST; pgm_return_val_if_fail (NULL != s, -1); pgm_return_val_if_fail (NULL != sa6, -1); @@ -318,11 +326,16 @@ pgm_debug ("subnet size %i", val); /* zero out host bits */ + { const unsigned suffix_length = 128 - val; - for (int i = suffix_length, j = 15; i > 0; i -= 8, --j) + { + int i, j; + for (i = suffix_length, j = 15; i > 0; i -= 8, --j) { sa6->sin6_addr.s6_addr[ j ] &= i >= 8 ? 0x00 : (unsigned)(( 0xffU << i ) & 0xffU ); } + } + } #ifdef INET_NETWORK_DEBUG pgm_sockaddr_ntop ((const struct sockaddr*)sa6, sdebug, sizeof(sdebug)); libpgm-5.1.118-1~dfsg/openpgm/pgm/queue.c0000644000175000017500000000456611640407354017046 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable double-ended queue. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include //#define QUEUE_DEBUG PGM_GNUC_INTERNAL bool pgm_queue_is_empty ( const pgm_queue_t*const queue ) { pgm_return_val_if_fail (queue != NULL, TRUE); return queue->head == NULL; } PGM_GNUC_INTERNAL void pgm_queue_push_head_link ( pgm_queue_t* restrict queue, pgm_list_t* restrict head_link ) { pgm_return_if_fail (queue != NULL); pgm_return_if_fail (head_link != NULL); pgm_return_if_fail (head_link->prev == NULL); pgm_return_if_fail (head_link->next == NULL); head_link->next = queue->head; if (queue->head) queue->head->prev = head_link; else queue->tail = head_link; queue->head = head_link; queue->length++; } PGM_GNUC_INTERNAL pgm_list_t* pgm_queue_pop_tail_link ( pgm_queue_t* queue ) { pgm_return_val_if_fail (queue != NULL, NULL); if (queue->tail) { pgm_list_t *node = queue->tail; queue->tail = node->prev; if (queue->tail) { queue->tail->next = NULL; node->prev = NULL; } else queue->head = NULL; queue->length--; return node; } return NULL; } PGM_GNUC_INTERNAL pgm_list_t* pgm_queue_peek_tail_link ( pgm_queue_t* queue ) { pgm_return_val_if_fail (queue != NULL, NULL); return queue->tail; } PGM_GNUC_INTERNAL void pgm_queue_unlink ( pgm_queue_t* restrict queue, pgm_list_t* restrict target_link ) { pgm_return_if_fail (queue != NULL); pgm_return_if_fail (target_link != NULL); if (target_link == queue->tail) queue->tail = queue->tail->prev; queue->head = pgm_list_remove_link (queue->head, target_link); queue->length--; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/README0000644000175000017500000000023511640407354016423 0ustar locallocalOpenPGM is a library implementing the PGM reliable multicast network protocol. For more information about OpenPGM, see: http://openpgm.googlecode.com/ libpgm-5.1.118-1~dfsg/openpgm/pgm/nametoindex.c.c89.patch0000644000175000017500000000372011640407354021724 0ustar locallocal--- nametoindex.c 2011-03-12 10:15:57.000000000 +0800 +++ nametoindex.c89.c 2011-03-12 10:45:53.000000000 +0800 @@ -78,6 +78,7 @@ pgm_assert (AF_INET6 != iffamily); + { DWORD dwRet, ifIndex; ULONG ulOutBufLen = DEFAULT_BUFFER_SIZE; PIP_ADAPTER_INFO pAdapterInfo = NULL; @@ -86,7 +87,9 @@ /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ - for (unsigned i = MAX_TRIES; i; i--) + { + unsigned i; + for (i = MAX_TRIES; i; i--) { pgm_debug ("IP_ADAPTER_INFO buffer length %lu bytes.", ulOutBufLen); pAdapterInfo = (IP_ADAPTER_INFO*)_pgm_heap_alloc (ulOutBufLen); @@ -98,6 +101,7 @@ break; } } + } switch (dwRet) { case ERROR_SUCCESS: /* NO_ERROR */ @@ -118,7 +122,9 @@ pAdapter; pAdapter = pAdapter->Next) { - for (IP_ADDR_STRING *pIPAddr = &pAdapter->IpAddressList; + { + IP_ADDR_STRING *pIPAddr; + for (pIPAddr = &pAdapter->IpAddressList; pIPAddr; pIPAddr = pIPAddr->Next) { @@ -132,11 +138,13 @@ return ifIndex; } } + } } if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); return 0; + } } /* Retrieve adapter index via name. @@ -155,6 +163,7 @@ { pgm_return_val_if_fail (NULL != ifname, 0); + { ULONG ifIndex; DWORD dwSize = DEFAULT_BUFFER_SIZE, dwRet; IP_ADAPTER_ADDRESSES *pAdapterAddresses = NULL, *adapter; @@ -172,7 +181,9 @@ /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ - for (unsigned i = MAX_TRIES; i; i--) + { + unsigned i; + for (i = MAX_TRIES; i; i--) { pAdapterAddresses = (IP_ADAPTER_ADDRESSES*)_pgm_heap_alloc (dwSize); dwRet = GetAdaptersAddresses (AF_UNSPEC, @@ -190,6 +201,7 @@ break; } } + } switch (dwRet) { case ERROR_SUCCESS: @@ -220,6 +232,7 @@ if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); return 0; + } } #endif /* _WIN32 */ libpgm-5.1.118-1~dfsg/openpgm/pgm/checksum_perftest.c0000644000175000017500000005607011640407354021435 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * performance tests for PGM checksum routines * * Copyright (c) 2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include /* mock state */ static unsigned perf_testsize = 0; static unsigned perf_answer = 0; static void mock_setup_100b (void) { perf_testsize = 100; perf_answer = 0x6ea8; } static void mock_setup_200b (void) { perf_testsize = 200; perf_answer = 0x86e1; } static void mock_setup_1500b (void) { perf_testsize = 1500; perf_answer = 0xec69; } static void mock_setup_9kb (void) { perf_testsize = 9000; perf_answer = 0x576e; } static void mock_setup_64kb (void) { perf_testsize = 65535; perf_answer = 0x3fc0; } /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } #define CHECKSUM_DEBUG #include "checksum.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } static void mock_setup (void) { g_assert (pgm_time_init (NULL)); } static void mock_teardown (void) { g_assert (pgm_time_shutdown ()); } /* target: * guint16 * pgm_inet_checksum ( * const void* src, * guint len, * int csum * ) */ START_TEST (test_8bit) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csum_8bit (source, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("8-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST /* checksum + memcpy */ START_TEST (test_8bit_memcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { memcpy (target, source, perf_testsize); csum = ~do_csum_8bit (target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("8-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST /* checksum & copy */ START_TEST (test_8bit_csumcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csumcpy_8bit (source, target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("8-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_16bit) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csum_16bit (source, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("16-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_16bit_memcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { memcpy (target, source, perf_testsize); csum = ~do_csum_16bit (target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("16-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_16bit_csumcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csumcpy_16bit (source, target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("16-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_32bit) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csum_32bit (source, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("32-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_32bit_memcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { memcpy (target, source, perf_testsize); csum = ~do_csum_32bit (target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("32-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_32bit_csumcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csumcpy_32bit (source, target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("32-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_64bit) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csum_64bit (source, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("64-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_64bit_memcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { memcpy (target, source, perf_testsize); csum = ~do_csum_64bit (target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("64-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_64bit_csumcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csumcpy_64bit (source, target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("64-bit/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) START_TEST (test_vector) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csum_vector (source, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("vector/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_vector_memcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { memcpy (target, source, perf_testsize); csum = ~do_csum_vector (target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("vector/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST START_TEST (test_vector_csumcpy) { const unsigned iterations = 1000; char* source = alloca (perf_testsize); char* target = alloca (perf_testsize); for (unsigned i = 0, j = 0; i < perf_testsize; i++) { j = j * 1103515245 + 12345; source[i] = j; } const guint16 answer = perf_answer; /* network order */ guint16 csum; pgm_time_t start, check; start = pgm_time_update_now(); for (unsigned i = iterations; i; i--) { csum = ~do_csumcpy_vector (source, target, perf_testsize, 0); /* function calculates answer in host order */ csum = g_htons (csum); fail_unless (answer == csum, "checksum mismatch 0x%04x (0x%04x)", csum, answer); } check = pgm_time_update_now(); g_message ("vector/%u: elapsed time %" PGM_TIME_FORMAT " us, unit time %" PGM_TIME_FORMAT " us", perf_testsize, (guint64)(check - start), (guint64)((check - start) / iterations)); } END_TEST #endif /* defined(__amd64) || defined(__x86_64__) || defined(_WIN64) */ static Suite* make_csum_performance_suite (void) { Suite* s; s = suite_create ("Raw checksum performance"); TCase* tc_100b = tcase_create ("100b"); suite_add_tcase (s, tc_100b); tcase_add_checked_fixture (tc_100b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_100b, mock_setup_100b, NULL); tcase_add_test (tc_100b, test_8bit); tcase_add_test (tc_100b, test_16bit); tcase_add_test (tc_100b, test_32bit); tcase_add_test (tc_100b, test_64bit); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_100b, test_vector); #endif TCase* tc_200b = tcase_create ("200b"); suite_add_tcase (s, tc_200b); tcase_add_checked_fixture (tc_200b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_200b, mock_setup_200b, NULL); tcase_add_test (tc_200b, test_8bit); tcase_add_test (tc_200b, test_16bit); tcase_add_test (tc_200b, test_32bit); tcase_add_test (tc_200b, test_64bit); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_200b, test_vector); #endif TCase* tc_1500b = tcase_create ("1500b"); suite_add_tcase (s, tc_1500b); tcase_add_checked_fixture (tc_1500b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_1500b, mock_setup_1500b, NULL); tcase_add_test (tc_1500b, test_8bit); tcase_add_test (tc_1500b, test_16bit); tcase_add_test (tc_1500b, test_32bit); tcase_add_test (tc_1500b, test_64bit); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_1500b, test_vector); #endif TCase* tc_9kb = tcase_create ("9KB"); suite_add_tcase (s, tc_9kb); tcase_add_checked_fixture (tc_9kb, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_9kb, mock_setup_9kb, NULL); tcase_add_test (tc_9kb, test_8bit); tcase_add_test (tc_9kb, test_16bit); tcase_add_test (tc_9kb, test_32bit); tcase_add_test (tc_9kb, test_64bit); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_9kb, test_vector); #endif TCase* tc_64kb = tcase_create ("64KB"); suite_add_tcase (s, tc_64kb); tcase_add_checked_fixture (tc_64kb, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_64kb, mock_setup_64kb, NULL); tcase_add_test (tc_64kb, test_8bit); tcase_add_test (tc_64kb, test_16bit); tcase_add_test (tc_64kb, test_32bit); tcase_add_test (tc_64kb, test_64bit); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_64kb, test_vector); #endif return s; } static Suite* make_csum_memcpy_performance_suite (void) { Suite* s; s = suite_create ("Checksum and memcpy performance"); TCase* tc_100b = tcase_create ("100b"); suite_add_tcase (s, tc_100b); tcase_add_checked_fixture (tc_100b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_100b, mock_setup_100b, NULL); tcase_add_test (tc_100b, test_8bit_memcpy); tcase_add_test (tc_100b, test_16bit_memcpy); tcase_add_test (tc_100b, test_32bit_memcpy); tcase_add_test (tc_100b, test_64bit_memcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_100b, test_vector_memcpy); #endif TCase* tc_200b = tcase_create ("200b"); suite_add_tcase (s, tc_200b); tcase_add_checked_fixture (tc_200b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_200b, mock_setup_200b, NULL); tcase_add_test (tc_200b, test_8bit_memcpy); tcase_add_test (tc_200b, test_16bit_memcpy); tcase_add_test (tc_200b, test_32bit_memcpy); tcase_add_test (tc_200b, test_64bit_memcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_200b, test_vector_memcpy); #endif TCase* tc_1500b = tcase_create ("1500b"); suite_add_tcase (s, tc_1500b); tcase_add_checked_fixture (tc_1500b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_1500b, mock_setup_1500b, NULL); tcase_add_test (tc_1500b, test_8bit_memcpy); tcase_add_test (tc_1500b, test_16bit_memcpy); tcase_add_test (tc_1500b, test_32bit_memcpy); tcase_add_test (tc_1500b, test_64bit_memcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_1500b, test_vector_memcpy); #endif TCase* tc_9kb = tcase_create ("9KB"); suite_add_tcase (s, tc_9kb); tcase_add_checked_fixture (tc_9kb, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_9kb, mock_setup_9kb, NULL); tcase_add_test (tc_9kb, test_8bit_memcpy); tcase_add_test (tc_9kb, test_16bit_memcpy); tcase_add_test (tc_9kb, test_32bit_memcpy); tcase_add_test (tc_9kb, test_64bit_memcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_9kb, test_vector_memcpy); #endif TCase* tc_64kb = tcase_create ("64KB"); suite_add_tcase (s, tc_64kb); tcase_add_checked_fixture (tc_64kb, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_64kb, mock_setup_64kb, NULL); tcase_add_test (tc_64kb, test_8bit_memcpy); tcase_add_test (tc_64kb, test_16bit_memcpy); tcase_add_test (tc_64kb, test_32bit_memcpy); tcase_add_test (tc_64kb, test_64bit_memcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_64kb, test_vector_memcpy); #endif return s; } static Suite* make_csumcpy_performance_suite (void) { Suite* s; s = suite_create ("Checksum copy performance"); TCase* tc_100b = tcase_create ("100b"); suite_add_tcase (s, tc_100b); tcase_add_checked_fixture (tc_100b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_100b, mock_setup_100b, NULL); tcase_add_test (tc_100b, test_8bit_csumcpy); tcase_add_test (tc_100b, test_16bit_csumcpy); tcase_add_test (tc_100b, test_32bit_csumcpy); tcase_add_test (tc_100b, test_64bit_csumcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_100b, test_vector_csumcpy); #endif TCase* tc_200b = tcase_create ("200b"); suite_add_tcase (s, tc_200b); tcase_add_checked_fixture (tc_200b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_200b, mock_setup_200b, NULL); tcase_add_test (tc_200b, test_8bit_csumcpy); tcase_add_test (tc_200b, test_16bit_csumcpy); tcase_add_test (tc_200b, test_32bit_csumcpy); tcase_add_test (tc_200b, test_64bit_csumcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_200b, test_vector_csumcpy); #endif TCase* tc_1500b = tcase_create ("1500b"); suite_add_tcase (s, tc_1500b); tcase_add_checked_fixture (tc_1500b, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_1500b, mock_setup_1500b, NULL); tcase_add_test (tc_1500b, test_8bit_csumcpy); tcase_add_test (tc_1500b, test_16bit_csumcpy); tcase_add_test (tc_1500b, test_32bit_csumcpy); tcase_add_test (tc_1500b, test_64bit_csumcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_1500b, test_vector_csumcpy); #endif TCase* tc_9kb = tcase_create ("9KB"); suite_add_tcase (s, tc_9kb); tcase_add_checked_fixture (tc_9kb, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_9kb, mock_setup_9kb, NULL); tcase_add_test (tc_9kb, test_8bit_csumcpy); tcase_add_test (tc_9kb, test_16bit_csumcpy); tcase_add_test (tc_9kb, test_32bit_csumcpy); tcase_add_test (tc_9kb, test_64bit_csumcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_9kb, test_vector_csumcpy); #endif TCase* tc_64kb = tcase_create ("64KB"); suite_add_tcase (s, tc_64kb); tcase_add_checked_fixture (tc_64kb, mock_setup, mock_teardown); tcase_add_checked_fixture (tc_64kb, mock_setup_64kb, NULL); tcase_add_test (tc_64kb, test_8bit_csumcpy); tcase_add_test (tc_64kb, test_16bit_csumcpy); tcase_add_test (tc_64kb, test_32bit_csumcpy); tcase_add_test (tc_64kb, test_64bit_csumcpy); #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) tcase_add_test (tc_64kb, test_vector_csumcpy); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_csum_performance_suite ()); srunner_add_suite (sr, make_csum_memcpy_performance_suite ()); srunner_add_suite (sr, make_csumcpy_performance_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/signal.c0000644000175000017500000000747111640407354017175 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Re-entrant safe signal handling. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include #include /* _GNU_SOURCE for strsignal() */ #include #ifndef G_OS_WIN32 # include #else # include #endif #include #include "pgm/signal.h" //#define SIGNAL_DEBUG /* globals */ static pgm_sighandler_t signal_list[NSIG]; static int signal_pipe[2]; static GIOChannel* signal_io = NULL; static void on_signal (int); static gboolean on_io_signal (GIOChannel*, GIOCondition, gpointer); static const char* cond_string (GIOCondition); static void set_nonblock ( const int s, const gboolean v ) { #ifndef G_OS_WIN32 int flags = fcntl (s, F_GETFL); if (!v) flags &= ~O_NONBLOCK; else flags |= O_NONBLOCK; fcntl (s, F_SETFL, flags); #else u_long mode = v; ioctlsocket (s, FIONBIO, &mode); #endif } /* install signal handler and return unix fd to add to event loop */ gboolean pgm_signal_install ( int signum, pgm_sighandler_t handler, gpointer user_data ) { g_debug ("pgm_signal_install (signum:%d handler:%p user_data:%p)", signum, (const void*)handler, user_data); if (NULL == signal_io) { #ifdef G_OS_UNIX if (pipe (signal_pipe)) #else if (_pipe (signal_pipe, 4096, _O_BINARY | _O_NOINHERIT)) #endif return FALSE; set_nonblock (signal_pipe[0], TRUE); set_nonblock (signal_pipe[1], TRUE); /* add to evm */ signal_io = g_io_channel_unix_new (signal_pipe[0]); g_io_add_watch (signal_io, G_IO_IN, on_io_signal, user_data); } signal_list[signum] = handler; return (SIG_ERR != signal (signum, on_signal)); } /* process signal from operating system */ static void on_signal ( int signum ) { g_debug ("on_signal (signum:%d)", signum); if (write (signal_pipe[1], &signum, sizeof(signum)) != sizeof(signum)) { #ifndef G_OS_WIN32 g_warning ("Unix signal %s (%d) lost", strsignal (signum), signum); #else g_warning ("Unix signal (%d) lost", signum); #endif } } /* process signal from pipe */ static gboolean on_io_signal ( GIOChannel* source, GIOCondition cond, gpointer user_data ) { /* pre-conditions */ g_assert (NULL != source); g_assert (G_IO_IN == cond); g_debug ("on_io_signal (source:%p cond:%s user_data:%p)", (gpointer)source, cond_string (cond), user_data); int signum; const gsize bytes_read = read (g_io_channel_unix_get_fd (source), &signum, sizeof(signum)); if (sizeof(signum) == bytes_read) { signal_list[signum] (signum, user_data); } else { g_warning ("Lost data in signal pipe, read %" G_GSIZE_FORMAT " byte%s expected %" G_GSIZE_FORMAT ".", bytes_read, bytes_read > 1 ? "s" : "", sizeof(signum)); } return TRUE; } static const char* cond_string ( GIOCondition cond ) { const char* c; switch (cond) { case G_IO_IN: c = "G_IO_IN"; break; case G_IO_OUT: c = "G_IO_OUT"; break; case G_IO_PRI: c = "G_IO_PRI"; break; case G_IO_ERR: c = "G_IO_ERR"; break; case G_IO_HUP: c = "G_IO_HUP"; break; case G_IO_NVAL: c = "G_IO_NVAL"; break; default: c = "(unknown)"; break; } return c; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.mingw-wine0000644000175000017500000002411211640407354021655 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-Wine-' + platform.machine()); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('COVERAGE', 'test coverage', 'none', allowed_values=('none', 'full')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies def force_mingw(env): env.Tool('crossmingw', toolpath=['.']); env = Environment(); force_mingw(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_GNU_SOURCE', '-D_WIN32_WINNT=0x0501', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks # '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only # '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header # '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing # '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling # '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration # '-DCONFIG_HAVE_GETIFADDRS', # '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg '-DCONFIG_HAVE_WSACMSGHDR', # multicast # '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf # '-DCONFIG_HAVE_SPRINTF_GROUPING', # '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support '-DCONFIG_TARGET_WINE', # GNU getopt # '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ 'iphlpapi.lib', 'ws2_32.lib', 'winmm.lib' ] ) force_mingw(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = ['-gdb']) profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --cflags --libs glib-2.0 gthread-2.0'); env.MergeFlags('-Iwin/include -Lwin/lib'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp env['SNMP_FLAGS'] = { 'CCFLAGS' : [], 'LIBS' : [ 'netsnmpagent', 'netsnmpmibs', 'netsnmphelpers', 'netsnmp' ], }; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); lastLIBS = context.env['LIBS']; lastCCFLAGS= context.env['CCFLAGS']; context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); context.env.Replace(LIBS = lastLIBS, CCFLAGS=lastCCFLAGS); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Enabling extra Red Hat dependencies for Net-SNMP.'; conf.env['SNMP_FLAGS']['LIBS'].append(['librpm', 'libsensors', 'libdl', 'libwrap']); lastLIBS = conf.env['LIBS']; conf.env.ParseConfig('perl -MExtUtils::Embed -e ldopts'); conf.env['SNMP_FLAGS']['LIBS'].append(conf.env['LIBS']); conf.env.Replace(LIBS = lastLIBS); if not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-Wine-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/config.sub0000755000175000017500000007746011640410424017534 0ustar locallocal#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-09-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libpgm-5.1.118-1~dfsg/openpgm/pgm/memcheck0000755000175000017500000000034411640407354017246 0ustar locallocal#!/bin/sh G_SLICE=always-malloc \ G_DEBUG=gc-friendly \ valgrind \ -v \ --tool=memcheck \ --leak-check=full \ --num-callers=40 \ --gen-suppressions=no \ --show-reachable=yes \ --suppressions=valgrind.supp \ $* libpgm-5.1.118-1~dfsg/openpgm/pgm/socket.c0000644000175000017500000023673511640407354017217 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM socket: manage incoming & outgoing sockets with ambient SPMs, * transmit & receive windows. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #ifdef CONFIG_HAVE_POLL # include #endif #ifdef CONFIG_HAVE_EPOLL # include #endif #include #include #include #include #include #include #include //#define SOCK_DEBUG //#define SOCK_SPM_DEBUG /* global locals */ pgm_rwlock_t pgm_sock_list_lock; /* list of all sockets for admin interfaces */ pgm_slist_t* pgm_sock_list = NULL; static const char* pgm_family_string (const int) PGM_GNUC_CONST; static const char* pgm_sock_type_string (const int) PGM_GNUC_CONST; static const char* pgm_protocol_string (const int) PGM_GNUC_CONST; size_t pgm_pkt_offset ( bool can_fragment, sa_family_t pgmcc_family /* 0 = disable */ ) { const size_t data_size = sizeof(struct pgm_header) + sizeof(struct pgm_data); size_t pkt_size = data_size; if (can_fragment || (0 != pgmcc_family)) pkt_size += sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header); if (can_fragment) pkt_size += sizeof(struct pgm_opt_fragment); if (AF_INET == pgmcc_family) pkt_size += sizeof(struct pgm_opt_pgmcc_data); else if (AF_INET6 == pgmcc_family) pkt_size += sizeof(struct pgm_opt6_pgmcc_data); return pkt_size; } #ifdef _MSC_VER /* How to Determine Whether a Process or Thread Is Running As an Administrator * http://msdn.microsoft.com/en-us/windows/ff420334.aspx */ static BOOL IsElevatedAdministrator (HANDLE hInputToken) { BOOL fIsAdmin = FALSE; HANDLE hTokenToCheck = NULL; DWORD sidLen = SECURITY_MAX_SID_SIZE; BYTE localAdminsGroupSid[SECURITY_MAX_SID_SIZE]; // If the caller supplies a token, duplicate it as an impersonation token, // because CheckTokenMembership requires an impersonation token. if (hInputToken && !DuplicateToken (hInputToken, SecurityIdentification, &hTokenToCheck)) { goto CLEANUP; } if (!CreateWellKnownSid (WinBuiltinAdministratorsSid, NULL, localAdminsGroupSid, &sidLen)) goto CLEANUP; // Now, determine whether the user is an administrator. CheckTokenMembership (hTokenToCheck, localAdminsGroupSid, &fIsAdmin); CLEANUP: // Close the impersonation token only if we opened it. if (hTokenToCheck) { CloseHandle (hTokenToCheck); hTokenToCheck = NULL; } return (fIsAdmin); } static BOOL IsMemberOfAdministratorsGroup (HANDLE hInputToken) { BOOL fIsAdmin = FALSE; HANDLE hTokenToCheck = NULL; HANDLE hToken = hInputToken; OSVERSIONINFO osver; DWORD sidLen = SECURITY_MAX_SID_SIZE; BYTE localAdminsGroupSid[SECURITY_MAX_SID_SIZE]; // If the caller didn't supply a token, open the current thread's token // (if present) or the token of the current process otherwise. if (!hToken && !OpenThreadToken (GetCurrentThread(), TOKEN_QUERY | TOKEN_DUPLICATE, TRUE, &hToken) && !OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY | TOKEN_DUPLICATE, &hToken)) { goto CLEANUP; } /* Determine whether the system is running Windows Vista or later * (major version >= 6) because they support linked tokens, but previous * versions do not. If running Windows Vista or later and the token is a * limited token, get its linked token and check it. Otherwise, just * check the token we have. */ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx (&osver)) goto CLEANUP; if (osver.dwMajorVersion >= 6) { TOKEN_ELEVATION_TYPE elevType; DWORD cbSize; if (!GetTokenInformation (hToken, TokenElevationType, &elevType, sizeof(TOKEN_ELEVATION_TYPE), &cbSize)) goto CLEANUP; if (TokenElevationTypeLimited == elevType && !GetTokenInformation (hToken, TokenLinkedToken, &hTokenToCheck, sizeof(HANDLE), &cbSize)) goto CLEANUP; } /* CheckTokenMembership requires an impersonation token. If we just got a * linked token, it already is an impersonation token. If we didn't get a * linked token, duplicate the original as an impersonation token for * CheckTokenMembership. */ if (!hTokenToCheck && !DuplicateToken (hToken, SecurityIdentification, &hTokenToCheck)) { goto CLEANUP; } if (!CreateWellKnownSid (WinBuiltinAdministratorsSid, NULL, localAdminsGroupSid, &sidLen)) { goto CLEANUP; } // Now, determine whether the user is an administrator. CheckTokenMembership (hTokenToCheck, localAdminsGroupSid, &fIsAdmin); CLEANUP: // Close the thread/process token handle only if we opened it. We open // a token handle only when a caller passes NULL in the hInputToken // parameter. if (!hInputToken && hToken) { CloseHandle (hToken); hToken = NULL; // Set variable to same state as resource. } if (hTokenToCheck) { CloseHandle (hTokenToCheck); hTokenToCheck = NULL; } return (fIsAdmin); } #endif /* _MSC_VER */ /* destroy a pgm_sock object and contents, if last sock also destroy * associated event loop * * outstanding locks: * 1) pgm_sock_t::lock * 2) pgm_sock_t::receiver_mutex * 3) pgm_sock_t::source_mutex * 4) pgm_sock_t::txw_spinlock * 5) pgm_sock_t::timer_mutex * * If application calls a function on the sock after destroy() it is a * programmer error: segv likely to occur on unlock. * * on success, returns TRUE, on failure returns FALSE. */ bool pgm_close ( pgm_sock_t* sock, bool flush ) { pgm_return_val_if_fail (sock != NULL, FALSE); if (!pgm_rwlock_reader_trylock (&sock->lock)) pgm_return_val_if_reached (FALSE); pgm_return_val_if_fail (!sock->is_destroyed, FALSE); pgm_debug ("pgm_sock_destroy (sock:%p flush:%s)", (const void*)sock, flush ? "TRUE":"FALSE"); /* flag existing calls */ sock->is_destroyed = TRUE; /* cancel running blocking operations */ if (INVALID_SOCKET != sock->recv_sock) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Closing receive socket.")); closesocket (sock->recv_sock); sock->recv_sock = INVALID_SOCKET; } if (INVALID_SOCKET != sock->send_sock) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Closing send socket.")); closesocket (sock->send_sock); sock->send_sock = INVALID_SOCKET; } pgm_rwlock_reader_unlock (&sock->lock); pgm_debug ("blocking on destroy lock ..."); pgm_rwlock_writer_lock (&sock->lock); pgm_debug ("removing sock from inventory."); pgm_rwlock_writer_lock (&pgm_sock_list_lock); pgm_sock_list = pgm_slist_remove (pgm_sock_list, sock); pgm_rwlock_writer_unlock (&pgm_sock_list_lock); /* flush source side by sending heartbeat SPMs */ if (sock->can_send_data && sock->is_connected && flush) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Flushing PGM source with session finish option broadcast SPMs.")); if (!pgm_send_spm (sock, PGM_OPT_FIN) || !pgm_send_spm (sock, PGM_OPT_FIN) || !pgm_send_spm (sock, PGM_OPT_FIN)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Failed to send flushing SPMs.")); } } if (sock->peers_hashtable) { pgm_debug ("destroying peer lookup table."); pgm_hashtable_destroy (sock->peers_hashtable); sock->peers_hashtable = NULL; } if (sock->peers_list) { pgm_debug ("destroying peer list."); do { pgm_list_t* next = sock->peers_list->next; pgm_peer_unref ((pgm_peer_t*)sock->peers_list->data); sock->peers_list = next; } while (sock->peers_list); } if (sock->window) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Destroying transmit window.")); pgm_txw_shutdown (sock->window); sock->window = NULL; } pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Destroying rate control.")); pgm_rate_destroy (&sock->rate_control); if (INVALID_SOCKET != sock->send_with_router_alert_sock) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Closing send with router alert socket.")); closesocket (sock->send_with_router_alert_sock); sock->send_with_router_alert_sock = INVALID_SOCKET; } if (sock->spm_heartbeat_interval) { pgm_debug ("freeing SPM heartbeat interval data."); pgm_free (sock->spm_heartbeat_interval); sock->spm_heartbeat_interval = NULL; } if (sock->rx_buffer) { pgm_debug ("freeing receive buffer."); pgm_free_skb (sock->rx_buffer); sock->rx_buffer = NULL; } pgm_debug ("destroying notification channels."); if (sock->can_send_data) { if (sock->use_pgmcc) { pgm_notify_destroy (&sock->ack_notify); } pgm_notify_destroy (&sock->rdata_notify); } pgm_notify_destroy (&sock->pending_notify); pgm_debug ("freeing sock locks."); pgm_rwlock_free (&sock->peers_lock); pgm_spinlock_free (&sock->txw_spinlock); pgm_mutex_free (&sock->send_mutex); pgm_mutex_free (&sock->timer_mutex); pgm_mutex_free (&sock->source_mutex); pgm_mutex_free (&sock->receiver_mutex); pgm_rwlock_writer_unlock (&sock->lock); pgm_rwlock_free (&sock->lock); pgm_debug ("freeing sock data."); pgm_free (sock); pgm_debug ("finished."); return TRUE; } /* Create a pgm_sock object. Create sockets that require superuser * priviledges. If interface ports are specified then UDP encapsulation will * be used instead of raw protocol. * * If send == recv only two sockets need to be created iff ip headers are not * required (IPv6). * * All receiver addresses must be the same family. * interface and multiaddr must be the same family. * family cannot be AF_UNSPEC! * * returns TRUE on success, or FALSE on error and sets error appropriately. */ #if ( AF_INET != PF_INET ) || ( AF_INET6 != PF_INET6 ) #error AF_INET and PF_INET are different values, the bananas are jumping in their pyjamas! #endif bool pgm_socket ( pgm_sock_t** restrict sock, const sa_family_t family, /* communications domain */ const int pgm_sock_type, const int protocol, pgm_error_t** restrict error ) { pgm_sock_t* new_sock; int socket_type; pgm_return_val_if_fail (NULL != sock, FALSE); pgm_return_val_if_fail (AF_INET == family || AF_INET6 == family, FALSE); pgm_return_val_if_fail (SOCK_SEQPACKET == pgm_sock_type, FALSE); pgm_return_val_if_fail (IPPROTO_UDP == protocol || IPPROTO_PGM == protocol, FALSE); pgm_debug ("socket (sock:%p family:%s sock-type:%s protocol:%s error:%p)", (const void*)sock, pgm_family_string(family), pgm_sock_type_string(pgm_sock_type), pgm_protocol_string(protocol), (const void*)error); new_sock = pgm_new0 (pgm_sock_t, 1); new_sock->family = family; new_sock->socket_type = pgm_sock_type; new_sock->protocol = protocol; new_sock->can_send_data = TRUE; new_sock->can_send_nak = TRUE; new_sock->can_recv_data = TRUE; new_sock->dport = DEFAULT_DATA_DESTINATION_PORT; new_sock->tsi.sport = DEFAULT_DATA_SOURCE_PORT; new_sock->adv_mode = 0; /* advance with time */ /* PGMCC */ new_sock->acker_nla.ss_family = family; /* source-side */ pgm_mutex_init (&new_sock->source_mutex); /* transmit window */ pgm_spinlock_init (&new_sock->txw_spinlock); /* send socket */ pgm_mutex_init (&new_sock->send_mutex); /* next timer & spm expiration */ pgm_mutex_init (&new_sock->timer_mutex); /* receiver-side */ pgm_mutex_init (&new_sock->receiver_mutex); /* peer hash map & list lock */ pgm_rwlock_init (&new_sock->peers_lock); /* destroy lock */ pgm_rwlock_init (&new_sock->lock); /* open sockets to implement PGM */ if (IPPROTO_UDP == new_sock->protocol) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Opening UDP encapsulated sockets.")); socket_type = SOCK_DGRAM; new_sock->udp_encap_ucast_port = DEFAULT_UDP_ENCAP_UCAST_PORT; new_sock->udp_encap_mcast_port = DEFAULT_UDP_ENCAP_MCAST_PORT; } else { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Opening raw sockets.")); socket_type = SOCK_RAW; } if ((new_sock->recv_sock = socket (new_sock->family, socket_type, new_sock->protocol)) == INVALID_SOCKET) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Creating receive socket: %s(%d)"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno), save_errno); #ifndef _WIN32 if (EPERM == save_errno) { pgm_error (_("PGM protocol requires CAP_NET_RAW capability, e.g. sudo execcap 'cap_net_raw=ep'")); } #else if (WSAEACCES == save_errno) { # ifdef _MSC_VER if (IsMemberOfAdministratorsGroup (NULL)) { if (!IsElevatedAdministrator (NULL)) pgm_error (_("PGM protocol requires approved process elevation via UAC.")); /* otherwise unknown permission error, fall through */ } else { pgm_error (_("PGM protocol requires membership of the Administrators group.")); } # else pgm_error (_("PGM protocol requires membership of the Administrators group and approved process elevation if UAC is enabled.")); # endif /* _MSC_VER */ } #endif goto err_destroy; } /* receive socket must always be non-blocking */ pgm_sockaddr_nonblocking (new_sock->recv_sock, TRUE); if ((new_sock->send_sock = socket (new_sock->family, socket_type, new_sock->protocol)) == INVALID_SOCKET) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Creating send socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } if ((new_sock->send_with_router_alert_sock = socket (new_sock->family, socket_type, new_sock->protocol)) == INVALID_SOCKET) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Creating IP Router Alert (RFC 2113) send socket: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } if (IPPROTO_UDP == new_sock->protocol) { /* Stevens: "SO_REUSEADDR has datatype int." */ pgm_trace (PGM_LOG_ROLE_NETWORK,_("Set socket sharing.")); const int v = 1; #ifndef SO_REUSEPORT if (SOCKET_ERROR == setsockopt (new_sock->recv_sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&v, sizeof(v)) || SOCKET_ERROR == setsockopt (new_sock->send_sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&v, sizeof(v)) || SOCKET_ERROR == setsockopt (new_sock->send_with_router_alert_sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&v, sizeof(v))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Enabling reuse of socket local address: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } #else if (SOCKET_ERROR == setsockopt (new_sock->recv_sock, SOL_SOCKET, SO_REUSEPORT, (const char*)&v, sizeof(v)) || SOCKET_ERROR == setsockopt (new_sock->send_sock, SOL_SOCKET, SO_REUSEPORT, (const char*)&v, sizeof(v)) || SOCKET_ERROR == setsockopt (new_sock->send_with_router_alert_sock, SOL_SOCKET, SO_REUSEPORT, (const char*)&v, sizeof(v))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Enabling reuse of duplicate socket address and port bindings: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } #endif /* request extra packet information to determine destination address on each packet */ #ifndef CONFIG_TARGET_WINE pgm_trace (PGM_LOG_ROLE_NETWORK,_("Request socket packet-info.")); const sa_family_t recv_family = new_sock->family; if (SOCKET_ERROR == pgm_sockaddr_pktinfo (new_sock->recv_sock, recv_family, TRUE)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Enabling receipt of ancillary information per incoming packet: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } #endif } else { const sa_family_t recv_family = new_sock->family; if (AF_INET == recv_family) { /* include IP header only for incoming data, only works for IPv4 */ pgm_trace (PGM_LOG_ROLE_NETWORK,_("Request IP headers.")); if (SOCKET_ERROR == pgm_sockaddr_hdrincl (new_sock->recv_sock, recv_family, TRUE)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Enabling IP header in front of user data: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } } else { pgm_assert (AF_INET6 == recv_family); pgm_trace (PGM_LOG_ROLE_NETWORK,_("Request socket packet-info.")); if (SOCKET_ERROR == pgm_sockaddr_pktinfo (new_sock->recv_sock, recv_family, TRUE)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Enabling receipt of control message per incoming datagram: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } } } *sock = new_sock; pgm_rwlock_writer_lock (&pgm_sock_list_lock); pgm_sock_list = pgm_slist_append (pgm_sock_list, *sock); pgm_rwlock_writer_unlock (&pgm_sock_list_lock); pgm_debug ("PGM socket successfully created."); return TRUE; err_destroy: if (INVALID_SOCKET != new_sock->recv_sock) { if (SOCKET_ERROR == closesocket (new_sock->recv_sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Close on receive socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } new_sock->recv_sock = INVALID_SOCKET; } if (INVALID_SOCKET != new_sock->send_sock) { if (SOCKET_ERROR == closesocket (new_sock->send_sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Close on send socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } new_sock->send_sock = INVALID_SOCKET; } if (INVALID_SOCKET != new_sock->send_with_router_alert_sock) { if (SOCKET_ERROR == closesocket (new_sock->send_with_router_alert_sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_warn (_("Close on IP Router Alert (RFC 2113) send socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } new_sock->send_with_router_alert_sock = INVALID_SOCKET; } pgm_free (new_sock); return FALSE; } bool pgm_getsockopt ( pgm_sock_t* const restrict sock, const int level, /* always IPPROTO_PGM */ const int optname, void* restrict optval, socklen_t* restrict optlen /* required */ ) { bool status = FALSE; pgm_return_val_if_fail (sock != NULL, status); pgm_return_val_if_fail (IPPROTO_PGM == level || SOL_SOCKET == level, status); pgm_return_val_if_fail (optval != NULL, status); pgm_return_val_if_fail (optlen != NULL, status); if (PGM_UNLIKELY(!pgm_rwlock_reader_trylock (&sock->lock))) pgm_return_val_if_reached (status); if (PGM_UNLIKELY(sock->is_destroyed)) { pgm_rwlock_reader_unlock (&sock->lock); return status; } switch (level) { case SOL_SOCKET: switch (optname) { /* socket send buffer, only read one socket as both should match */ case SO_SNDBUF: if (SOCKET_ERROR == getsockopt (sock->send_sock, SOL_SOCKET, SO_SNDBUF, optval, optlen)) break; status = TRUE; break; /* socket receive buffer */ case SO_RCVBUF: if (SOCKET_ERROR == getsockopt (sock->recv_sock, SOL_SOCKET, SO_RCVBUF, optval, optlen)) break; status = TRUE; break; default: break; } break; case IPPROTO_PGM: switch (optname) { /** read-only options **/ /* maximum segment size for unfragmented APDU */ case PGM_MSSS: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->max_tsdu; status = TRUE; break; /* maximum segment size for fragmented APDU */ case PGM_MSS: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->max_tsdu_fragment; status = TRUE; break; /* maximum payload size for an APDU */ case PGM_PDU: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->max_apdu; status = TRUE; break; /* send socket */ case PGM_SEND_SOCK: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (SOCKET))) break; *(SOCKET*restrict)optval = sock->send_sock; status = TRUE; break; /* receive socket */ case PGM_RECV_SOCK: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (SOCKET))) break; *(SOCKET*restrict)optval = sock->recv_sock; status = TRUE; break; /* repair socket */ case PGM_REPAIR_SOCK: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (SOCKET))) break; *(SOCKET*restrict)optval = pgm_notify_get_socket (&sock->rdata_notify); status = TRUE; break; /* pending socket */ case PGM_PENDING_SOCK: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (SOCKET))) break; *(SOCKET*restrict)optval = pgm_notify_get_socket (&sock->pending_notify); status = TRUE; break; /* ACK or congestion socket */ case PGM_ACK_SOCK: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (SOCKET))) break; if (PGM_UNLIKELY(!sock->use_pgmcc)) break; *(SOCKET*restrict)optval = pgm_notify_get_socket (&sock->ack_notify); status = TRUE; break; /* timeout for pending timer */ case PGM_TIME_REMAIN: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (struct timeval))) break; { struct timeval* tv = optval; const long usecs = (long)pgm_timer_expiration (sock); tv->tv_sec = usecs / 1000000L; tv->tv_usec = usecs % 1000000L; } status = TRUE; break; /* timeout for blocking sends */ case PGM_RATE_REMAIN: if (PGM_UNLIKELY(!sock->is_connected)) break; if (PGM_UNLIKELY(*optlen != sizeof (struct timeval))) break; { struct timeval* tv = optval; const long usecs = (long)pgm_rate_remaining2 (&sock->rate_control, &sock->odata_rate_control, sock->blocklen); tv->tv_sec = usecs / 1000000L; tv->tv_usec = usecs % 1000000L; } status = TRUE; break; /** read-write options **/ /* maximum transmission packet size */ case PGM_MTU: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->max_tpdu; status = TRUE; break; case PGM_AMBIENT_SPM: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->spm_ambient_interval; status = TRUE; break; case PGM_HEARTBEAT_SPM: if (PGM_UNLIKELY(*optlen < (socklen_t)(sock->spm_heartbeat_len * sizeof (int)))) break; { int*restrict intervals = (int*restrict)optval; *optlen = sock->spm_heartbeat_len; for (unsigned i = 0; i < sock->spm_heartbeat_len; i++) intervals[i] = sock->spm_heartbeat_interval[i + 1]; } status = TRUE; break; case PGM_TXW_BYTES: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; if (!sock->is_bound) break; *(int*restrict)optval = (int)(pgm_txw_max_length (sock->window) * sock->max_tpdu); status = TRUE; break; case PGM_TXW_SQNS: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; if (sock->is_bound) *(int*restrict)optval = (int)pgm_txw_max_length (sock->window); else *(int*restrict)optval = sock->txw_sqns; status = TRUE; break; case PGM_TXW_SECS: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; /* TXW_SECS is unknown if rate is not defined */ if (sock->is_bound && (0 == sock->txw_max_rte)) break; if (sock->is_bound) *(int*restrict)optval = (int)((pgm_txw_max_length (sock->window) * sock->max_tpdu) / sock->txw_max_rte); else *(int*restrict)optval = sock->txw_secs; status = TRUE; break; case PGM_TXW_MAX_RTE: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->txw_max_rte; status = TRUE; break; case PGM_ODATA_MAX_RTE: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->odata_max_rte; status = TRUE; break; case PGM_RDATA_MAX_RTE: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->rdata_max_rte; status = TRUE; break; case PGM_UNCONTROLLED_ODATA: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->is_controlled_odata ? 0 : 1; status = TRUE; break; case PGM_UNCONTROLLED_RDATA: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->is_controlled_rdata ? 0 : 1; status = TRUE; break; case PGM_PEER_EXPIRY: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->peer_expiry; status = TRUE; break; case PGM_SPMR_EXPIRY: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->spmr_expiry; status = TRUE; break; case PGM_RXW_BYTES: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; if (!sock->is_bound) break; { const unsigned rxw_sqns = sock->rxw_sqns ? sock->rxw_sqns : (unsigned)( (sock->rxw_secs * sock->rxw_max_rte) / sock->max_tpdu ); *(int*restrict)optval = rxw_sqns * sock->max_tpdu; } status = TRUE; break; case PGM_RXW_SQNS: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; if (sock->is_bound) { const unsigned rxw_sqns = sock->rxw_sqns ? sock->rxw_sqns : (unsigned)( (sock->rxw_secs * sock->rxw_max_rte) / sock->max_tpdu ); *(int*restrict)optval = rxw_sqns; } else { *(int*restrict)optval = sock->rxw_sqns; } status = TRUE; break; case PGM_RXW_SECS: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; /* RXW_SECS is unknown if rate is not defined */ if (sock->is_bound && (0 == sock->rxw_max_rte)) break; if (sock->is_bound) { const unsigned rxw_sqns = sock->rxw_sqns ? sock->rxw_sqns : (unsigned)( (sock->rxw_secs * sock->rxw_max_rte) / sock->max_tpdu ); *(int*restrict)optval = (int)((rxw_sqns * sock->max_tpdu) / sock->rxw_max_rte); } else { *(int*restrict)optval = sock->rxw_secs; } status = TRUE; break; case PGM_RXW_MAX_RTE: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->rxw_max_rte; status = TRUE; break; case PGM_NAK_BO_IVL: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->nak_bo_ivl; status = TRUE; break; case PGM_NAK_RPT_IVL: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->nak_rpt_ivl; status = TRUE; break; case PGM_NAK_RDATA_IVL: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->nak_rdata_ivl; status = TRUE; break; case PGM_NAK_DATA_RETRIES: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->nak_data_retries; status = TRUE; break; case PGM_NAK_NCF_RETRIES: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->nak_ncf_retries; status = TRUE; break; case PGM_USE_FEC: if (PGM_UNLIKELY(*optlen != sizeof (struct pgm_fecinfo_t))) break; { struct pgm_fecinfo_t*restrict fecinfo = optval; fecinfo->ondemand_parity_enabled = sock->use_ondemand_parity; fecinfo->var_pktlen_enabled = sock->use_var_pktlen; fecinfo->block_size = sock->rs_n; fecinfo->group_size = sock->rs_k; fecinfo->proactive_packets = sock->rs_proactive_h; } status = TRUE; break; case PGM_USE_CR: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = (int)sock->crqst_ivl; status = TRUE; break; case PGM_USE_PGMCC: if (PGM_UNLIKELY(*optlen != sizeof (struct pgm_pgmccinfo_t))) break; { struct pgm_pgmccinfo_t*restrict pgmccinfo = optval; pgmccinfo->ack_bo_ivl = (int)sock->ack_bo_ivl; pgmccinfo->ack_c = sock->ack_c; pgmccinfo->ack_c_p = sock->ack_c_p; } status = TRUE; break; case PGM_SEND_ONLY: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->can_recv_data ? 0 : 1; status = TRUE; break; case PGM_RECV_ONLY: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->can_send_data ? 0 : 1; status = TRUE; break; case PGM_PASSIVE: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->can_send_nak ? 0 : 1; status = TRUE; break; case PGM_ABORT_ON_RESET: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->is_abort_on_reset ? 1 : 0; status = TRUE; break; case PGM_NOBLOCK: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->is_nonblocking ? 1 : 0; status = TRUE; break; case PGM_SEND_GROUP: if (PGM_UNLIKELY(*optlen != sizeof (struct group_req))) break; memcpy (optval, &sock->send_gsr, sizeof (struct group_req)); status = TRUE; break; case PGM_UDP_ENCAP_UCAST_PORT: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->udp_encap_ucast_port; status = TRUE; break; case PGM_UDP_ENCAP_MCAST_PORT: if (PGM_UNLIKELY(*optlen != sizeof (int))) break; *(int*restrict)optval = sock->udp_encap_mcast_port; status = TRUE; break; /** write-only options **/ case PGM_IP_ROUTER_ALERT: case PGM_MULTICAST_LOOP: case PGM_MULTICAST_HOPS: case PGM_TOS: case PGM_JOIN_GROUP: case PGM_LEAVE_GROUP: case PGM_BLOCK_SOURCE: case PGM_UNBLOCK_SOURCE: case PGM_JOIN_SOURCE_GROUP: case PGM_LEAVE_SOURCE_GROUP: case PGM_MSFILTER: default: break; } break; default: break; } pgm_rwlock_reader_unlock (&sock->lock); return status; } bool pgm_setsockopt ( pgm_sock_t* const restrict sock, const int level, /* IPPROTO_PGM or SOL_SOCKET */ const int optname, const void* restrict optval, const socklen_t optlen ) { bool status = FALSE; pgm_return_val_if_fail (sock != NULL, status); pgm_return_val_if_fail (IPPROTO_PGM == level || SOL_SOCKET == level, status); if (PGM_UNLIKELY(!pgm_rwlock_reader_trylock (&sock->lock))) pgm_return_val_if_reached (status); if (PGM_UNLIKELY(sock->is_connected || sock->is_destroyed)) { pgm_rwlock_reader_unlock (&sock->lock); return status; } switch (level) { case SOL_SOCKET: switch (optname) { /* 0 < wmem < wmem_max (user) * * operating system and sysctl dependent maximum, minimum on Linux 256 (doubled). */ case SO_SNDBUF: if (SOCKET_ERROR == setsockopt (sock->send_sock, SOL_SOCKET, SO_SNDBUF, (const char*)optval, optlen) || SOCKET_ERROR == setsockopt (sock->send_with_router_alert_sock, SOL_SOCKET, SO_SNDBUF, (const char*)optval, optlen)) break; status = TRUE; break; /* 0 < rmem < rmem_max (user) * * minimum on Linux is 2048 (doubled). */ case SO_RCVBUF: if (SOCKET_ERROR == setsockopt (sock->recv_sock, SOL_SOCKET, SO_RCVBUF, (const char*)optval, optlen)) break; status = TRUE; break; default: break; } break; case IPPROTO_PGM: switch (optname) { /* RFC2113 IP Router Alert */ case PGM_IP_ROUTER_ALERT: if (PGM_UNLIKELY(optlen != sizeof (int))) break; { const bool v = (0 != *(const int*)optval); if (SOCKET_ERROR == pgm_sockaddr_router_alert (sock->send_with_router_alert_sock, sock->family, v)) break; } status = TRUE; break; /* IPv4: 68 <= tpdu < 65536 (RFC 2765) * IPv6: 1280 <= tpdu < 65536 (RFC 2460) */ case PGM_MTU: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval < (int)(sizeof(struct pgm_ip) + sizeof(struct pgm_header)))) break; if (PGM_UNLIKELY(*(const int*)optval > UINT16_MAX)) break; sock->max_tpdu = *(const int*)optval; status = TRUE; break; /* 1 = enable multicast loopback. * 0 = default, to disable. */ case PGM_MULTICAST_LOOP: if (PGM_UNLIKELY(optlen != sizeof (int))) break; { const bool v = (0 != *(const int*)optval); #if !defined(_WIN32) && !defined(__CYGWIN__) /* loop on send */ if (SOCKET_ERROR == pgm_sockaddr_multicast_loop (sock->send_sock, sock->family, v) || SOCKET_ERROR == pgm_sockaddr_multicast_loop (sock->send_with_router_alert_sock, sock->family, v)) break; #else /* loop on receive */ if (SOCKET_ERROR == pgm_sockaddr_multicast_loop (sock->recv_sock, sock->family, v)) break; #endif } status = TRUE; break; /* 0 < hops < 256, hops == -1 use kernel default (ignored). */ case PGM_MULTICAST_HOPS: #ifndef CONFIG_TARGET_WINE if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; if (PGM_UNLIKELY(*(const int*)optval > UINT8_MAX)) break; { sock->hops = *(const int*)optval; if (SOCKET_ERROR == pgm_sockaddr_multicast_hops (sock->send_sock, sock->family, sock->hops) || SOCKET_ERROR == pgm_sockaddr_multicast_hops (sock->send_with_router_alert_sock, sock->family, sock->hops)) break; } #endif status = TRUE; break; /* IP Type of Service (ToS) or RFC 3246, differentiated services (DSCP) */ case PGM_TOS: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (SOCKET_ERROR == pgm_sockaddr_tos (sock->send_sock, sock->family, *(const int*)optval) || SOCKET_ERROR == pgm_sockaddr_tos (sock->send_with_router_alert_sock, sock->family, *(const int*)optval)) { pgm_warn (_("ToS/DSCP setting requires CAP_NET_ADMIN or ADMIN capability.")); break; } status = TRUE; break; /* periodic ambient broadcast SPM interval in milliseconds. */ case PGM_AMBIENT_SPM: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->spm_ambient_interval = *(const int*)optval; status = TRUE; break; /* sequence of heartbeat broadcast SPMS to flush out original */ case PGM_HEARTBEAT_SPM: if (PGM_UNLIKELY(0 != optlen % sizeof (int))) break; { sock->spm_heartbeat_len = optlen / sizeof (int); sock->spm_heartbeat_interval = pgm_new (unsigned, sock->spm_heartbeat_len + 1); sock->spm_heartbeat_interval[0] = 0; for (unsigned i = 0; i < sock->spm_heartbeat_len; i++) sock->spm_heartbeat_interval[i + 1] = ((const int*)optval)[i]; } status = TRUE; break; /* size of transmit window in sequence numbers. * 0 < txw_sqns < one less than half sequence space */ case PGM_TXW_SQNS: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; if (PGM_UNLIKELY(*(const int*)optval >= (int)((UINT32_MAX/2)-1))) break; sock->txw_sqns = *(const int*)optval; status = TRUE; break; /* size of transmit window in seconds. * 0 < secs < ( txw_sqns / txw_max_rte ) */ case PGM_TXW_SECS: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->txw_secs = *(const int*)optval; status = TRUE; break; /* maximum transmit rate. * 0 < txw_max_rte < interface capacity * 10mb : 1250000 * 100mb : 12500000 * 1gb : 125000000 */ case PGM_TXW_MAX_RTE: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->txw_max_rte = *(const int*)optval; /* default to controlling SPM, ODATA, and RDATA packets. */ sock->is_controlled_odata = TRUE; sock->is_controlled_rdata = TRUE; status = TRUE; break; /* maximum original data rate. * 0 < odata_max_rte < txw_max_rte */ case PGM_ODATA_MAX_RTE: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->odata_max_rte = *(const int*)optval; status = TRUE; break; /* maximum repair data rate. * 0 < rdata_max_rte < txw_max_rte */ case PGM_RDATA_MAX_RTE: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->rdata_max_rte = *(const int*)optval; status = TRUE; break; /* ignore rate limit for original data packets, i.e. only apply to repairs. */ case PGM_UNCONTROLLED_ODATA: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->is_controlled_odata = (0 == *(const int*)optval); status = TRUE; break; /* ignore rate limit for repair data packets, i.e. only apply to original data. */ case PGM_UNCONTROLLED_RDATA: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->is_controlled_rdata = (0 == *(const int*)optval); status = TRUE; break; /* timeout for peers. * 0 < 2 * spm_ambient_interval <= peer_expiry */ case PGM_PEER_EXPIRY: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->peer_expiry = *(const int*)optval; status = TRUE; break; /* maximum back off range for listening for multicast SPMR. * 0 < spmr_expiry < spm_ambient_interval */ case PGM_SPMR_EXPIRY: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->spmr_expiry = *(const int*)optval; status = TRUE; break; /* size of receive window in sequence numbers. * 0 < rxw_sqns < one less than half sequence space */ case PGM_RXW_SQNS: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; if (PGM_UNLIKELY(*(const int*)optval >= (int)((UINT32_MAX/2)-1))) break; sock->rxw_sqns = *(const int*)optval; status = TRUE; break; /* size of receive window in seconds. * 0 < secs < ( rxw_sqns / rxw_max_rte ) */ case PGM_RXW_SECS: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->rxw_secs = *(const int*)optval; status = TRUE; break; /* maximum receive rate, for determining window size with txw_secs. * 0 < rxw_max_rte < interface capacity */ case PGM_RXW_MAX_RTE: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->rxw_max_rte = *(const int*)optval; status = TRUE; break; /* maximum NAK back-off value nak_rb_ivl in milliseconds. * 0 < nak_rb_ivl <= nak_bo_ivl */ case PGM_NAK_BO_IVL: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->nak_bo_ivl = *(const int*)optval; status = TRUE; break; /* repeat interval prior to re-sending a NAK, in milliseconds. */ case PGM_NAK_RPT_IVL: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->nak_rpt_ivl = *(const int*)optval; status = TRUE; break; /* interval waiting for repair data, in milliseconds. */ case PGM_NAK_RDATA_IVL: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->nak_rdata_ivl = *(const int*)optval; status = TRUE; break; /* limit for data. * 0 < nak_data_retries < 256 */ case PGM_NAK_DATA_RETRIES: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; if (PGM_UNLIKELY(*(const int*)optval > UINT8_MAX)) break; sock->nak_data_retries = *(const int*)optval; status = TRUE; break; /* limit for NAK confirms. * 0 < nak_ncf_retries < 256 */ case PGM_NAK_NCF_RETRIES: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; if (PGM_UNLIKELY(*(const int*)optval > UINT8_MAX)) break; sock->nak_ncf_retries = *(const int*)optval; status = TRUE; break; /* Enable FEC for this sock, specifically Reed Solmon encoding RS(n,k), common * setting is RS(255, 223). * * inputs: * * n = FEC Block size = [k+1, 255] * k = original data packets == transmission group size = [2, 4, 8, 16, 32, 64, 128] * m = symbol size = 8 bits * * outputs: * * h = 2t = n - k = parity packets * * when h > k parity packets can be lost. */ case PGM_USE_FEC: if (PGM_UNLIKELY(optlen != sizeof (struct pgm_fecinfo_t))) break; { const struct pgm_fecinfo_t* fecinfo = optval; if (PGM_UNLIKELY(0 != (fecinfo->group_size & (fecinfo->group_size - 1)))) break; if (PGM_UNLIKELY(fecinfo->group_size < 2 || fecinfo->group_size > 128)) break; if (PGM_UNLIKELY(fecinfo->group_size > fecinfo->block_size)) break; const uint8_t parity_packets = fecinfo->block_size - fecinfo->group_size; /* technically could re-send previous packets */ if (PGM_UNLIKELY(fecinfo->proactive_packets > parity_packets)) break; /* check validity of parameters */ if (PGM_UNLIKELY(fecinfo->group_size > 223 && ((parity_packets * 223.0) / fecinfo->group_size) < 1.0)) { pgm_error (_("k/h ratio too low to generate parity data.")); break; } sock->use_proactive_parity = (fecinfo->proactive_packets > 0); sock->use_ondemand_parity = fecinfo->ondemand_parity_enabled; sock->use_var_pktlen = fecinfo->var_pktlen_enabled; sock->rs_n = fecinfo->block_size; sock->rs_k = fecinfo->group_size; sock->rs_proactive_h = fecinfo->proactive_packets; } status = TRUE; break; /* congestion reporting */ case PGM_USE_CR: if (PGM_UNLIKELY(optlen != sizeof (int))) break; if (PGM_UNLIKELY(*(const int*)optval <= 0)) break; sock->crqst_ivl = *(const int*)optval; sock->use_cr = (sock->crqst_ivl > 0); status = TRUE; break; /* congestion control */ case PGM_USE_PGMCC: if (PGM_UNLIKELY(optlen != sizeof (struct pgm_pgmccinfo_t))) break; { const struct pgm_pgmccinfo_t* pgmccinfo = optval; sock->ack_bo_ivl = pgmccinfo->ack_bo_ivl; sock->ack_c = pgmccinfo->ack_c; sock->ack_c_p = pgmccinfo->ack_c_p; sock->use_pgmcc = (sock->ack_c > 0); } status = TRUE; break; /* declare socket only for sending, discard any incoming SPM, ODATA, * RDATA, etc, packets. */ case PGM_SEND_ONLY: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->can_recv_data = (0 == *(const int*)optval); status = TRUE; break; /* declare socket only for receiving, no transmit window will be created * and no SPM broadcasts sent. */ case PGM_RECV_ONLY: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->can_send_data = (0 == *(const int*)optval); status = TRUE; break; /* passive receiving socket, i.e. no back channel to source */ case PGM_PASSIVE: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->can_send_nak = (0 == *(const int*)optval); status = TRUE; break; /* on unrecoverable data loss stop socket from further transmission and * receiving. */ case PGM_ABORT_ON_RESET: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->is_abort_on_reset = (0 != *(const int*)optval); status = TRUE; break; /* default non-blocking operation on send and receive sockets. */ case PGM_NOBLOCK: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->is_nonblocking = (0 != *(const int*)optval); pgm_sockaddr_nonblocking (sock->send_sock, sock->is_nonblocking); pgm_sockaddr_nonblocking (sock->send_with_router_alert_sock, sock->is_nonblocking); status = TRUE; break; /* sending group, singular. note that the address is only stored and used * later in sendto() calls, this routine only considers the interface. */ case PGM_SEND_GROUP: if (PGM_UNLIKELY(optlen != sizeof(struct group_req))) break; memcpy (&sock->send_gsr, optval, sizeof(struct group_req)); if (PGM_UNLIKELY(sock->family != sock->send_gsr.gsr_group.ss_family)) break; /* multicast group for later usage with sendto() */ if (sock->udp_encap_mcast_port) ((struct sockaddr_in*)&sock->send_gsr.gsr_group)->sin_port = htons (sock->udp_encap_mcast_port); /* interface */ if ((SOCKET_ERROR == pgm_sockaddr_multicast_if (sock->send_sock, (const struct sockaddr*)&sock->send_addr, sock->send_gsr.gsr_interface)) || (SOCKET_ERROR == pgm_sockaddr_multicast_if (sock->send_with_router_alert_sock, (const struct sockaddr*)&sock->send_addr, sock->send_gsr.gsr_interface))) { break; } else if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((const struct sockaddr*)&sock->send_addr, addr, sizeof(addr)); pgm_trace (PGM_LOG_ROLE_NETWORK,_("Multicast send interface set to %s index %u"), addr, (unsigned)sock->send_gsr.gsr_interface); } status = TRUE; break; /* for any-source applications (ASM), join a new group */ case PGM_JOIN_GROUP: if (PGM_UNLIKELY(optlen != sizeof(struct group_req))) break; if (PGM_UNLIKELY(sock->recv_gsr_len >= IP_MAX_MEMBERSHIPS)) break; { const struct group_req* gr = optval; /* verify not duplicate group/interface pairing */ for (unsigned i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gr->gr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0 && pgm_sockaddr_cmp ((const struct sockaddr*)&gr->gr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_source) == 0 && (gr->gr_interface == sock->recv_gsr[i].gsr_interface || 0 == sock->recv_gsr[i].gsr_interface )) { #ifdef SOCKET_DEBUG char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((const struct sockaddr*)&gr->gr_group, s, sizeof(s)); if (sock->recv_gsr[i].gsr_interface) { pgm_warn(_("Socket has already joined group %s on interface %u"), s, gr->gr_interface); } else { pgm_warn(_("Socket has already joined group %s on all interfaces."), s); } #endif break; } } if (PGM_UNLIKELY(sock->family != gr->gr_group.ss_family)) break; sock->recv_gsr[sock->recv_gsr_len].gsr_interface = gr->gr_interface; memcpy (&sock->recv_gsr[sock->recv_gsr_len].gsr_group, &gr->gr_group, pgm_sockaddr_len ((const struct sockaddr*)&gr->gr_group)); if (sock->udp_encap_mcast_port) ((struct sockaddr_in*)&sock->recv_gsr[sock->recv_gsr_len].gsr_group)->sin_port = htons (sock->udp_encap_mcast_port); memcpy (&sock->recv_gsr[sock->recv_gsr_len].gsr_source, &gr->gr_group, pgm_sockaddr_len ((const struct sockaddr*)&gr->gr_group)); if (SOCKET_ERROR == pgm_sockaddr_join_group (sock->recv_sock, sock->family, gr)) break; else if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((const struct sockaddr*)&gr->gr_group, addr, sizeof(addr)); pgm_trace (PGM_LOG_ROLE_NETWORK,_("Join multicast group %s on interface index %u"), addr, (unsigned)gr->gr_interface); } sock->recv_gsr_len++; } status = TRUE; break; /* for any-source applications (ASM), leave a joined group. */ case PGM_LEAVE_GROUP: if (PGM_UNLIKELY(optlen != sizeof(struct group_req))) break; if (PGM_UNLIKELY(0 == sock->recv_gsr_len)) break; { const struct group_req* gr = optval; for (unsigned i = 0; i < sock->recv_gsr_len;) { if ((pgm_sockaddr_cmp ((const struct sockaddr*)&gr->gr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0) && /* drop all matching receiver entries */ (gr->gr_interface == 0 || /* drop all sources with matching interface */ gr->gr_interface == sock->recv_gsr[i].gsr_interface) ) { sock->recv_gsr_len--; if (i < (IP_MAX_MEMBERSHIPS - 1)) { memmove (&sock->recv_gsr[i], &sock->recv_gsr[i+1], (sock->recv_gsr_len - i) * sizeof(struct group_source_req)); continue; } } i++; } if (PGM_UNLIKELY(sock->family != gr->gr_group.ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_leave_group (sock->recv_sock, sock->family, gr)) break; else if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((const struct sockaddr*)&gr->gr_group, addr, sizeof(addr)); pgm_trace (PGM_LOG_ROLE_NETWORK,_("Leave multicast group %s on interface index %u"), addr, (unsigned)gr->gr_interface); } } status = TRUE; break; /* for any-source applications (ASM), turn off a given source */ case PGM_BLOCK_SOURCE: if (PGM_UNLIKELY(optlen != sizeof(struct group_source_req))) break; { const struct group_source_req* gsr = optval; if (PGM_UNLIKELY(sock->family != gsr->gsr_group.ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_block_source (sock->recv_sock, sock->family, gsr)) break; } status = TRUE; break; /* for any-source applications (ASM), re-allow a blocked source */ case PGM_UNBLOCK_SOURCE: if (PGM_UNLIKELY(optlen != sizeof(struct group_source_req))) break; { const struct group_source_req* gsr = optval; if (PGM_UNLIKELY(sock->family != gsr->gsr_group.ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_unblock_source (sock->recv_sock, sock->family, gsr)) break; } status = TRUE; break; /* for controlled-source applications (SSM), join each group/source pair. * * SSM joins are allowed on top of ASM in order to merge a remote source onto the local segment. */ case PGM_JOIN_SOURCE_GROUP: if (PGM_UNLIKELY(optlen != sizeof(struct group_source_req))) break; if (PGM_UNLIKELY(sock->recv_gsr_len >= IP_MAX_MEMBERSHIPS)) break; { const struct group_source_req* gsr = optval; /* verify if existing group/interface pairing */ for (unsigned i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0 && (gsr->gsr_interface == sock->recv_gsr[i].gsr_interface || 0 == sock->recv_gsr[i].gsr_interface )) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_source, (struct sockaddr*)&sock->recv_gsr[i].gsr_source) == 0) { #ifdef SOCKET_DEBUG char s1[INET6_ADDRSTRLEN], s2[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((const struct sockaddr*)&gsr->gsr_group, s1, sizeof(s1)); pgm_sockaddr_ntop ((const struct sockaddr*)&gsr->gsr_source, s2, sizeof(s2)); if (sock->recv_gsr[i].gsr_interface) { pgm_warn(_("Socket has already joined group %s from source %s on interface %d"), s1, s2, (unsigned)gsr->gsr_interface); } else { pgm_warn(_("Socket has already joined group %s from source %s on all interfaces"), s1, s2); } #endif break; } break; } } if (PGM_UNLIKELY(sock->family != gsr->gsr_group.ss_family)) break; if (PGM_UNLIKELY(sock->family != gsr->gsr_source.ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_join_source_group (sock->recv_sock, sock->family, gsr)) break; memcpy (&sock->recv_gsr[sock->recv_gsr_len], gsr, sizeof(struct group_source_req)); sock->recv_gsr_len++; } status = TRUE; break; /* for controlled-source applications (SSM), leave each group/source pair */ case PGM_LEAVE_SOURCE_GROUP: if (PGM_UNLIKELY(optlen != sizeof(struct group_source_req))) break; if (PGM_UNLIKELY(0 == sock->recv_gsr_len)) break; { const struct group_source_req* gsr = optval; /* verify if existing group/interface pairing */ for (unsigned i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0 && pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_source, (struct sockaddr*)&sock->recv_gsr[i].gsr_source) == 0 && gsr->gsr_interface == sock->recv_gsr[i].gsr_interface) { sock->recv_gsr_len--; if (i < (IP_MAX_MEMBERSHIPS - 1)) { memmove (&sock->recv_gsr[i], &sock->recv_gsr[i+1], (sock->recv_gsr_len - i) * sizeof(struct group_source_req)); break; } } } if (PGM_UNLIKELY(sock->family != gsr->gsr_group.ss_family)) break; if (PGM_UNLIKELY(sock->family != gsr->gsr_source.ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_leave_source_group (sock->recv_sock, sock->family, gsr)) break; } status = TRUE; break; /* batch block and unblock sources */ case PGM_MSFILTER: #if defined(MCAST_MSFILTER) || defined(SIOCSMSFILTER) if (PGM_UNLIKELY(optlen < (socklen_t)sizeof(struct group_filter))) break; { const struct group_filter* gf_list = optval; if ((socklen_t)GROUP_FILTER_SIZE( gf_list->gf_numsrc ) != optlen) break; if (PGM_UNLIKELY(sock->family != gf_list->gf_group.ss_family)) break; /* check only first */ if (PGM_UNLIKELY(sock->family != gf_list->gf_slist[0].ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_msfilter (sock->recv_sock, sock->family, gf_list)) break; } status = TRUE; #endif break; /* UDP encapsulation ports */ case PGM_UDP_ENCAP_UCAST_PORT: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->udp_encap_ucast_port = *(const int*)optval; status = TRUE; break; case PGM_UDP_ENCAP_MCAST_PORT: if (PGM_UNLIKELY(optlen != sizeof (int))) break; sock->udp_encap_mcast_port = *(const int*)optval; status = TRUE; break; /** read-only options **/ case PGM_MSSS: case PGM_MSS: case PGM_PDU: case PGM_SEND_SOCK: case PGM_RECV_SOCK: case PGM_REPAIR_SOCK: case PGM_PENDING_SOCK: case PGM_ACK_SOCK: case PGM_TIME_REMAIN: case PGM_RATE_REMAIN: default: break; } break; default: break; } pgm_rwlock_reader_unlock (&sock->lock); return status; } bool pgm_bind ( pgm_sock_t* restrict sock, const struct pgm_sockaddr_t*const restrict sockaddr, const socklen_t sockaddrlen, pgm_error_t** restrict error ) { struct pgm_interface_req_t null_req; memset (&null_req, 0, sizeof(null_req)); return pgm_bind3 (sock, sockaddr, sockaddrlen, &null_req, sizeof(null_req), &null_req, sizeof(null_req), error); } /* bind the sockets to the link layer to start receiving data. * * returns TRUE on success, or FALSE on error and sets error appropriately, */ bool pgm_bind3 ( pgm_sock_t* restrict sock, const struct pgm_sockaddr_t*const restrict sockaddr, const socklen_t sockaddrlen, const struct pgm_interface_req_t*const send_req, /* only use gr_interface and gr_group::sin6_scope */ const socklen_t send_req_len, const struct pgm_interface_req_t*const recv_req, const socklen_t recv_req_len, pgm_error_t** restrict error /* maybe NULL */ ) { pgm_return_val_if_fail (NULL != sock, FALSE); pgm_return_val_if_fail (NULL != sockaddr, FALSE); pgm_return_val_if_fail (0 != sockaddrlen, FALSE); if (sockaddr->sa_addr.sport) pgm_return_val_if_fail (sockaddr->sa_addr.sport != sockaddr->sa_port, FALSE); pgm_return_val_if_fail (NULL != send_req, FALSE); pgm_return_val_if_fail (sizeof(struct pgm_interface_req_t) == send_req_len, FALSE); pgm_return_val_if_fail (NULL != recv_req, FALSE); pgm_return_val_if_fail (sizeof(struct pgm_interface_req_t) == recv_req_len, FALSE); if (!pgm_rwlock_writer_trylock (&sock->lock)) pgm_return_val_if_reached (FALSE); if (sock->is_bound || sock->is_destroyed) { pgm_rwlock_writer_unlock (&sock->lock); pgm_return_val_if_reached (FALSE); } /* sanity checks on state */ if (sock->max_tpdu < (sizeof(struct pgm_ip) + sizeof(struct pgm_header))) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("Invalid maximum TPDU size.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (sock->can_send_data) { if (PGM_UNLIKELY(0 == sock->spm_ambient_interval)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("SPM ambient interval not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->spm_heartbeat_len)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("SPM heartbeat interval not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->txw_sqns && 0 == sock->txw_secs)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("TXW_SQNS not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->txw_sqns && 0 == sock->txw_max_rte)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("TXW_MAX_RTE not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } } if (sock->can_recv_data) { if (PGM_UNLIKELY(0 == sock->rxw_sqns && 0 == sock->rxw_secs)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("RXW_SQNS not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->rxw_sqns && 0 == sock->rxw_max_rte)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("RXW_MAX_RTE not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->peer_expiry)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("Peer timeout not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->spmr_expiry)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("SPM-Request timeout not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->nak_bo_ivl)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("NAK_BO_IVL not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->nak_rpt_ivl)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("NAK_RPT_IVL not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->nak_rdata_ivl)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("NAK_RDATA_IVL not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->nak_data_retries)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("NAK_DATA_RETRIES not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(0 == sock->nak_ncf_retries)) { pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, PGM_ERROR_FAILED, _("NAK_NCF_RETRIES not configured.")); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } } pgm_debug ("bind3 (sock:%p sockaddr:%p sockaddrlen:%u send-req:%p send-req-len:%u recv-req:%p recv-req-len:%u error:%p)", (const void*)sock, (const void*)sockaddr, (unsigned)sockaddrlen, (const void*)send_req, (unsigned)send_req_len, (const void*)recv_req, (unsigned)recv_req_len, (const void*)error); memcpy (&sock->tsi, &sockaddr->sa_addr, sizeof(pgm_tsi_t)); sock->dport = htons (sockaddr->sa_port); if (sock->tsi.sport) { sock->tsi.sport = htons (sock->tsi.sport); } else { do { sock->tsi.sport = htons (pgm_random_int_range (0, UINT16_MAX)); } while (sock->tsi.sport == sock->dport); } /* pseudo-random number generator for back-off intervals */ pgm_rand_create (&sock->rand_); /* PGM Children support of POLLs requires 32-bit random node identifier RAND_NODE_ID */ if (sock->can_recv_data) { sock->rand_node_id = pgm_rand_int (&sock->rand_); } if (sock->can_send_data) { /* Windows notify call will raise an assertion on error, only Unix versions will return * a valid error. */ if (sock->use_pgmcc && 0 != pgm_notify_init (&sock->ack_notify)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Creating ACK notification channel: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (0 != pgm_notify_init (&sock->rdata_notify)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Creating RDATA notification channel: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } } if (0 != pgm_notify_init (&sock->pending_notify)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Creating waiting peer notification channel: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } /* determine IP header size for rate regulation engine & stats */ sock->iphdr_len = (AF_INET == sock->family) ? sizeof(struct pgm_ip) : sizeof(struct pgm_ip6_hdr); pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming IP header size of %" PRIzu " bytes", sock->iphdr_len); if (sock->udp_encap_ucast_port) { const size_t udphdr_len = sizeof(struct pgm_udphdr); pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming UDP header size of %" PRIzu " bytes", udphdr_len); sock->iphdr_len += udphdr_len; } const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; sock->max_tsdu = (uint16_t)(sock->max_tpdu - sock->iphdr_len - pgm_pkt_offset (FALSE, pgmcc_family)); sock->max_tsdu_fragment = (uint16_t)(sock->max_tpdu - sock->iphdr_len - pgm_pkt_offset (TRUE, pgmcc_family)); const unsigned max_fragments = sock->txw_sqns ? MIN( PGM_MAX_FRAGMENTS, sock->txw_sqns ) : PGM_MAX_FRAGMENTS; sock->max_apdu = MIN( PGM_MAX_APDU, max_fragments * sock->max_tsdu_fragment ); if (sock->can_send_data) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Create transmit window.")); sock->window = sock->txw_sqns ? pgm_txw_create (&sock->tsi, 0, /* MAX_TPDU */ sock->txw_sqns, /* TXW_SQNS */ 0, /* TXW_SECS */ 0, /* TXW_MAX_RTE */ sock->use_ondemand_parity || sock->use_proactive_parity, sock->rs_n, sock->rs_k) : pgm_txw_create (&sock->tsi, sock->max_tpdu, /* MAX_TPDU */ 0, /* TXW_SQNS */ sock->txw_secs, /* TXW_SECS */ sock->txw_max_rte, /* TXW_MAX_RTE */ sock->use_ondemand_parity || sock->use_proactive_parity, sock->rs_n, sock->rs_k); pgm_assert (NULL != sock->window); } /* create peer list */ if (sock->can_recv_data) { sock->peers_hashtable = pgm_hashtable_new (pgm_tsi_hash, pgm_tsi_equal); pgm_assert (NULL != sock->peers_hashtable); } /* Bind UDP sockets to interfaces, note multicast on a bound interface is * fruity on some platforms. Roughly, binding to INADDR_ANY provides all * data, binding to the multicast group provides only multicast traffic, * and binding to the interface address provides only unicast traffic. * * Multicast routing, IGMP & MLD require a link local address, for IPv4 * this is provided through MULTICAST_IF and IPv6 through bind, and these * may be overridden by per packet scopes. * * After binding, default interfaces (0.0.0.0) are resolved. */ /* TODO: different ports requires a new bound socket */ union { struct sockaddr sa; struct sockaddr_in s4; struct sockaddr_in6 s6; struct sockaddr_storage ss; } recv_addr, recv_addr2, send_addr, send_with_router_alert_addr; #ifdef CONFIG_BIND_INADDR_ANY /* force default interface for bind-only, source address is still valid for multicast membership. * effectively same as running getaddrinfo(hints = {ai_flags = AI_PASSIVE}) */ if (AF_INET == sock->family) { memset (&recv_addr.s4, 0, sizeof(struct sockaddr_in)); recv_addr.s4.sin_family = AF_INET; recv_addr.s4.sin_addr.s_addr = INADDR_ANY; pgm_trace (PGM_LOG_ROLE_NETWORK,_("Binding receive socket to INADDR_ANY")); } else { memset (&recv_addr.s6, 0, sizeof(struct sockaddr_in6)); recv_addr.s6.sin6_family = AF_INET6; recv_addr.s6.sin6_addr = in6addr_any; pgm_trace (PGM_LOG_ROLE_NETWORK,_("Binding receive socket to IN6ADDR_ANY")); } #else if (!pgm_if_indextoaddr (recv_req->ir_interface, sock->family, recv_req->ir_scope_id, &recv_addr.sa, error)) { pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } else if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { if (AF_INET6 == sock_family) pgm_trace (PGM_LOG_ROLE_NETWORK,_("Binding receive socket to interface index %u scope %u"), recv_req->ir_interface, recv_req->ir_scope_id); else pgm_trace (PGM_LOG_ROLE_NETWORK,_("Binding receive socket to interface index %u"), recv_req->ir_interface); } #endif /* CONFIG_BIND_INADDR_ANY */ memcpy (&recv_addr2.sa, &recv_addr.sa, pgm_sockaddr_len (&recv_addr.sa)); /* UDP port */ ((struct sockaddr_in*)&recv_addr)->sin_port = htons (sock->udp_encap_mcast_port); if (SOCKET_ERROR == bind (sock->recv_sock, &recv_addr.sa, pgm_sockaddr_len (&recv_addr.sa))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&recv_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Binding receive socket to address %s: %s"), addr, pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&recv_addr, s, sizeof(s)); pgm_debug ("bind succeeded on recv_gsr[0] interface %s", s); } /* keep a copy of the original address source to re-use for router alert bind */ memset (&send_addr, 0, sizeof(send_addr)); if (!pgm_if_indextoaddr (send_req->ir_interface, sock->family, send_req->ir_scope_id, (struct sockaddr*)&send_addr, error)) { pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } else if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { if (AF_INET6 == sock->family) pgm_trace (PGM_LOG_ROLE_NETWORK,_("Binding send socket to interface index %u scope %u"), send_req->ir_interface, send_req->ir_scope_id); else pgm_trace (PGM_LOG_ROLE_NETWORK,_("Binding send socket to interface index %u"), send_req->ir_interface); } memcpy (&send_with_router_alert_addr, &send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)); if (SOCKET_ERROR == bind (sock->send_sock, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Binding send socket to address %s: %s"), addr, pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } /* resolve bound address if 0.0.0.0 */ if (AF_INET == send_addr.ss.ss_family) { if ((INADDR_ANY == ((struct sockaddr_in*)&send_addr)->sin_addr.s_addr) && !pgm_get_multicast_enabled_node_addr (AF_INET, (struct sockaddr*)&send_addr, sizeof(send_addr), error)) { pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } } else if ((memcmp (&in6addr_any, &((struct sockaddr_in6*)&send_addr)->sin6_addr, sizeof(in6addr_any)) == 0) && !pgm_get_multicast_enabled_node_addr (AF_INET6, (struct sockaddr*)&send_addr, sizeof(send_addr), error)) { pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_addr, s, sizeof(s)); pgm_debug ("bind succeeded on send_gsr interface %s", s); } if (SOCKET_ERROR == bind (sock->send_with_router_alert_sock, (struct sockaddr*)&send_with_router_alert_addr, pgm_sockaddr_len((struct sockaddr*)&send_with_router_alert_addr))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_with_router_alert_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Binding IP Router Alert (RFC 2113) send socket to address %s: %s"), addr, pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } if (PGM_UNLIKELY(pgm_log_mask & PGM_LOG_ROLE_NETWORK)) { char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_with_router_alert_addr, s, sizeof(s)); pgm_debug ("bind (router alert) succeeded on send_gsr interface %s", s); } /* save send side address for broadcasting as source nla */ memcpy (&sock->send_addr, &send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)); /* rx to nak processor notify channel */ if (sock->can_send_data) { /* setup rate control */ if (sock->txw_max_rte > 0) { pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Setting rate regulation to %" PRIzd " bytes per second."), sock->txw_max_rte); pgm_rate_create (&sock->rate_control, sock->txw_max_rte, sock->iphdr_len, sock->max_tpdu); sock->is_controlled_spm = TRUE; /* must always be set */ } else sock->is_controlled_spm = FALSE; if (sock->odata_max_rte > 0) { pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Setting ODATA rate regulation to %" PRIzd " bytes per second."), sock->odata_max_rte); pgm_rate_create (&sock->odata_rate_control, sock->odata_max_rte, sock->iphdr_len, sock->max_tpdu); sock->is_controlled_odata = TRUE; } if (sock->rdata_max_rte > 0) { pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Setting RDATA rate regulation to %" PRIzd " bytes per second."), sock->rdata_max_rte); pgm_rate_create (&sock->rdata_rate_control, sock->rdata_max_rte, sock->iphdr_len, sock->max_tpdu); sock->is_controlled_rdata = TRUE; } } /* allocate first incoming packet buffer */ sock->rx_buffer = pgm_alloc_skb (sock->max_tpdu); /* bind complete */ sock->is_bound = TRUE; /* cleanup */ pgm_rwlock_writer_unlock (&sock->lock); pgm_debug ("PGM socket successfully bound."); return TRUE; } bool pgm_connect ( pgm_sock_t* restrict sock, pgm_error_t** restrict error /* maybe NULL */ ) { pgm_return_val_if_fail (sock != NULL, FALSE); pgm_return_val_if_fail (sock->recv_gsr_len > 0, FALSE); #ifdef CONFIG_TARGET_WINE pgm_return_val_if_fail (sock->recv_gsr_len == 1, FALSE); #endif for (unsigned i = 0; i < sock->recv_gsr_len; i++) { pgm_return_val_if_fail (sock->recv_gsr[i].gsr_group.ss_family == sock->recv_gsr[0].gsr_group.ss_family, FALSE); pgm_return_val_if_fail (sock->recv_gsr[i].gsr_group.ss_family == sock->recv_gsr[i].gsr_source.ss_family, FALSE); } pgm_return_val_if_fail (sock->send_gsr.gsr_group.ss_family == sock->recv_gsr[0].gsr_group.ss_family, FALSE); /* shutdown */ if (PGM_UNLIKELY(!pgm_rwlock_writer_trylock (&sock->lock))) pgm_return_val_if_reached (FALSE); /* state */ if (PGM_UNLIKELY(sock->is_connected || !sock->is_bound || sock->is_destroyed)) { pgm_rwlock_writer_unlock (&sock->lock); pgm_return_val_if_reached (FALSE); } pgm_debug ("connect (sock:%p error:%p)", (const void*)sock, (const void*)error); /* rx to nak processor notify channel */ if (sock->can_send_data) { /* announce new sock by sending out SPMs */ if (!pgm_send_spm (sock, PGM_OPT_SYN) || !pgm_send_spm (sock, PGM_OPT_SYN) || !pgm_send_spm (sock, PGM_OPT_SYN)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), _("Sending SPM broadcast: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); pgm_rwlock_writer_unlock (&sock->lock); return FALSE; } sock->next_poll = sock->next_ambient_spm = pgm_time_update_now() + sock->spm_ambient_interval; /* start PGMCC with one token */ sock->tokens = sock->cwnd_size = pgm_fp8 (1); /* slow start threshold */ sock->ssthresh = pgm_fp8 (4); /* ACK timeout, should be greater than first SPM heartbeat interval in order to be scheduled correctly */ sock->ack_expiry_ivl = pgm_secs (3); /* start full history */ sock->ack_bitmap = 0xffffffff; } else { pgm_assert (sock->can_recv_data); sock->next_poll = pgm_time_update_now() + pgm_secs( 30 ); } sock->is_connected = TRUE; /* cleanup */ pgm_rwlock_writer_unlock (&sock->lock); pgm_debug ("PGM socket successfully connected."); return TRUE; } /* return local endpoint address */ bool pgm_getsockname ( pgm_sock_t* const restrict sock, struct pgm_sockaddr_t* restrict addr, socklen_t* restrict addrlen ) { pgm_assert (NULL != sock); pgm_assert (NULL != addr); pgm_assert (NULL != addrlen); pgm_assert (sizeof(struct pgm_sockaddr_t) == *addrlen); if (!sock->is_bound) { pgm_set_last_sock_error (PGM_SOCK_EINVAL); return FALSE; } addr->sa_port = sock->dport; memcpy (&addr->sa_addr, &sock->tsi, sizeof(pgm_tsi_t)); return TRUE; } /* add select parameters for the receive socket(s) * * returns highest file descriptor used plus one. */ int pgm_select_info ( pgm_sock_t* const restrict sock, fd_set* const restrict readfds, /* blocking recv fds */ fd_set* const restrict writefds, /* blocking send fds */ int* const restrict n_fds /* in: max fds, out: max (in:fds, sock:fds) */ ) { int fds = 0; pgm_assert (NULL != sock); pgm_assert (NULL != n_fds); if (!sock->is_bound || sock->is_destroyed) { pgm_set_last_sock_error (PGM_SOCK_EINVAL); return SOCKET_ERROR; } const bool is_congested = (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) ? TRUE : FALSE; if (readfds) { FD_SET(sock->recv_sock, readfds); #ifndef _WIN32 fds = sock->recv_sock + 1; #else fds = 1; #endif if (sock->can_send_data) { const SOCKET rdata_fd = pgm_notify_get_socket (&sock->rdata_notify); FD_SET(rdata_fd, readfds); #ifndef _WIN32 fds = MAX(fds, rdata_fd + 1); #else fds++; #endif if (is_congested) { const SOCKET ack_fd = pgm_notify_get_socket (&sock->ack_notify); FD_SET(ack_fd, readfds); #ifndef _WIN32 fds = MAX(fds, ack_fd + 1); #else fds++; #endif } } const SOCKET pending_fd = pgm_notify_get_socket (&sock->pending_notify); FD_SET(pending_fd, readfds); #ifndef _WIN32 fds = MAX(fds, pending_fd + 1); #else fds++; #endif } if (sock->can_send_data && writefds && !is_congested) { FD_SET(sock->send_sock, writefds); #ifndef _WIN32 fds = MAX(sock->send_sock + 1, fds); #else fds++; #endif } #ifndef _WIN32 return *n_fds = MAX(fds, *n_fds); #else return *n_fds + fds; #endif } #if defined(CONFIG_HAVE_POLL) || defined(CONFIG_HAVE_WSAPOLL) /* add poll parameters for the receive socket(s) * * returns number of pollfd structures filled. */ #ifndef _WIN32 # define PGM_POLLIN POLLIN # define PGM_POLLOUT POLLOUT #else # define PGM_POLLIN POLLRDNORM # define PGM_POLLOUT POLLWRNORM #endif int pgm_poll_info ( pgm_sock_t* const restrict sock, #ifndef _WIN32 struct pollfd* const restrict fds, int* const restrict n_fds, /* in: #fds, out: used #fds */ #else WSAPOLLFD* const restrict fds, ULONG* const restrict n_fds, #endif const short events /* POLLIN, POLLOUT */ ) { #ifndef _WIN32 int nfds = 0; #else ULONG nfds = 0; #endif pgm_assert (NULL != sock); pgm_assert (NULL != fds); pgm_assert (NULL != n_fds); if (!sock->is_bound || sock->is_destroyed) { pgm_set_last_sock_error (PGM_SOCK_EINVAL); return SOCKET_ERROR; } /* we currently only support one incoming socket */ if (events & PGM_POLLIN) { pgm_assert ( (1 + nfds) <= *n_fds ); fds[nfds].fd = sock->recv_sock; fds[nfds].events = PGM_POLLIN; nfds++; if (sock->can_send_data) { pgm_assert ( (1 + nfds) <= *n_fds ); fds[nfds].fd = pgm_notify_get_socket (&sock->rdata_notify); fds[nfds].events = PGM_POLLIN; nfds++; } pgm_assert ( (1 + nfds) <= *n_fds ); fds[nfds].fd = pgm_notify_get_socket (&sock->pending_notify); fds[nfds].events = PGM_POLLIN; nfds++; } /* ODATA only published on regular socket, no need to poll router-alert sock */ if (sock->can_send_data && events & PGM_POLLOUT) { pgm_assert ( (1 + nfds) <= *n_fds ); if (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) { /* rx thread poll for ACK */ fds[nfds].fd = pgm_notify_get_socket (&sock->ack_notify); fds[nfds].events = PGM_POLLIN; } else { /* kernel resource poll */ fds[nfds].fd = sock->send_sock; fds[nfds].events = PGM_POLLOUT; } nfds++; } return *n_fds = nfds; } #endif /* CONFIG_HAVE_POLL */ /* add epoll parameters for the recieve socket(s), events should * be set to EPOLLIN to wait for incoming events (data), and EPOLLOUT to wait * for non-blocking write. * * returns 0 on success, -1 on failure and sets errno appropriately. */ #ifdef CONFIG_HAVE_EPOLL int pgm_epoll_ctl ( pgm_sock_t* const sock, const SOCKET epfd, const int op, /* EPOLL_CTL_ADD, ... */ const int events /* EPOLLIN, EPOLLOUT */ ) { struct epoll_event event; int retval = 0; if (!(op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD)) { pgm_set_last_sock_error (PGM_SOCK_EINVAL); return SOCKET_ERROR; } else if (!sock->is_bound || sock->is_destroyed) { pgm_set_last_sock_error (PGM_SOCK_EINVAL); return SOCKET_ERROR; } if (events & EPOLLIN) { event.events = events & (EPOLLIN | EPOLLET | EPOLLONESHOT); event.data.ptr = sock; retval = epoll_ctl (epfd, op, sock->recv_sock, &event); if (retval) goto out; if (sock->can_send_data) { retval = epoll_ctl (epfd, op, pgm_notify_get_socket (&sock->rdata_notify), &event); if (retval) goto out; } retval = epoll_ctl (epfd, op, pgm_notify_get_socket (&sock->pending_notify), &event); if (retval) goto out; if (events & EPOLLET) sock->is_edge_triggered_recv = TRUE; } if (sock->can_send_data && events & EPOLLOUT) { bool enable_ack_socket = FALSE; bool enable_send_socket = FALSE; /* both sockets need to be added when PGMCC is enabled */ if (sock->use_pgmcc && EPOLL_CTL_ADD == op) { enable_ack_socket = enable_send_socket = TRUE; } else { /* automagically switch socket when congestion stall occurs */ if (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) enable_ack_socket = TRUE; else enable_send_socket = TRUE; } if (enable_ack_socket) { /* rx thread poll for ACK */ event.events = EPOLLIN | (events & (EPOLLONESHOT)); event.data.ptr = sock; retval = epoll_ctl (epfd, op, pgm_notify_get_socket (&sock->ack_notify), &event); } if (enable_send_socket) { /* kernel resource poll */ event.events = events & (EPOLLOUT | EPOLLET | EPOLLONESHOT); event.data.ptr = sock; retval = epoll_ctl (epfd, op, sock->send_sock, &event); } } out: return retval; } #endif static const char* pgm_family_string ( const int family ) { const char* c; switch (family) { case AF_UNSPEC: c = "AF_UNSPEC"; break; case AF_INET: c = "AF_INET"; break; case AF_INET6: c = "AF_INET6"; break; default: c = "(unknown)"; break; } return c; } static const char* pgm_sock_type_string ( const int sock_type ) { const char* c; switch (sock_type) { case SOCK_SEQPACKET: c = "SOCK_SEQPACKET"; break; default: c = "(unknown)"; break; } return c; } static const char* pgm_protocol_string ( const int protocol ) { const char* c; switch (protocol) { case IPPROTO_UDP: c = "IPPROTO_UDP"; break; case IPPROTO_PGM: c = "IPPROTO_PGM"; break; default: c = "(unknown)"; break; } return c; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/crossmingw64.py0000644000175000017500000001131711640407354020465 0ustar locallocalimport os import os.path import string import SCons.Action import SCons.Builder import SCons.Tool import SCons.Util # This is what we search for to find mingw: prefixes = SCons.Util.Split(""" x86_64-w64-mingw32- """) def find(env): for prefix in prefixes: # First search in the SCons path and then the OS path: if env.WhereIs(prefix + 'gcc') or SCons.Util.WhereIs(prefix + 'gcc'): return prefix return '' def shlib_generator(target, source, env, for_signature): cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) def_target = env.FindIxes(target, 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX') if def_target: cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) return [cmd] def shlib_emitter(target, source, env): dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') no_import_lib = env.get('no_import_lib', 0) if not dll: raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") if not no_import_lib and \ not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): # Append an import library to the list of targets. target.append(env.ReplaceIxes(dll, 'SHLIBPREFIX', 'SHLIBSUFFIX', 'LIBPREFIX', 'LIBSUFFIX')) # Append a def file target if there isn't already a def file target # or a def file source. There is no option to disable def file # target emitting, because I can't figure out why someone would ever # want to turn it off. def_source = env.FindIxes(source, 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX') def_target = env.FindIxes(target, 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX') if not def_source and not def_target: target.append(env.ReplaceIxes(dll, 'SHLIBPREFIX', 'SHLIBSUFFIX', 'WIN32DEFPREFIX', 'WIN32DEFSUFFIX')) return (target, source) # TODO: Backported to old scons version #shlib_action = SCons.Action.CommandGenerator(shlib_generator) shlib_action = SCons.Action.Action(shlib_generator,generator=1) res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', source_scanner=SCons.Tool.SourceFileScanner) SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) def generate(env): mingw_prefix = find(env) if mingw_prefix: dir = os.path.dirname(env.WhereIs(mingw_prefix + 'gcc') or SCons.Util.WhereIs(mingw_prefix + 'gcc')) # The mingw bin directory must be added to the path: path = env['ENV'].get('PATH', []) if not path: path = [] if SCons.Util.is_String(path): path = string.split(path, os.pathsep) env['ENV']['PATH'] = string.join([dir] + path, os.pathsep) # Most of mingw is the same as gcc and friends... gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas'] for tool in gnu_tools: SCons.Tool.Tool(tool)(env) #... but a few things differ: env['CC'] = mingw_prefix + 'gcc' env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['CXX'] = mingw_prefix + 'g++' env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = shlib_action env.Append(SHLIBEMITTER = [shlib_emitter]) # This line isn't required and breaks C++ linking #env['LINK'] = mingw_prefix + 'g++' env['AS'] = mingw_prefix + 'as' env['AR'] = mingw_prefix + 'ar' env['RANLIB'] = mingw_prefix + 'ranlib' env['WIN32DEFPREFIX'] = '' env['WIN32DEFSUFFIX'] = '.def' env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['RC'] = mingw_prefix + 'windres' env['RCFLAGS'] = SCons.Util.CLVar('') env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET)} $)' env['RCINCPREFIX'] = '--include-dir ' env['RCINCSUFFIX'] = '' env['RCCOM'] = '$RC $RCINCFLAGS $RCINCPREFIX $SOURCE.dir $RCFLAGS -i $SOURCE -o $TARGET' env['BUILDERS']['RES'] = res_builder # Some setting from the platform also have to be overridden: env['OBJPREFIX'] = '' env['OBJSUFFIX'] = '.o' env['LIBPREFIX'] = 'lib' env['LIBSUFFIX'] = '.a' env['SHOBJPREFIX'] = '$OBJPREFIX' env['SHOBJSUFFIX'] = '$OBJSUFFIX' env['PROGPREFIX'] = '' env['PROGSUFFIX'] = '.exe' env['LIBPREFIX'] = '' env['LIBSUFFIX'] = '.lib' env['SHLIBPREFIX'] = '' env['SHLIBSUFFIX'] = '.dll' env['LIBPREFIXES'] = [ '$LIBPREFIX' ] env['LIBSUFFIXES'] = [ '$LIBSUFFIX' ] def exists(env): return find(env) libpgm-5.1.118-1~dfsg/openpgm/pgm/if.c.c89.patch0000644000175000017500000002262611640407354020015 0ustar locallocal--- if.c 2011-09-27 04:34:28.000000000 +0800 +++ if.c89.c 2011-09-27 04:37:03.000000000 +0800 @@ -125,6 +125,7 @@ continue; } + { char saddr[INET6_ADDRSTRLEN]; getnameinfo (ifa->ifa_addr, pgm_sockaddr_len(ifa->ifa_addr), saddr, sizeof(saddr), @@ -141,6 +142,7 @@ ifa->ifa_flags & IFF_BROADCAST ? "YES" : "NO ", ifa->ifa_flags & IFF_MULTICAST ? "YES" : "NO " ); + } } pgm_freeifaddrs (ifap); @@ -214,10 +216,13 @@ pgm_assert (NULL != src); pgm_assert (NULL != netmask); - for (unsigned i = 0; i < 16; i++) { + { + unsigned i; + for (i = 0; i < 16; i++) { dst->s6_addr[i] = src->s6_addr[i] & netmask->s6_addr[i]; has_lna |= (0 != (src->s6_addr[i] & !netmask->s6_addr[i])); } + } return has_lna; } @@ -235,14 +240,17 @@ pgm_assert (NULL != netmask); #ifdef IF_DEBUG - const struct in_addr taddr = { .s_addr = htonl (addr->s_addr) }; - const struct in_addr tnetaddr = { .s_addr = htonl (netaddr->s_addr) }; - const struct in_addr tnetmask = { .s_addr = htonl (netmask->s_addr) }; + { char saddr[INET_ADDRSTRLEN], snetaddr[INET_ADDRSTRLEN], snetmask[INET_ADDRSTRLEN]; + struct in_addr taddr, tnetaddr, tnetmask; + taddr.s_addr = htonl (addr->s_addr); + tnetaddr.s_addr = htonl (netaddr->s_addr); + tnetmask.s_addr = htonl (netmask->s_addr); pgm_debug ("is_in_net (addr:%s netaddr:%s netmask:%s)", pgm_inet_ntop (AF_INET, &taddr, saddr, sizeof(saddr)), pgm_inet_ntop (AF_INET, &tnetaddr, snetaddr, sizeof(snetaddr)), pgm_inet_ntop (AF_INET, &tnetmask, snetmask, sizeof(snetmask))); + } #endif if ((addr->s_addr & netmask->s_addr) == (netaddr->s_addr & netmask->s_addr)) @@ -263,16 +271,21 @@ pgm_assert (NULL != netmask); #ifdef IF_DEBUG + { char saddr[INET6_ADDRSTRLEN], snetaddr[INET6_ADDRSTRLEN], snetmask[INET6_ADDRSTRLEN]; pgm_debug ("is_in_net6 (addr:%s netaddr:%s netmask:%s)", pgm_inet_ntop (AF_INET6, addr, saddr, sizeof(saddr)), pgm_inet_ntop (AF_INET6, netaddr, snetaddr, sizeof(snetaddr)), pgm_inet_ntop (AF_INET6, netmask, snetmask, sizeof(snetmask))); + } #endif - for (unsigned i = 0; i < 16; i++) + { + unsigned i; + for (i = 0; i < 16; i++) if ((addr->s6_addr[i] & netmask->s6_addr[i]) != (netaddr->s6_addr[i] & netmask->s6_addr[i])) return FALSE; + } return TRUE; } @@ -346,8 +359,11 @@ if (AF_INET6 != family && 0 == pgm_inet_network (ifname, &in_addr)) { #ifdef IF_DEBUG - struct in_addr t = { .s_addr = htonl (in_addr.s_addr) }; + { + struct in_addr t; + t.s_addr = htonl (in_addr.s_addr); pgm_debug ("IPv4 network address: %s", inet_ntoa (t)); + } #endif if (IN_MULTICAST(in_addr.s_addr)) { pgm_set_error (error, @@ -357,11 +373,13 @@ ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } + { struct sockaddr_in s4; memset (&s4, 0, sizeof(s4)); s4.sin_family = AF_INET; s4.sin_addr.s_addr = htonl (in_addr.s_addr); memcpy (addr, &s4, sizeof(s4)); + } check_inet_network = TRUE; check_addr = TRUE; @@ -386,12 +404,13 @@ if (!check_addr) { char errbuf[1024]; - struct addrinfo hints = { - .ai_family = family, - .ai_socktype = SOCK_STREAM, /* not really, SOCK_RAW */ - .ai_protocol = IPPROTO_TCP, /* not really, IPPROTO_PGM */ - .ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST /* AI_V4MAPPED is unhelpful */ - }, *res; + struct addrinfo hints, *res; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; /* not really, SOCK_RAW */ + hints.ai_protocol = IPPROTO_TCP; /* not really, IPPROTO_PGM */ + hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; /* AI_V4MAPPED is unhelpful */ + { const int eai = getaddrinfo (ifname, NULL, &hints, &res); switch (eai) { case 0: @@ -438,6 +457,7 @@ eai); return FALSE; } + } } /* network name into network address, can be expensive with NSS network lookup @@ -523,12 +543,13 @@ if (!check_addr) { char errbuf[1024]; - struct addrinfo hints = { - .ai_family = family, - .ai_socktype = SOCK_STREAM, /* not really, SOCK_RAW */ - .ai_protocol = IPPROTO_TCP, /* not really, IPPROTO_PGM */ - .ai_flags = AI_ADDRCONFIG, /* AI_V4MAPPED is unhelpful */ - }, *result, *res; + struct addrinfo hints, *result, *res; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; /* not really, SOCK_RAW */ + hints.ai_protocol = IPPROTO_TCP; /* not really, IPPROTO_PGM */ + hints.ai_flags = AI_ADDRCONFIG; /* AI_V4MAPPED is unhelpful */ + { const int eai = getaddrinfo (ifname, NULL, &hints, &result); switch (eai) { case 0: @@ -634,6 +655,7 @@ eai); return FALSE; } + } } /* iterate through interface list and match device name, ip or net address */ @@ -666,13 +688,15 @@ continue; } + { const unsigned ifindex = pgm_if_nametoindex (ifa->ifa_addr->sa_family, ifa->ifa_name); pgm_assert (0 != ifindex); /* check numeric host */ if (check_addr) { - for (unsigned i = 0; i < addr_cnt; i++) + unsigned i; + for (i = 0; i < addr_cnt; i++) { if (0 == pgm_sockaddr_cmp (ifa->ifa_addr, (const struct sockaddr*)&addr[i])) { @@ -694,9 +718,9 @@ if (check_inet_network && AF_INET == ifa->ifa_addr->sa_family) { - const struct in_addr ifaddr = { .s_addr = ntohl (((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr) }; - const struct in_addr netmask = { .s_addr = ntohl (((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr.s_addr) }; - struct in_addr lna; + struct in_addr ifaddr, netmask, lna; + ifaddr.s_addr = ntohl (((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr); + netmask.s_addr = ntohl (((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr.s_addr); /* local network address must be null, otherwise should match an address is previous check */ if (!pgm_inet_lnaof (&lna, &in_addr, &netmask) && @@ -801,6 +825,7 @@ memcpy (&ir->ir_addr, ifa->ifa_addr, pgm_sockaddr_len (ifa->ifa_addr)); continue; } + } } if (0 == interface_matches) { @@ -896,6 +921,7 @@ } /* NSS network */ + { const struct pgm_netent_t* ne = pgm_getnetbyname (group); /* ne::n_net in host byte order */ if (ne) { @@ -963,15 +989,17 @@ return FALSE; } } + } /* lookup group through name service */ - struct addrinfo hints = { - .ai_family = family, - .ai_socktype = SOCK_STREAM, /* not really, SOCK_RAW */ - .ai_protocol = IPPROTO_TCP, /* not really, IPPROTO_PGM */ - .ai_flags = AI_ADDRCONFIG, /* AI_V4MAPPED is unhelpful */ - }, *result, *res; - + { + struct addrinfo hints, *result, *res; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; /* not really, SOCK_RAW */ + hints.ai_protocol = IPPROTO_TCP; /* not really, IPPROTO_PGM */ + hints.ai_flags = AI_ADDRCONFIG; /* AI_V4MAPPED is unhelpful */ + { const int eai = getaddrinfo (group, NULL, &hints, &result); if (0 != eai) { char errbuf[1024]; @@ -1006,6 +1034,8 @@ group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); freeaddrinfo (result); return FALSE; + } + } } /* parse an interface entity from a network parameter. @@ -1058,6 +1088,7 @@ } /* check interface name length limit */ + { char** tokens = pgm_strsplit (entity, ",", 10); int j = 0; while (tokens && tokens[j]) @@ -1092,6 +1123,7 @@ pgm_strfreev (tokens); *interface_list = source_list; + } return TRUE; } @@ -1133,6 +1165,7 @@ (const void*)recv_list, (const void*)error); + { struct group_source_req* recv_gsr; struct interface_req* primary_interface = (struct interface_req*)pgm_memdup ((*interface_list)->data, sizeof(struct interface_req)); @@ -1145,6 +1178,7 @@ recv_gsr->gsr_group.ss_family = family; /* track IPv6 scope from any resolved interface */ + { unsigned scope_id = 0; /* if using unspec default group check the interface for address family @@ -1250,11 +1284,13 @@ *recv_list = pgm_list_append (*recv_list, recv_gsr); pgm_free (primary_interface); return TRUE; + } } /* parse one or more multicast receive groups. */ + { int j = 0; char** tokens = pgm_strsplit (entity, ",", 10); while (tokens && tokens[j]) @@ -1331,6 +1367,8 @@ pgm_strfreev (tokens); pgm_free (primary_interface); return TRUE; + } + } } static @@ -1359,6 +1397,7 @@ (const void*)send_list, (const void*)error); + { struct group_source_req* send_gsr; const struct interface_req* primary_interface = (struct interface_req*)(*interface_list)->data; @@ -1413,6 +1452,7 @@ *send_list = pgm_list_append (*send_list, send_gsr); return TRUE; + } } /* parse network parameter @@ -1545,6 +1585,7 @@ } /* entity from b to p-1 */ + { char entity[1024]; pgm_strncpy_s (entity, sizeof (entity), b, p - b); @@ -1602,6 +1643,7 @@ b = ++p; continue; + } } p++; @@ -1751,6 +1793,7 @@ if (!network_parse (network, family, &recv_list, &send_list, error)) return FALSE; + { const size_t recv_list_len = pgm_list_length (recv_list); const size_t send_list_len = pgm_list_length (send_list); ai = pgm_malloc0 (sizeof(struct pgm_addrinfo_t) + @@ -1760,6 +1803,7 @@ ai->ai_send_addrs_len = (uint32_t)send_list_len; ai->ai_send_addrs = (void*)((char*)ai->ai_recv_addrs + recv_list_len * sizeof(struct group_source_req)); + { size_t i = 0; while (recv_list) { memcpy (&ai->ai_recv_addrs[i++], recv_list->data, sizeof(struct group_source_req)); @@ -1774,6 +1818,8 @@ } *res = ai; return TRUE; + } + } } void libpgm-5.1.118-1~dfsg/openpgm/pgm/reed_solomon.c.c89.patch0000644000175000017500000002145611640407354022104 0ustar locallocal--- reed_solomon.c 2011-03-23 14:18:08.000000000 +0800 +++ reed_solomon.c89.c 2011-03-23 14:18:30.000000000 +0800 @@ -48,6 +48,7 @@ return; #ifdef CONFIG_GALOIS_MUL_LUT + { const pgm_gf8_t* gfmul_b = &pgm_gftable[ (uint16_t)b << 8 ]; #endif @@ -90,6 +91,10 @@ #endif i++; } + +#ifdef CONFIG_GALOIS_MUL_LUT + } +#endif } /* Basic matrix multiplication. @@ -111,19 +116,28 @@ const uint16_t p ) { - for (uint_fast16_t j = 0; j < m; j++) { - for (uint_fast16_t i = 0; i < p; i++) + uint_fast16_t j; + for (j = 0; j < m; j++) + { + { + uint_fast16_t i; + for (i = 0; i < p; i++) { pgm_gf8_t sum = 0; - for (uint_fast16_t k = 0; k < n; k++) + { + uint_fast16_t k; + for (k = 0; k < n; k++) { sum ^= pgm_gfmul ( a[ (j * n) + k ], b[ (k * p) + i ] ); } + } c[ (j * p) + i ] = sum; } + } + } } } @@ -144,15 +158,16 @@ const uint8_t n ) { - uint8_t pivot_rows[ n ]; - uint8_t pivot_cols[ n ]; - bool pivots[ n ]; + uint8_t* pivot_rows = pgm_newa (uint8_t, n); + uint8_t* pivot_cols = pgm_newa (uint8_t, n); + bool* pivots = pgm_newa (bool, n); + pgm_gf8_t* identity = pgm_newa (pgm_gf8_t, n); memset (pivots, 0, sizeof(pivots)); - - pgm_gf8_t identity[ n ]; memset (identity, 0, sizeof(identity)); - for (uint_fast8_t i = 0; i < n; i++) + { + uint_fast8_t i; + for (i = 0; i < n; i++) { uint_fast8_t row = 0, col = 0; @@ -163,11 +178,15 @@ } else { - for (uint_fast8_t j = 0; j < n; j++) + { + uint_fast8_t j; + for (j = 0; j < n; j++) { if (pivots[ j ]) continue; - for (uint_fast8_t x = 0; x < n; x++) + { + uint_fast8_t x; + for (x = 0; x < n; x++) { if (!pivots[ x ] && M[ (j * n) + x ]) { @@ -176,6 +195,8 @@ goto found; } } + } + } } } @@ -185,12 +206,15 @@ /* pivot */ if (row != col) { - for (uint_fast8_t x = 0; x < n; x++) + { + uint_fast8_t x; + for (x = 0; x < n; x++) { pgm_gf8_t *pivot_row = &M[ (row * n) + x ], *pivot_col = &M[ (col * n) + x ]; SWAP( *pivot_row, *pivot_col ); } + } } /* save location */ @@ -203,44 +227,59 @@ const pgm_gf8_t c = M[ (col * n) + col ]; M[ (col * n) + col ] = 1; - for (uint_fast8_t x = 0; x < n; x++) + { + uint_fast8_t x; + for (x = 0; x < n; x++) { M[ (col * n) + x ] = pgm_gfdiv( M[ (col * n) + x ], c ); } + } } /* reduce if not an identity row */ identity[ col ] = 1; if (memcmp (&M[ (col * n) ], identity, n * sizeof(pgm_gf8_t))) { - for ( uint_fast8_t x = 0; + { + uint_fast8_t x; + for ( x = 0; x < n; x++ ) { if (x == col) continue; + { const pgm_gf8_t c = M[ (x * n) + col ]; M[ (x * n) + col ] = 0; _pgm_gf_vec_addmul (&M[ x * n ], c, &M[ col * n ], n); + } + } } } identity[ col ] = 0; } + } /* revert all pivots */ - for (int_fast16_t i = n - 1; i >= 0; i--) + { + int_fast16_t i; + for (i = n - 1; i >= 0; i--) { if (pivot_rows[ i ] != pivot_cols[ i ]) { - for (uint_fast8_t j = 0; j < n; j++) + { + uint_fast8_t j; + for (j = 0; j < n; j++) { pgm_gf8_t *pivot_row = &M[ (j * n) + pivot_rows[ i ] ], *pivot_col = &M[ (j * n) + pivot_cols[ i ] ]; SWAP( *pivot_row, *pivot_col ); } + } } } + } } /* Gauss–Jordan elimination optimised for Vandermonde matrices @@ -278,49 +317,73 @@ * 1: Work out coefficients. */ - pgm_gf8_t P[ n ]; + { + pgm_gf8_t* P = pgm_newa (pgm_gf8_t, n); memset (P, 0, sizeof(P)); /* copy across second row, i.e. j = 2 */ - for (uint_fast8_t i = 0; i < n; i++) + { + uint_fast8_t i; + for (i = 0; i < n; i++) { P[ i ] = V[ (i * n) + 1 ]; } + } - pgm_gf8_t alpha[ n ]; + { + pgm_gf8_t* alpha = pgm_newa (pgm_gf8_t, n); memset (alpha, 0, sizeof(alpha)); alpha[ n - 1 ] = P[ 0 ]; - for (uint_fast8_t i = 1; i < n; i++) { - for (uint_fast8_t j = (n - i); j < (n - 1); j++) + uint_fast8_t i; + for (i = 1; i < n; i++) + { + { + uint_fast8_t j; + for (j = (n - i); j < (n - 1); j++) { alpha[ j ] ^= pgm_gfmul( P[ i ], alpha[ j + 1 ] ); } + } alpha[ n - 1 ] ^= P[ i ]; } + } /* 2: Obtain numberators and denominators by synthetic division. */ - pgm_gf8_t b[ n ]; + { + pgm_gf8_t* b = pgm_newa (pgm_gf8_t, n); b[ n - 1 ] = 1; - for (uint_fast8_t j = 0; j < n; j++) + { + uint_fast8_t j; + for (j = 0; j < n; j++) { const pgm_gf8_t xx = P[ j ]; pgm_gf8_t t = 1; /* skip first iteration */ - for (int_fast16_t i = n - 2; i >= 0; i--) + { + int_fast16_t i; + for (i = n - 2; i >= 0; i--) { b[ i ] = alpha[ i + 1 ] ^ pgm_gfmul( xx, b[ i + 1 ] ); t = pgm_gfmul( xx, t ) ^ b[ i ]; } + } - for (uint_fast8_t i = 0; i < n; i++) + { + uint_fast8_t i; + for (i = 0; i < n; i++) { V[ (i * n) + j ] = pgm_gfdiv ( b[ i ], t ); } + } + } + } + } + } } } @@ -360,23 +423,31 @@ * * Be careful, Harry! */ + { #ifdef CONFIG_PREFER_MALLOC pgm_gf8_t* V = pgm_new0 (pgm_gf8_t, n * k); #else pgm_gf8_t* V = pgm_newa (pgm_gf8_t, n * k); memset (V, 0, n * k); #endif + { pgm_gf8_t* p = V + k; V[0] = 1; - for (uint_fast8_t j = 0; j < (n - 1); j++) { - for (uint_fast8_t i = 0; i < k; i++) + uint_fast8_t j; + for (j = 0; j < (n - 1); j++) + { + { + uint_fast8_t i; + for (i = 0; i < k; i++) { /* the {i, j} entry of V_{k,n} is v_{i,j} = α^^(i×j), * where 0 <= i <= k - 1 and 0 <= j <= n - 1. */ *p++ = pgm_gfantilog[ ( i * j ) % PGM_GF_MAX ]; } + } + } } /* This generator matrix would create a Maximum Distance Separable (MDS) @@ -387,6 +458,7 @@ * * 1: matrix V_{k,k} formed by the first k columns of V_{k,n} */ + { pgm_gf8_t* V_kk = V; pgm_gf8_t* V_kn = V + (k * k); @@ -404,10 +476,16 @@ /* 4: set identity matrix for original data */ - for (uint_fast8_t i = 0; i < k; i++) + { + uint_fast8_t i; + for (i = 0; i < k; i++) { rs->GM[ (i * k) + i ] = 1; } + } + } + } + } } PGM_GNUC_INTERNAL @@ -450,11 +528,14 @@ pgm_assert (len > 0); memset (dst, 0, len); - for (uint_fast8_t i = 0; i < rs->k; i++) + { + uint_fast8_t i; + for (i = 0; i < rs->k; i++) { const pgm_gf8_t c = rs->GM[ (offset * rs->k) + i ]; _pgm_gf_vec_addmul (dst, c, src[i], len); } + } } /* original data block of packets with missing packet entries replaced @@ -477,7 +558,9 @@ /* create new recovery matrix from generator */ - for (uint_fast8_t i = 0; i < rs->k; i++) + { + uint_fast8_t i; + for (i = 0; i < rs->k; i++) { if (offsets[i] < rs->k) { memset (&rs->RM[ i * rs->k ], 0, rs->k * sizeof(pgm_gf8_t)); @@ -486,34 +569,46 @@ } memcpy (&rs->RM[ i * rs->k ], &rs->GM[ offsets[ i ] * rs->k ], rs->k * sizeof(pgm_gf8_t)); } + } /* invert */ _pgm_matinv (rs->RM, rs->k); - pgm_gf8_t* repairs[ rs->k ]; + { + pgm_gf8_t** repairs = pgm_newa (pgm_gf8_t*, rs->k); /* multiply out, through the length of erasures[] */ - for (uint_fast8_t j = 0; j < rs->k; j++) + { + uint_fast8_t j; + for (j = 0; j < rs->k; j++) { if (offsets[ j ] < rs->k) continue; + { #ifdef CONFIG_PREFER_MALLOC pgm_gf8_t* erasure = repairs[ j ] = pgm_malloc0 (len); #else pgm_gf8_t* erasure = repairs[ j ] = pgm_alloca (len); memset (erasure, 0, len); #endif - for (uint_fast8_t i = 0; i < rs->k; i++) + { + uint_fast8_t i; + for (i = 0; i < rs->k; i++) { pgm_gf8_t* src = block[ i ]; pgm_gf8_t c = rs->RM[ (j * rs->k) + i ]; _pgm_gf_vec_addmul (erasure, c, src, len); } + } + } + } } /* move repaired over parity packets */ - for (uint_fast8_t j = 0; j < rs->k; j++) + { + uint_fast8_t j; + for (j = 0; j < rs->k; j++) { if (offsets[ j ] < rs->k) continue; @@ -523,6 +618,8 @@ pgm_free (repairs[ j ]); #endif } + } + } } /* entire FEC block of original data and parity packets. @@ -546,7 +643,9 @@ /* create new recovery matrix from generator */ - for (uint_fast8_t i = 0; i < rs->k; i++) + { + uint_fast8_t i; + for (i = 0; i < rs->k; i++) { if (offsets[i] < rs->k) { memset (&rs->RM[ i * rs->k ], 0, rs->k * sizeof(pgm_gf8_t)); @@ -555,28 +654,39 @@ } memcpy (&rs->RM[ i * rs->k ], &rs->GM[ offsets[ i ] * rs->k ], rs->k * sizeof(pgm_gf8_t)); } + } /* invert */ _pgm_matinv (rs->RM, rs->k); /* multiply out, through the length of erasures[] */ - for (uint_fast8_t j = 0; j < rs->k; j++) + { + uint_fast8_t j; + for (j = 0; j < rs->k; j++) { if (offsets[ j ] < rs->k) continue; + { uint_fast8_t p = rs->k; pgm_gf8_t* erasure = block[ j ]; - for (uint_fast8_t i = 0; i < rs->k; i++) + { + uint_fast8_t i; + for (i = 0; i < rs->k; i++) { pgm_gf8_t* src; if (offsets[ i ] < rs->k) src = block[ i ]; else src = block[ p++ ]; + { const pgm_gf8_t c = rs->RM[ (j * rs->k) + i ]; _pgm_gf_vec_addmul (erasure, c, src, len); + } + } } + } + } } } libpgm-5.1.118-1~dfsg/openpgm/pgm/get_nprocs.c0000644000175000017500000001106611640407354020056 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable function to return number of available, online, or * configured processors. * * Copyright (c) 2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #ifndef _WIN32 # include # include # if defined( __sun ) # include # endif # include # if defined( __APPLE__ ) # include # endif #endif #include //#define GET_NPROCS_DEBUG #ifdef __APPLE__ /* processor binding is not supported, as per 10.5 Affinity API release notes. * * sysctl may be compatible with *BSD platforms. */ static int _pgm_apple_get_nprocs (void) { int online = 0, configured = 0; int mib[2]; size_t len; mib[0] = CTL_HW; mib[1] = HW_AVAILCPU; len = sizeof (int); sysctl (mib, 2, &online, &len, NULL, 0); mib[1] = HW_NCPU; len = sizeof (int); sysctl (mib, 2, &configured, &len, NULL, 0); if (online > configured) online = configured; pgm_minor (_("Detected %d online %d configured CPUs."), online, configured); return (online > 0) ? online : configured; } #endif #ifdef _WIN32 static int _pgm_win32_get_nprocs (void) { int available = 0, online = 0, configured = 0; DWORD_PTR process_mask, system_mask; DWORD_PTR mask; SYSTEM_INFO si; if (GetProcessAffinityMask (GetCurrentProcess(), &process_mask, &system_mask)) { for (mask = process_mask; mask != 0; mask >>= 1) if (mask & 1) available++; } GetSystemInfo (&si); configured = (int)si.dwNumberOfProcessors; for (mask = si.dwActiveProcessorMask; mask != 0; mask >>= 1) if (mask & 1) online++; if (online > configured) online = configured; if (available > online) available = online; pgm_minor (_("Detected %d available %d online %d configured CPUs."), available, online, configured); return (available > 0) ? available : ((online > 0) ? online : configured); } #endif #ifdef PS_MYID /* Solaris processor set API */ static int _pgm_pset_get_nprocs (void) { uint_t available = 0; pset_info (PS_MYID, NULL, &available, NULL); return (int)available; } #endif #if defined( CPU_SETSIZE ) /* returns the caller's thread ID (TID). In a single-threaded process, the * thread ID is equal to the process ID (PID). */ static pid_t _pgm_gettid (void) { # if defined ( SYS_gettid ) return (pid_t) syscall (SYS_gettid); # else return getpid(); # endif } /* Linux CPU affinity system calls, also consider pthread_getaffinity_np(). */ static int _pgm_sched_get_nprocs (void) { int available = 0; cpu_set_t cpu_set; if (0 == sched_getaffinity (_pgm_gettid(), sizeof (cpu_set), &cpu_set)) for (int i = 0; i < CPU_SETSIZE; i++) if (CPU_ISSET (i, &cpu_set)) available++; return available; } #endif #if defined( _SC_NPROCESSORS_ONLN ) || defined( _SC_NPROCESSORS_CONF ) static int _pgm_sysconf_get_nprocs (void) { int available = 0, online = 0, configured = 0; # ifdef _SC_NPROCESSORS_ONLN online = (int)sysconf (_SC_NPROCESSORS_ONLN); # endif # ifdef _SC_NPROCESSORS_CONF configured = (int)sysconf (_SC_NPROCESSORS_CONF); # endif if (online > configured) online = configured; #if defined( PS_MYID ) available = _pgm_pset_get_nprocs(); #elif defined( CPU_SETSIZE ) available = _pgm_sched_get_nprocs(); #endif if (available > online) available = online; pgm_minor (_("Detected %d available %d online %d configured CPUs."), available, online, configured); return (available > 0) ? available : ((online > 0) ? online : configured); } #endif /* returns number of processors */ PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { #if defined( __APPLE__ ) return _pgm_apple_get_nprocs(); #elif defined( _WIN32 ) return _pgm_win32_get_nprocs(); #elif defined( _SC_NPROCESSORS_ONLN ) || defined( _SC_NPROCESSORS_CONF ) return _pgm_sysconf_get_nprocs(); #else # error "Unsupported processor enumeration on this platform." #endif } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/version.pl0000755000175000017500000000075411640407354017576 0ustar locallocal#!/usr/bin/perl # -*- perl -*- # Extract version number from version_generator.py and dump to stdout. # # For Autoconf/libtool & CMake open (MOO, 'version_generator.py') || die "version.py: error: version_generator.py not found.\n"; while () { if (/pgm_(major|minor|micro)_version = (\d+);/) { $version{$1} = $2; } } $_ = "%major.%minor.%micro"; $_ = "${ARGV[0]}" if ($ARGV[0]); s/%major/${version{'major'}}/g; s/%minor/${version{'minor'}}/g; s/%micro/${version{'micro'}}/g; print; libpgm-5.1.118-1~dfsg/openpgm/pgm/options.txt0000644000175000017500000000742011640407354020002 0ustar locallocal OPT_LENGTH 0x00 - Option's Length pgm_opt_header pgm_opt_length first option, always present. -------------------------------------------------------------------------------- OPT_FRAGMENT 0x01 - Fragmentation pgm_opt_header pgm_opt_fragment may be present for odata, rdata. 'MAY' exist for others, although a bit strange. -------------------------------------------------------------------------------- OPT_NAK_LIST 0x02 - List of NAK entries pgm_opt_header pgm_opt_nak_list may be present for naks. -------------------------------------------------------------------------------- OPT_JOIN 0x03 - Late Joining pgm_opt_header pgm_opt_join may be present for odata, rdata, spm. requires SPM to learn NLA already so not overly useful with odata/rdata, could be used with video streaming to last i-frame data sequence number. -------------------------------------------------------------------------------- OPT_REDIRECT 0x07 - Redirect pgm_opt_header pgm_opt_redirect pgm_opt_redirect6 should be present for polrs from a dlr. -------------------------------------------------------------------------------- OPT_SYN 0x0D - Synchronization pgm_opt_header pgm_opt_syn must only appear with odata or rdata. -------------------------------------------------------------------------------- OPT_FIN 0x0E - Session Fin receivers, conventional feedbackish pgm_opt_header opt_opt_fin may be present for odata, rdata, must appear in following spms. -------------------------------------------------------------------------------- OPT_RST 0x0F - Session Reset pgm_opt_header pgm_opt_rst must only appear in spms. not many 'unrecoverable error conditions' exist though. -------------------------------------------------------------------------------- OPT_PARITY must appear in odata or rdata to indicate pro-active or on-demand parity data, nak to request parity repair data, ncf to confirm parity nak. OPT_VAR_PKTLEN may be present in odata or data to indicate variable size packets. OPT_PARITY_PRM 0x08 - Forward Error Correction Parameters pgm_opt_header pgm_opt_parity_prm appended to spms to inform of pro-active or on-demand parity. -------------------------------------------------------------------------------- OPT_PARITY_GRP 0x09 - Forward Error Correction Group Number pgm_opt_parity_grp appended to odata and rdata parity packets. -------------------------------------------------------------------------------- OPT_CURR_TGSIZE 0x0A - Forward Error Correction Group Size pgm_opt_curr_tgsize must appear in last odata or rdata packet of variable transmission group, may appear in spms. -------------------------------------------------------------------------------- OPT_CR 0x10 - Congestion Report pgm_opt_header pgm_opt_cr -------------------------------------------------------------------------------- OPT_CRQST 0x11 - Congestion Report Request pgm_opt_header pgm_opt_crqst -------------------------------------------------------------------------------- OPT_NAK_BO_IVL 0x04 - NAK Back-Off Interval pgm_opt_header pgm_opt_nak_bo_ivl -------------------------------------------------------------------------------- OPT_NAK_BO_RNG 0x05 - NAK Back-Off Range pgm_opt_header pgm_opt_nak_bo_rng -------------------------------------------------------------------------------- OPT_NBR_UNREACH 0x0B - Neighbor Unreachable pgm_opt_header pgm_opt_nbr_unreach -------------------------------------------------------------------------------- OPT_PATH_NLA 0x0C - Path NLA pgm_opt_header pgm_opt_path_nla pgm_opt6_path_nla -------------------------------------------------------------------------------- OPT_INVALID 0x7F - Option invalidated libpgm-5.1.118-1~dfsg/openpgm/pgm/htdocs/0000755000175000017500000000000011640407424017025 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/htdocs/xhtml10_strict.doctype0000644000175000017500000000030111640407352023275 0ustar locallocal libpgm-5.1.118-1~dfsg/openpgm/pgm/htdocs/convert_to_macro.pl0000755000175000017500000000056711640407352022740 0ustar locallocal#!/usr/bin/perl use strict; use File::Basename; die "usage: $0 [text file]\n" unless ($ARGV[0]); open(MOO, $ARGV[0]) or die "cannot open $ARGV[0]: $!"; my $all = do { local $/; }; close(MOO); $all =~ s/"/\\"/g; $all =~ s/\n/\\n/mg; $all =~ s/\r/\\r/mg; my $var = uc (basename($ARGV[0])); $var =~ s/\s+/_/g; $var =~ s/\./_/g; print< OpenPGM - Page Not Found

Lah, page not found.

Return to main page

libpgm-5.1.118-1~dfsg/openpgm/pgm/htdocs/base.css0000644000175000017500000000374611640407352020463 0ustar locallocalhtml { background-color: white; font-family: Verdana; font-size: 12px; color: black; } a, a:link, a:visited { color: #0033cc; text-decoration: none; } #header { text-align: right; } #header #hostname { font-weight: bold; } #header a { color: black; } #header a:hover { text-decoration: underline; } #footer { clear: both; margin-top: 3.5em; margin-bottom: 1em; padding-top: 20px; text-align: center; } #navigation a { color: black; } #navigation .tab { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; padding: 4px 1em 2px; margin-right: 8px; float: left; font-weight: bold; } #navigation #tabtop,#tabline { background-color: #fb879c; } #navigation #tabbottom { background-color: #fbc1a9; } #navigation #tabline { clear: left; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; height: 4px; } #content { margin-top: 6px; padding: 3px; } #content a:hover { background: #ffffaa; } .heading { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; background-color: #fb879c; padding: 6px; margin-bottom: 3px; } table { border-collapse: separate; } th { text-align: left; } #information { float: right; } .rounded { background-color: #fbc1a9; -moz-border-radius: 4px; -webkit-border-radius: 4px; padding: 5px; margin-top: 6px; margin-bottom: 6px; width: 25em; } .break { border-top: 3px solid white; margin-top: 1em; padding-top: 6px; } .bubbly { background-color: #fb879c; -moz-border-radius: 4px; -webkit-border-radius: 4px; padding: 4px; } .bubbly table { width: 100%; } .bubbly th,.bubbly td { border-bottom: 1px solid #bbbbbb; } .bubbly th { background-color: #fbc1a9; border-left: 1px solid #bbbbbb; padding: 2px 1px 2px 2px; } .bubbly td { background-color: white; padding: 4px; } .bubbly .empty { padding: 3em; text-align: center; } libpgm-5.1.118-1~dfsg/openpgm/pgm/openpgm.spec.in0000644000175000017500000000522511640407354020475 0ustar locallocalName: openpgm Version: @PACKAGE_VERSION@ Release: 1%{?dist} Summary: An implementation of the PGM reliable multicast protocol. Group: System Environment/Libraries License: LGPL 2.1 license URL: http://code.google.com/p/openpgm/ Source: http://openpgm.googlecode.com/files/%{name}-%{version}.tar.gz Prefix: %{_prefix} Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: python, perl %description OpenPGM is an open source implementation of the Pragmatic General Multicast (PGM) specification in RFC 3208 available at www.ietf.org. %package devel Summary: Development files and static library for the OpenPGM library Group: Development/Libraries Requires: %{name} = %{version}-%{release}, pkgconfig %description devel OpenPGM is an open source implementation of the Pragmatic General Multicast (PGM) specification in RFC 3208 available at www.ietf.org. This package contains OpenPGM related development libraries and header files. %prep %setup -q %build %configure %{__make} %{?_smp_mflags} %install [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} # Install the package to build area %makeinstall %post /sbin/ldconfig %postun /sbin/ldconfig %clean [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} %files %defattr(-,root,root,-) # libraries %{_libdir}/libpgm-@RELEASE_INFO@.so.0 %{_libdir}/libpgm-@RELEASE_INFO@.so.0.0.@VERSION_MICRO@ %files devel %defattr(-,root,root,-) %{_includedir}/pgm-@RELEASE_INFO@/pgm/atomic.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/engine.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/error.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/gsi.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/if.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/in.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/list.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/macros.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/mem.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/messages.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/msgv.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/packet.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/pgm.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/skbuff.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/socket.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/time.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/tsi.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/types.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/version.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/winint.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/wininttypes.h %{_includedir}/pgm-@RELEASE_INFO@/pgm/zinttypes.h %{_libdir}/libpgm.a %{_libdir}/libpgm.la %{_libdir}/libpgm.so %{_libdir}/pkgconfig/openpgm-@RELEASE_INFO@.pc %changelog * Fri Apr 8 2011 Mikko Koppanen 5.1.116-1 - Initial packaging libpgm-5.1.118-1~dfsg/openpgm/pgm/depcomp0000755000175000017500000004224611640410472017123 0ustar locallocal#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2006-10-15.18 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: libpgm-5.1.118-1~dfsg/openpgm/pgm/indextoaddr.c0000644000175000017500000000515111640407354020216 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable interface index to socket address function. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include //#define INDEXTOADDR_DEBUG /* interfaces indexes refer to the link layer, we want to find the internet layer address. * the big problem is that multiple IPv6 addresses can be bound to one link - called scopes. * we can just pick the first scope and let IP routing handle the rest. */ PGM_GNUC_INTERNAL bool pgm_if_indextoaddr ( const unsigned ifindex, const sa_family_t iffamily, const uint32_t ifscope, struct sockaddr* restrict ifsa, pgm_error_t** restrict error ) { pgm_return_val_if_fail (NULL != ifsa, FALSE); if (0 == ifindex) /* any interface or address */ { ifsa->sa_family = iffamily; switch (iffamily) { case AF_INET: ((struct sockaddr_in*)ifsa)->sin_addr.s_addr = INADDR_ANY; break; case AF_INET6: ((struct sockaddr_in6*)ifsa)->sin6_addr = in6addr_any; break; default: pgm_return_val_if_reached (FALSE); break; } return TRUE; } struct pgm_ifaddrs_t *ifap, *ifa; if (!pgm_getifaddrs (&ifap, error)) { pgm_prefix_error (error, _("Enumerating network interfaces: ")); return FALSE; } for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (NULL == ifa->ifa_addr || ifa->ifa_addr->sa_family != iffamily) continue; const unsigned i = pgm_if_nametoindex (iffamily, ifa->ifa_name); pgm_assert (0 != i); if (i == ifindex) { if (ifscope && ifscope != pgm_sockaddr_scope_id (ifa->ifa_addr)) continue; memcpy (ifsa, ifa->ifa_addr, pgm_sockaddr_len(ifa->ifa_addr)); pgm_freeifaddrs (ifap); return TRUE; } } pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("No matching network interface index: %i"), ifindex); pgm_freeifaddrs (ifap); return FALSE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/net.c0000644000175000017500000001242111640407354016475 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * network send wrapper. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #ifdef CONFIG_HAVE_POLL # include #endif #ifndef _WIN32 # include # include # include #endif #include #include #include #include //#define NET_DEBUG /* locked and rate regulated sendto * * on success, returns number of bytes sent. on error, -1 is returned, and * errno set appropriately. */ PGM_GNUC_INTERNAL ssize_t pgm_sendto_hops ( pgm_sock_t* restrict sock, bool use_rate_limit, pgm_rate_t* restrict minor_rate_control, bool use_router_alert, int hops, /* -1 == system default */ const void* restrict buf, size_t len, const struct sockaddr* restrict to, socklen_t tolen ) { pgm_assert( NULL != sock ); pgm_assert( NULL != buf ); pgm_assert( len > 0 ); pgm_assert( NULL != to ); pgm_assert( tolen > 0 ); #ifdef NET_DEBUG char saddr[INET_ADDRSTRLEN]; pgm_sockaddr_ntop (to, saddr, sizeof(saddr)); pgm_debug ("pgm_sendto (sock:%p use_rate_limit:%s minor_rate_control:%p use_router_alert:%s buf:%p len:%" PRIzu " to:%s [toport:%d] tolen:%d)", (const void*)sock, use_rate_limit ? "TRUE" : "FALSE", (const void*)minor_rate_control, use_router_alert ? "TRUE" : "FALSE", (const void*)buf, len, saddr, ntohs (((const struct sockaddr_in*)to)->sin_port), (int)tolen); #endif const SOCKET send_sock = use_router_alert ? sock->send_with_router_alert_sock : sock->send_sock; if (use_rate_limit) { if (NULL == minor_rate_control) { if (!pgm_rate_check (&sock->rate_control, len, sock->is_nonblocking)) { pgm_set_last_sock_error (PGM_SOCK_ENOBUFS); return (const ssize_t)-1; } } else { if (!pgm_rate_check2 (&sock->rate_control, minor_rate_control, len, sock->is_nonblocking)) { pgm_set_last_sock_error (PGM_SOCK_ENOBUFS); return (const ssize_t)-1; } } } if (!use_router_alert && sock->can_send_data) pgm_mutex_lock (&sock->send_mutex); if (-1 != hops) pgm_sockaddr_multicast_hops (send_sock, sock->send_gsr.gsr_group.ss_family, hops); ssize_t sent = sendto (send_sock, buf, len, 0, to, (socklen_t)tolen); pgm_debug ("sendto returned %" PRIzd, sent); if (sent < 0) { int save_errno = pgm_get_last_sock_error(); if (PGM_UNLIKELY(save_errno != PGM_SOCK_ENETUNREACH && /* Network is unreachable */ save_errno != PGM_SOCK_EHOSTUNREACH && /* No route to host */ save_errno != PGM_SOCK_EAGAIN)) /* would block on non-blocking send */ { #ifdef CONFIG_HAVE_POLL /* poll for cleared socket */ struct pollfd p = { .fd = send_sock, .events = POLLOUT, .revents = 0 }; const int ready = poll (&p, 1, 500 /* ms */); #else fd_set writefds; FD_ZERO(&writefds); FD_SET(send_sock, &writefds); # ifndef _WIN32 const int n_fds = send_sock + 1; /* largest fd + 1 */ # else const int n_fds = 1; /* count of fds */ # endif struct timeval tv = { .tv_sec = 0, .tv_usec = 500 /* ms */ * 1000 }; const int ready = select (n_fds, NULL, &writefds, NULL, &tv); #endif /* CONFIG_HAVE_POLL */ if (ready > 0) { sent = sendto (send_sock, buf, len, 0, to, (socklen_t)tolen); if ( sent < 0 ) { char errbuf[1024]; char toaddr[INET6_ADDRSTRLEN]; save_errno = pgm_get_last_sock_error(); pgm_sockaddr_ntop (to, toaddr, sizeof(toaddr)); pgm_warn (_("sendto() %s failed: %s"), toaddr, pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } } else if (ready == 0) { char toaddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop (to, toaddr, sizeof(toaddr)); pgm_warn (_("sendto() %s failed: socket timeout."), toaddr); } else { char errbuf[1024]; save_errno = pgm_get_last_sock_error(); pgm_warn (_("blocked socket failed: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); } } } /* revert to default value hop limit */ if (-1 != hops) pgm_sockaddr_multicast_hops (send_sock, sock->send_gsr.gsr_group.ss_family, sock->hops); if (!use_router_alert && sock->can_send_data) pgm_mutex_unlock (&sock->send_mutex); return sent; } /* socket helper, for setting pipe ends non-blocking * * on success, returns 0. on error, returns -1, and sets errno appropriately. */ PGM_GNUC_INTERNAL int pgm_set_nonblocking ( SOCKET fd[2] ) { /* pre-conditions */ pgm_assert (fd[0]); pgm_assert (fd[1]); pgm_sockaddr_nonblocking (fd[0], TRUE); pgm_sockaddr_nonblocking (fd[1], TRUE); return 0; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/engine_unittest.c0000644000175000017500000001413611640407354021120 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for PGM engine. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* getprotobyname_r */ #define _BSD_SOURCE 1 #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ struct pgm_rwlock_t; struct pgm_slist_t; static gint mock_time_init = 0; static struct pgm_rwlock_t mock_pgm_sock_list_lock; static struct pgm_slist_t* mock_pgm_sock_list = NULL; #define pgm_time_init mock_pgm_time_init #define pgm_time_shutdown mock_pgm_time_shutdown #define pgm_close mock_pgm_close #define pgm_sock_list_lock mock_pgm_sock_list_lock #define pgm_sock_list mock_pgm_sock_list #define ENGINE_DEBUG #include "engine.c" static void mock_setup (void) { mock_time_init = FALSE; } static void mock_teardown (void) { // null } /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } PGM_GNUC_INTERNAL bool mock_pgm_time_init ( pgm_error_t** error ) { mock_time_init++; return TRUE; } PGM_GNUC_INTERNAL bool mock_pgm_time_shutdown (void) { if (!mock_time_init) return FALSE; mock_time_init--; return TRUE; } bool mock_pgm_close ( pgm_sock_t* sock, bool flush ) { return TRUE; } /* target: * bool * pgm_init (pgm_error_t** error) */ /* reference counting on init */ START_TEST (test_init_pass_001) { fail_unless (TRUE == pgm_init (NULL), "init failed"); fail_unless (TRUE == pgm_init (NULL), "init failed"); #ifdef PGM_CHECK_NOFORK /* clean up state */ fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_shutdown (), "shutdown failed"); #endif } END_TEST /* timing module already init */ START_TEST (test_init_pass_003) { pgm_error_t* err = NULL; fail_unless (TRUE == pgm_time_init (&err), "time-init failed: %s", (err && err->message) ? err->message : "(null)"); fail_unless (TRUE == pgm_init (&err), "init failed: %s", (err && err->message) ? err->message : "(null)"); fail_unless (TRUE == pgm_init (&err), "init failed: %s", (err && err->message) ? err->message : "(null)"); #ifdef PGM_CHECK_NOFORK /* clean up state */ fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_time_shutdown (), "time-shutdown failed"); fail_unless (FALSE == pgm_time_shutdown (), "time-shutdown failed"); #endif } END_TEST /* target: * bool * pgm_shutdown (void) */ START_TEST (test_shutdown_pass_001) { fail_unless (TRUE == pgm_init (NULL), "init failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); #ifdef PGM_CHECK_NOFORK fail_unless (FALSE == pgm_shutdown (), "shutdown failed"); #endif } END_TEST /* no init */ START_TEST (test_shutdown_pass_002) { fail_unless (FALSE == pgm_shutdown (), "shutdown failed"); } END_TEST /* double call */ START_TEST (test_shutdown_pass_003) { fail_unless (TRUE == pgm_init (NULL), "init failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_shutdown (), "shutdown failed"); } END_TEST /* check reference counting */ START_TEST (test_shutdown_pass_004) { fail_unless (TRUE == pgm_init (NULL), "init failed"); fail_unless (TRUE == pgm_init (NULL), "init failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_shutdown (), "shutdown failed"); } END_TEST /* target: * bool * pgm_supported (void) */ START_TEST (test_supported_pass_001) { fail_unless (FALSE == pgm_supported(), "supported failed"); fail_unless (TRUE == pgm_init (NULL), "init failed"); fail_unless (TRUE == pgm_supported(), "supported failed"); fail_unless (TRUE == pgm_shutdown (), "shutdown failed"); fail_unless (FALSE == pgm_supported(), "supported failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_init = tcase_create ("init"); tcase_add_checked_fixture (tc_init, mock_setup, mock_teardown); suite_add_tcase (s, tc_init); tcase_add_test (tc_init, test_init_pass_001); tcase_add_test (tc_init, test_init_pass_003); TCase* tc_shutdown = tcase_create ("shutdown"); tcase_add_checked_fixture (tc_shutdown, mock_setup, mock_teardown); suite_add_tcase (s, tc_shutdown); tcase_add_test (tc_shutdown, test_shutdown_pass_001); tcase_add_test (tc_shutdown, test_shutdown_pass_002); tcase_add_test (tc_shutdown, test_shutdown_pass_003); tcase_add_test (tc_shutdown, test_shutdown_pass_004); TCase* tc_supported = tcase_create ("supported"); tcase_add_checked_fixture (tc_supported, mock_setup, mock_teardown); suite_add_tcase (s, tc_supported); tcase_add_test (tc_supported, test_supported_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/packet_parse.c.c89.patch0000644000175000017500000000720411640407354022053 0ustar locallocal--- packet_parse.c 2011-03-12 10:17:18.000000000 +0800 +++ packet_parse.c89.c 2011-03-12 10:48:01.000000000 +0800 @@ -117,6 +117,7 @@ */ /* decode IP header */ + { const struct pgm_ip* ip = (struct pgm_ip*)skb->data; switch (ip->ip_v) { case 4: { @@ -142,16 +143,18 @@ return FALSE; } + { const size_t ip_header_length = ip->ip_hl * 4; /* IP header length in 32bit octets */ if (PGM_UNLIKELY(ip_header_length < sizeof(struct pgm_ip))) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("IP header reports an invalid header length %" PRIzu " bytes."), - ip_header_length); + (unsigned long)ip_header_length); return FALSE; } + { #ifndef CONFIG_HOST_ORDER_IP_LEN size_t packet_length = ntohs (ip->ip_len); /* total packet length */ #else @@ -173,13 +176,14 @@ PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("IP packet received at %" PRIu16 " bytes whilst IP header reports %" PRIzu " bytes."), - skb->len, packet_length); + skb->len, (unsigned long)packet_length); return FALSE; } /* packets that fail checksum will generally not be passed upstream except with rfc3828 */ #ifdef PGM_CHECK_IN_CKSUM + { const uint16_t sum = in_cksum (data, packet_length, 0); if (PGM_UNLIKELY(0 != sum)) { const uint16_t ip_sum = ntohs (ip->ip_sum); @@ -190,9 +194,11 @@ ip_sum, sum); return FALSE; } + } #endif /* fragmentation offset, bit 0: 0, bit 1: do-not-fragment, bit 2: more-fragments */ + { #ifndef CONFIG_HOST_ORDER_IP_OFF const uint16_t offset = ntohs (ip->ip_off); #else @@ -228,8 +234,12 @@ /* advance DATA pointer to PGM packet */ skb->data = skb->pgm_header; - skb->len -= ip_header_length; + skb->len = (uint16_t)(skb->len - ip_header_length); return pgm_parse (skb, error); + } + } + } + } } PGM_GNUC_INTERNAL @@ -246,7 +256,7 @@ PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("UDP payload too small for PGM packet at %" PRIu16 " bytes, expecting at least %" PRIzu " bytes."), - skb->len, sizeof(struct pgm_header)); + skb->len, (unsigned long)sizeof(struct pgm_header)); return FALSE; } @@ -257,6 +267,7 @@ /* will modify packet contents to calculate and check PGM checksum */ + static bool pgm_parse ( @@ -272,6 +283,7 @@ { const uint16_t sum = skb->pgm_header->pgm_checksum; skb->pgm_header->pgm_checksum = 0; + { const uint16_t pgm_sum = pgm_csum_fold (pgm_csum_partial ((const char*)skb->pgm_header, skb->len, 0)); skb->pgm_header->pgm_checksum = sum; if (PGM_UNLIKELY(pgm_sum != sum)) { @@ -282,6 +294,7 @@ pgm_sum, sum); return FALSE; } + } } else { if (PGM_ODATA == skb->pgm_header->pgm_type || PGM_RDATA == skb->pgm_header->pgm_type) @@ -336,6 +349,7 @@ /* pre-conditions */ pgm_assert (NULL != skb); + { const struct pgm_spm* spm = (const struct pgm_spm*)skb->data; switch (ntohs (spm->spm_nla_afi)) { /* truncated packet */ @@ -353,6 +367,7 @@ } return TRUE; + } } /* 14.7.1. Poll Request @@ -391,6 +406,7 @@ /* pre-conditions */ pgm_assert (NULL != skb); + { const struct pgm_poll* poll4 = (const struct pgm_poll*)skb->data; switch (ntohs (poll4->poll_nla_afi)) { /* truncated packet */ @@ -408,6 +424,7 @@ } return TRUE; + } } /* 14.7.2. Poll Response @@ -496,6 +513,7 @@ if (PGM_UNLIKELY(skb->len < PGM_MIN_NAK_SIZE)) return FALSE; + { const struct pgm_nak* nak = (struct pgm_nak*)skb->data; const uint16_t nak_src_nla_afi = ntohs (nak->nak_src_nla_afi); uint16_t nak_grp_nla_afi = 0; @@ -539,6 +557,7 @@ } return TRUE; + } } /* 8.3. N-NAK libpgm-5.1.118-1~dfsg/openpgm/pgm/galois_generator.pl0000755000175000017500000000656411640407354021442 0ustar locallocal#!/usr/bin/perl # # Galois field table generator. # # Copyright (c) 2006-2010 Miru Limited. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA use strict; my $GF_ELEMENT_BYTES = 1; my $GF_ELEMENT_BITS = 8 * $GF_ELEMENT_BYTES; my $GF_NO_ELEMENTS = 1 << $GF_ELEMENT_BITS; my $GF_MAX = $GF_NO_ELEMENTS - 1; my $GF_GENERATOR = 0x11d; my @gflog; my @gfantilog; my $j = 1; for (my $i = 0; $i < $GF_MAX; $i++) { $gflog[ $j ] = $i; $gfantilog[ $i ] = $j; $j <<= 1; if ($j & $GF_NO_ELEMENTS) { $j ^= $GF_GENERATOR; } } $gflog[ 0 ] = $GF_MAX; $gfantilog[ $GF_MAX ] = 0; print< /* globals */ const pgm_gf8_t pgm_gflog[PGM_GF_NO_ELEMENTS] = { MOO # print out y = log₂(x) table for (my $i = 0; $i < $GF_NO_ELEMENTS; $i++) { print "\t" if ($i % 8 == 0); print sprintf("0x%2.2x", $gflog[ $i ]); print ',' unless ($i == $GF_MAX); print ( (($i % 8) == 7) ? "\n" : ' ' ); } print<= $GF_MAX) ? $gfantilog[ $sum - $GF_MAX ] : $gfantilog[ $sum ]; } # print out multiplication table z = x • y for (my $i = 0; $i < $GF_NO_ELEMENTS; $i++) { for (my $j = 0; $j < $GF_NO_ELEMENTS; $j++) { print "\t" if ($j % 8 == 0); print sprintf("0x%2.2x", gfmul( $i, $j )); print ',' unless ($i == $GF_MAX && $j == $GF_MAX); print ( (($j % 8) == 7) ? "\n" : ' ' ); } } print<. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: openpgm-dev@googlegroups.com about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenPGM' PACKAGE_TARNAME='openpgm' PACKAGE_VERSION='5.1.118' PACKAGE_STRING='OpenPGM 5.1.118' PACKAGE_BUGREPORT='openpgm-dev@googlegroups.com' PACKAGE_URL='http://code.google.com/p/openpgm/' ac_unique_file="reed_solomon.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS ALLOCA LIBTOOL_DEPS PYTHON PERL CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC VERSION_MICRO VERSION_MINOR VERSION_MAJOR VERSION_INFO RELEASE_INFO AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures OpenPGM 5.1.118 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/openpgm] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of OpenPGM 5.1.118:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . OpenPGM home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF OpenPGM configure 5.1.118 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* 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 $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------------- ## ## Report this to openpgm-dev@googlegroups.com ## ## ------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenPGM $as_me 5.1.118, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Ubuntu 10 : v1.11 # OSX 10.6 : v1.10 # Solaris 10 : v1.8 am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='openpgm' VERSION='5.1.118' # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac AM_BACKSLASH='\' RELEASE_INFO=5.1 VERSION_INFO=0:118 VERSION_MAJOR=5 VERSION_MINOR=1 VERSION_MICRO=118 # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4' macro_revision='1.3293' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$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_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' lt_prog_compiler_pic='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # nb: earliest verifiable version is 2.2. # Apply system specific rules. CFLAGS="$CFLAGS -D_REENTRANT" case "$host_os" in linux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE" ;; solaris*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} 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 socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket; 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_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostname" >&5 $as_echo_n "checking for library containing gethostname... " >&6; } if ${ac_cv_search_gethostname+:} 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 gethostname (); int main () { return gethostname (); ; return 0; } _ACEOF for ac_lib in '' nsl; 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_gethostname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostname+:} false; then : break fi done if ${ac_cv_search_gethostname+:} false; then : else ac_cv_search_gethostname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostname" >&5 $as_echo "$ac_cv_search_gethostname" >&6; } ac_res=$ac_cv_search_gethostname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_aton" >&5 $as_echo_n "checking for library containing inet_aton... " >&6; } if ${ac_cv_search_inet_aton+:} 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 inet_aton (); int main () { return inet_aton (); ; return 0; } _ACEOF for ac_lib in '' resolv; 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_inet_aton=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_inet_aton+:} false; then : break fi done if ${ac_cv_search_inet_aton+:} false; then : else ac_cv_search_inet_aton=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_aton" >&5 $as_echo "$ac_cv_search_inet_aton" >&6; } ac_res=$ac_cv_search_inet_aton if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing kstat_open" >&5 $as_echo_n "checking for library containing kstat_open... " >&6; } if ${ac_cv_search_kstat_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 kstat_open (); int main () { return kstat_open (); ; return 0; } _ACEOF for ac_lib in '' kstat; 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_kstat_open=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_kstat_open+:} false; then : break fi done if ${ac_cv_search_kstat_open+:} false; then : else ac_cv_search_kstat_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_kstat_open" >&5 $as_echo "$ac_cv_search_kstat_open" >&6; } ac_res=$ac_cv_search_kstat_open if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ;; *) ;; esac # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} 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 sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; 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_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_mutex_trylock" >&5 $as_echo_n "checking for library containing pthread_mutex_trylock... " >&6; } if ${ac_cv_search_pthread_mutex_trylock+:} 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 pthread_mutex_trylock (); int main () { return pthread_mutex_trylock (); ; return 0; } _ACEOF for ac_lib in '' pthread; 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_pthread_mutex_trylock=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pthread_mutex_trylock+:} false; then : break fi done if ${ac_cv_search_pthread_mutex_trylock+:} false; then : else ac_cv_search_pthread_mutex_trylock=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_mutex_trylock" >&5 $as_echo "$ac_cv_search_pthread_mutex_trylock" >&6; } ac_res=$ac_cv_search_pthread_mutex_trylock if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} 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 clock_gettime (); int main () { return clock_gettime (); ; 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_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_clock_gettime+:} false; then : break fi done if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Checks for header files. ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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 CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 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: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_header in arpa/inet.h fcntl.h float.h inttypes.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.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 # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" case $ac_cv_c_int64_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int64_t $ac_cv_c_int64_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int * int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int main () { int s[1]; int * $ac_kw t = s; t[0] = 0; return foo(t) ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 $as_echo "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) $as_echo "#define restrict /**/" >>confdefs.h ;; *) cat >>confdefs.h <<_ACEOF #define restrict $ac_cv_c_restrict _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) $as_echo "#define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint64_t $ac_cv_c_uint64_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # Checks for library functions. # TODO: gettext() fails out-of-the-box from AutoConf. #AM_GNU_GETTEXT for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=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: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$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 getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=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: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=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: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in atexit clock_gettime floor ftime gethostbyaddr gethostbyname gethostname gettimeofday inet_ntoa memmove memset regcomp select setenv setlocale socket sqrt stpcpy strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul strtoull 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 # POSIX spinlocks { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_spinlock" >&5 $as_echo_n "checking for pthread_spinlock... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_spinlock_t spinlock; pthread_spin_lock (&spinlock); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_POSIX_SPINLOCK" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # NSS protocol lookup ac_fn_c_check_func "$LINENO" "getprotobyname_r" "ac_cv_func_getprotobyname_r" if test "x$ac_cv_func_getprotobyname_r" = xyes; then : fi if test "x$ac_cv_func_getprotobyname_r" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 4- or 5-param getprotobyname_r" >&5 $as_echo_n "checking for 4- or 5-param getprotobyname_r... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { getprotobyname_r ((const char*)0, (struct protoent*)0, (char*)0, (size_t)0, (struct protoent**)0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: 5-param" >&5 $as_echo "5-param" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R2" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: 4-param" >&5 $as_echo "4-param" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GETPROTOBYNAME_R" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # NSS networks lookup, IPv4 only ac_fn_c_check_func "$LINENO" "getnetent" "ac_cv_func_getnetent" if test "x$ac_cv_func_getnetent" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_GETNETENT" fi # variadic macros { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 variadic macros" >&5 $as_echo_n "checking for C99 variadic macros... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #define error(...) fprintf (stderr, __VA_ARGS__) int main () { error("moo"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_ISO_VARARGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU-style variadic macros" >&5 $as_echo_n "checking for GNU-style variadic macros... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #define error(x...) fprintf (stderr, x) int main () { error("moo"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_GNUC_VARARGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # stack memory api header { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca.h" >&5 $as_echo_n "checking for alloca.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { void* ptr = alloca (1); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_ALLOCA_H" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # eventfd API { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eventfd" >&5 $as_echo_n "checking for eventfd... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { eventfd (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_EVENTFD" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # useful /proc system { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/cpuinfo" >&5 $as_echo_n "checking for /proc/cpuinfo... " >&6; } if ${ac_cv_file__proc_cpuinfo+:} 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 "/proc/cpuinfo"; then ac_cv_file__proc_cpuinfo=yes else ac_cv_file__proc_cpuinfo=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_cpuinfo" >&5 $as_echo "$ac_cv_file__proc_cpuinfo" >&6; } if test "x$ac_cv_file__proc_cpuinfo" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_PROC" fi # example: crash handling ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_BACKTRACE" fi # timing ac_fn_c_check_func "$LINENO" "pselect" "ac_cv_func_pselect" if test "x$ac_cv_func_pselect" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_PSELECT" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/rtc" >&5 $as_echo_n "checking for /dev/rtc... " >&6; } if ${ac_cv_file__dev_rtc+:} 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/rtc"; then ac_cv_file__dev_rtc=yes else ac_cv_file__dev_rtc=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_rtc" >&5 $as_echo "$ac_cv_file__dev_rtc" >&6; } if test "x$ac_cv_file__dev_rtc" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_RTC" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RDTSC instruction" >&5 $as_echo_n "checking for RDTSC instruction... " >&6; } case "$host_os" in darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { unsigned long lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_TSC" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/hpet" >&5 $as_echo_n "checking for /dev/hpet... " >&6; } if ${ac_cv_file__dev_hpet+:} 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/hpet"; then ac_cv_file__dev_hpet=yes else ac_cv_file__dev_hpet=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_hpet" >&5 $as_echo "$ac_cv_file__dev_hpet" >&6; } if test "x$ac_cv_file__dev_hpet" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_HPET" fi # event handling ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" if test "x$ac_cv_func_poll" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_POLL" fi ac_fn_c_check_func "$LINENO" "epoll_ctl" "ac_cv_func_epoll_ctl" if test "x$ac_cv_func_epoll_ctl" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_EPOLL" fi # interface enumeration ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" if test "x$ac_cv_func_getifaddrs" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_GETIFADDRS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct ifreq.ifr_netmask" >&5 $as_echo_n "checking for struct ifreq.ifr_netmask... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct ifaddrs ifa; ifa.ifa_netmask = (struct sockaddr*)0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_IFR_NETMASK" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # win32 cmsg ac_fn_c_check_member "$LINENO" "struct _WSAMSG" "name" "ac_cv_member_struct__WSAMSG_name" "$ac_includes_default" if test "x$ac_cv_member_struct__WSAMSG_name" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_WSACMSGHDR" fi # multicast { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct group_req.gr_interface" >&5 $as_echo_n "checking for struct group_req.gr_interface... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct group_req gr; gr.gr_interface = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_MCAST_JOIN" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct ip_mreqn.imr_ifindex" >&5 $as_echo_n "checking for struct ip_mreqn.imr_ifindex... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct ip_mreqn mreqn; mreqn.imr_ifindex = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_IP_MREQN" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # sprintf, caveat http://savannah.gnu.org/patch/?6848 (ax_c_printf_thsep) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf thousands' grouping" >&5 $as_echo_n "checking for printf thousands' grouping... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { printf ("%'d", 1000000); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HAVE_SPRINTF_GROUPING" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" if test "x$ac_cv_func_vasprintf" = xyes; then : CFLAGS="$CFLAGS -DCONFIG_HAVE_VASPRINTF" fi # symbol linking scope # nb: sun x86 ld doesn't support DSO visibility but the compiler raises # warnings and these are easier to detect in autoconf. save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidden visibility attribute" >&5 $as_echo_n "checking for hidden visibility attribute... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __SUNPRO_C __hidden #else __attribute__((visibility("hidden"))) #endif void moo (void) {}; int main () { moo(); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$save_CFLAGS -DCONFIG_HAVE_DSO_VISIBILITY" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$save_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # socket binding CFLAGS="$CFLAGS -DCONFIG_BIND_INADDR_ANY" # IP header order as per IP(4) on FreeBSD { $as_echo "$as_me:${as_lineno-$LINENO}: checking for raw IP sockets ip_{len,off} host byte ordering" >&5 $as_echo_n "checking for raw IP sockets ip_{len,off} host byte ordering... " >&6; } case "$host_os" in *openbsd*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *bsd*|*darwin*|*osf*|*unixware*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DCONFIG_HOST_ORDER_IP_LEN -DCONFIG_HOST_ORDER_IP_OFF" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac # extended assembler on SPARC case "$host" in sparc-sun-solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPARC extended assembler" >&5 $as_echo_n "checking for SPARC extended assembler... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include uint32_t add32_with_carry (uint32_t a, uint32_t b) { __asm__ ( "addcc %2, %0, %0\n\taddx %0, %%g0, %0" : "=r" (a) : "0" (a), "r" (b) : "cc"); return a; } int main () { uint32_t c = add32_with_carry (1, 2); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: optimization required" >&5 $as_echo "optimization required" >&6; } CFLAGS="$CFLAGS -xO1" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; *) ;; esac # ticket spinlock friendly: unaligned pointers & atomic ops (excl. Sun Pro) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unaligned pointers" >&5 $as_echo_n "checking for unaligned pointers... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ char* nezumi = "mouse"; int main () { short x = *(short*)(nezumi + 2) ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } pgm_unaligned_pointers=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } pgm_unaligned_pointers=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}: checking for intrinsic atomic ops" >&5 $as_echo_n "checking for intrinsic atomic ops... " >&6; } # AC_PREPROC_IFELSE not always portable cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) /* GCC assembler */ #elif defined( __sun ) /* Solaris intrinsic */ #elif defined( __APPLE__ ) /* Darwin intrinsic */ #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) /* GCC 4.0.1 intrinsic */ #elif defined( _WIN32 ) /* Windows intrinsic */ #else # error "Unsupported atomic ops." #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } if test "$pgm_unaligned_pointers" = yes; then CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK -DCONFIG_DUMB_RWSPINLOCK" else CFLAGS="$CFLAGS -DCONFIG_TICKET_SPINLOCK" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_config_files="$ac_config_files Makefile openpgm-${RELEASE_INFO}.pc openpgm.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by OpenPGM $as_me 5.1.118, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to . OpenPGM home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ OpenPGM config.status 5.1.118 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "openpgm-${RELEASE_INFO}.pc") CONFIG_FILES="$CONFIG_FILES openpgm-${RELEASE_INFO}.pc" ;; "openpgm.spec") CONFIG_FILES="$CONFIG_FILES openpgm.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.Cygwin0000644000175000017500000002452411640407354021043 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine()); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('COVERAGE', 'test coverage', 'none', allowed_values=('none', 'full')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_XOPEN_SOURCE=600', '-D_BSD_SOURCE', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks # '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only # '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling # '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', # sprintf '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt' ], PROTOBUF_CCFLAGS = '-I/home/Administrator/protobuf-2.3.0/gcc4/include', PROTOBUF_LIBS = '/home/Administrator/protobuf-2.3.0/gcc4/lib/libprotobuf.a', PROTOBUF_PROTOC = '/home/Administrator/protobuf-2.3.0/gcc4/bin/protoc' ) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --agent-libs'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/test/0000755000175000017500000000000011640407424016520 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/test/ncf_list.pl0000755000175000017500000000344411640407354020670 0ustar locallocal#!/usr/bin/perl # ncf_list.pl # 9.3. NAK List Option - OPT_NAK_LIST use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); print "app: publish test data.\n"; $app->say ("send ao ringo"); $app->say ("send ao ichigo"); $app->say ("send ao momo"); my $odata = undef; my $ocnt = 0; for (1..3) { print "mon: wait for odata ...\n"; $odata = $mon->wait_for_odata; $ocnt++; print "mon: received $ocnt x odata.\n"; } print "sim: send nak to app.\n"; $sim->say ("net send nak ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 1,2,3"); print "mon: wait for ncf ...\n"; my $ncf = $mon->wait_for_ncf; print "mon: ncf received.\n"; die "ncfSqn != 1\n" unless $ncf->{PGM}->{ncfSqn} == 1; die "NCF list incorrect\n" unless ( $ncf->{PGM}->{pgmOptions}[1]->{sqn}[0] == 2 && $ncf->{PGM}->{pgmOptions}[1]->{sqn}[1] == 3 ); print "mon: ncf list correct: $ncf->{PGM}->{ncfSqn} + [$ncf->{PGM}->{pgmOptions}[1]->{sqn}[0], $ncf->{PGM}->{pgmOptions}[1]->{sqn}[1]]\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata_reception.pl0000755000175000017500000000261311640407354022224 0ustar locallocal#!/usr/bin/perl # odata_reception.pl # 6.1. Data Reception use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish ODATA sqn 90,000.\n"; $sim->say ("net send odata ao 90000 90000 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: received data [$data].\n"; # no NAKs should be generated. # TODO: test for silence in {mon} print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90000 ichigo"); print "app: wait for data ...\n"; $data = $app->wait_for_data; print "app: received data [$data].\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/async.c0000644000175000017500000003715211640407354020013 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Asynchronous queue for receiving packets in a separate managed thread. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #ifndef _WIN32 # include # include #endif #include #include #ifndef _WIN32 # include #else /* Windows libintl borken */ # define _(String) (String) #endif #include "async.h" //#define ASYNC_DEBUG #ifndef ASYNC_DEBUG # define g_trace(...) while (0) #else #include # define g_trace(...) g_debug(__VA_ARGS__) #endif /* globals */ #ifndef MSG_DONTWAIT # define MSG_DONTWAIT 0 #endif /* global locals */ typedef struct pgm_event_t pgm_event_t; struct pgm_event_t { gpointer data; guint len; }; /* external: Glib event loop GSource of pgm contiguous data */ struct pgm_watch_t { GSource source; GPollFD pollfd; pgm_async_t* async; }; typedef struct pgm_watch_t pgm_watch_t; static gboolean pgm_src_prepare (GSource*, gint*); static gboolean pgm_src_check (GSource*); static gboolean pgm_src_dispatch (GSource*, GSourceFunc, gpointer); static GSourceFuncs g_pgm_watch_funcs = { .prepare = pgm_src_prepare, .check = pgm_src_check, .dispatch = pgm_src_dispatch, .finalize = NULL, .closure_callback = NULL }; static inline gpointer pgm_event_alloc (pgm_async_t* const) G_GNUC_MALLOC; static PGMAsyncError pgm_async_error_from_errno (const gint); static inline gpointer pgm_event_alloc ( pgm_async_t* const async ) { g_return_val_if_fail (async != NULL, NULL); return g_slice_alloc (sizeof(pgm_event_t)); } /* release event memory for custom async queue dispatch handlers */ static inline void pgm_event_unref ( pgm_async_t* const async, pgm_event_t* const event ) { g_return_if_fail (async != NULL); g_return_if_fail (event != NULL); g_slice_free1 (sizeof(pgm_event_t), event); } /* internal receiver thread, sits in a loop processing incoming packets */ static gpointer pgm_receiver_thread ( gpointer data ) { g_assert (NULL != data); pgm_async_t* async = (pgm_async_t*)data; g_async_queue_ref (async->commit_queue); /* incoming message buffer */ struct pgm_msgv_t msgv; gsize bytes_read = 0; struct timeval tv; #ifdef _WIN32 SOCKET recv_sock, pending_sock; DWORD cEvents = 3; WSAEVENT waitEvents[ cEvents ]; DWORD dwTimeout, dwEvents; socklen_t socklen = sizeof (SOCKET); waitEvents[0] = async->destroy_event; waitEvents[1] = WSACreateEvent(); waitEvents[2] = WSACreateEvent(); pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen); WSAEventSelect (recv_sock, waitEvents[1], FD_READ); pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen); WSAEventSelect (pending_sock, waitEvents[2], FD_READ); #endif do { /* blocking read */ const int status = pgm_recvmsg (async->sock, &msgv, 0, &bytes_read, NULL); switch (status) { case PGM_IO_STATUS_NORMAL: { /* queue a copy to receiver */ pgm_event_t* event = pgm_event_alloc (async); event->data = bytes_read > 0 ? g_malloc (bytes_read) : NULL; event->len = bytes_read; gpointer dst = event->data; guint i = 0; while (bytes_read) { const struct pgm_sk_buff_t* skb = msgv.msgv_skb[i++]; g_assert (NULL != skb); g_assert (skb->len > 0); g_assert (skb->len <= bytes_read); memcpy (dst, skb->data, skb->len); dst = (char*)dst + skb->len; bytes_read -= skb->len; } /* prod pipe on edge */ g_async_queue_lock (async->commit_queue); g_async_queue_push_unlocked (async->commit_queue, event); if (g_async_queue_length_unlocked (async->commit_queue) == 1) { #ifndef _WIN32 const char one = '1'; const size_t writelen = write (async->commit_pipe[1], &one, sizeof(one)); g_assert (sizeof(one) == writelen); #else WSASetEvent (async->commit_event); #endif } g_async_queue_unlock (async->commit_queue); break; } case PGM_IO_STATUS_TIMER_PENDING: { socklen_t optlen = sizeof (tv); pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen); } goto block; case PGM_IO_STATUS_RATE_LIMITED: { socklen_t optlen = sizeof (tv); pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen); } /* fall through */ case PGM_IO_STATUS_WOULD_BLOCK: block: { #ifndef _WIN32 fd_set readfds; int fd = async->destroy_pipe[0], n_fds = 1 + fd; FD_ZERO(&readfds); FD_SET(fd, &readfds); if (-1 == pgm_select_info (async->sock, &readfds, NULL, &n_fds)) { g_trace ("select_info returned errno=%i",errno); goto cleanup; } const int ready = select (n_fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv); if (-1 == ready) { g_trace ("block returned errno=%i",errno); goto cleanup; } if (ready > 0 && FD_ISSET(fd, &readfds)) goto cleanup; #else dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE); switch (dwEvents) { case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break; case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break; default: break; } #endif break; } case PGM_IO_STATUS_ERROR: case PGM_IO_STATUS_EOF: goto cleanup; case PGM_IO_STATUS_RESET: { int is_abort_on_reset; socklen_t optlen = sizeof (is_abort_on_reset); pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_ABORT_ON_RESET, &is_abort_on_reset, &optlen); if (is_abort_on_reset) goto cleanup; break; } /* TODO: report to user */ case PGM_IO_STATUS_FIN: break; default: g_assert_not_reached(); } } while (!async->is_destroyed); cleanup: #ifdef _WIN32 WSACloseEvent (waitEvents[1]); WSACloseEvent (waitEvents[2]); #endif g_async_queue_unref (async->commit_queue); return NULL; } /* create asynchronous thread handler * * on success, 0 is returned. on error, -1 is returned, and errno set appropriately. * on invalid parameters, -EINVAL is returned. */ gboolean pgm_async_create ( pgm_async_t** async, pgm_sock_t* const sock, GError** error ) { pgm_async_t* new_async; g_return_val_if_fail (NULL != async, FALSE); g_return_val_if_fail (NULL != sock, FALSE); g_trace ("create (async:%p sock:%p error:%p)", (gpointer)async, (gpointer)sock, (gpointer)error); if (!g_thread_supported()) g_thread_init (NULL); new_async = g_new0 (pgm_async_t, 1); new_async->sock = sock; #ifndef _WIN32 int e; e = pipe (new_async->commit_pipe); const int flags = fcntl (new_async->commit_pipe[0], F_GETFL); fcntl (new_async->commit_pipe[0], F_SETFL, flags | O_NONBLOCK); g_assert (0 == e); e = pipe (new_async->destroy_pipe); g_assert (0 == e); #else new_async->commit_event = WSACreateEvent (); new_async->destroy_event = WSACreateEvent (); #endif /* _WIN32 */ new_async->commit_queue = g_async_queue_new(); /* setup new thread */ new_async->thread = g_thread_create_full (pgm_receiver_thread, new_async, 0, TRUE, TRUE, G_THREAD_PRIORITY_HIGH, error); if (NULL == new_async->thread) { g_async_queue_unref (new_async->commit_queue); #ifndef _WIN32 close (new_async->destroy_pipe[0]); close (new_async->destroy_pipe[1]); close (new_async->commit_pipe[0]); close (new_async->commit_pipe[1]); #else WSACloseEvent (new_async->destroy_event); WSACloseEvent (new_async->commit_event); #endif g_free (new_async); return FALSE; } /* return new object */ *async = new_async; return TRUE; } /* tell async thread to stop, wait for it to stop, then cleanup. * * on success, 0 is returned. if async is invalid, -EINVAL is returned. */ gboolean pgm_async_destroy ( pgm_async_t* const async ) { g_return_val_if_fail (NULL != async, FALSE); g_return_val_if_fail (!async->is_destroyed, FALSE); async->is_destroyed = TRUE; #ifndef _WIN32 const char one = '1'; const size_t writelen = write (async->destroy_pipe[1], &one, sizeof(one)); g_assert (sizeof(one) == writelen); #else WSASetEvent (async->destroy_event); #endif if (async->thread) g_thread_join (async->thread); if (async->commit_queue) { g_async_queue_unref (async->commit_queue); async->commit_queue = NULL; } #ifndef _WIN32 close (async->destroy_pipe[0]); close (async->destroy_pipe[1]); close (async->commit_pipe[0]); close (async->commit_pipe[1]); #else WSACloseEvent (async->destroy_event); WSACloseEvent (async->commit_event); #endif g_free (async); return TRUE; } /* queue to GSource and GMainLoop */ GSource* pgm_async_create_watch ( pgm_async_t* async ) { g_return_val_if_fail (async != NULL, NULL); GSource *source = g_source_new (&g_pgm_watch_funcs, sizeof(pgm_watch_t)); pgm_watch_t *watch = (pgm_watch_t*)source; watch->async = async; #ifndef _WIN32 watch->pollfd.fd = pgm_async_get_fd (async); #else watch->pollfd.fd = pgm_async_get_event (async); #endif watch->pollfd.events = G_IO_IN; g_source_add_poll (source, &watch->pollfd); return source; } /* pgm transport attaches to the callees context: the default context instead of * any internal contexts. */ int pgm_async_add_watch_full ( pgm_async_t* async, gint priority, pgm_eventfn_t function, gpointer user_data, GDestroyNotify notify ) { g_return_val_if_fail (async != NULL, -EINVAL); g_return_val_if_fail (function != NULL, -EINVAL); GSource* source = pgm_async_create_watch (async); if (priority != G_PRIORITY_DEFAULT) g_source_set_priority (source, priority); g_source_set_callback (source, (GSourceFunc)function, user_data, notify); guint id = g_source_attach (source, NULL); g_source_unref (source); return id; } int pgm_async_add_watch ( pgm_async_t* async, pgm_eventfn_t function, gpointer user_data ) { return pgm_async_add_watch_full (async, G_PRIORITY_HIGH, function, user_data, NULL); } /* returns TRUE if source has data ready, i.e. async queue is not empty * * called before event loop poll() */ static gboolean pgm_src_prepare ( GSource* source, gint* timeout ) { pgm_watch_t* watch = (pgm_watch_t*)source; /* infinite timeout */ *timeout = -1; return ( g_async_queue_length(watch->async->commit_queue) > 0 ); } /* called after event loop poll() * * return TRUE if ready to dispatch. */ static gboolean pgm_src_check ( GSource* source ) { pgm_watch_t* watch = (pgm_watch_t*)source; return ( g_async_queue_length(watch->async->commit_queue) > 0 ); } /* called when TRUE returned from prepare or check */ static gboolean pgm_src_dispatch ( GSource* source, GSourceFunc callback, gpointer user_data ) { g_trace ("pgm_src_dispatch (source:%p callback:() user-data:%p)", (gpointer)source, user_data); const pgm_eventfn_t function = (pgm_eventfn_t)callback; pgm_watch_t* watch = (pgm_watch_t*)source; pgm_async_t* async = watch->async; /* empty pipe */ #ifndef _WIN32 char tmp; while (sizeof(tmp) == read (async->commit_pipe[0], &tmp, sizeof(tmp))); #else WSAResetEvent (async->commit_event); #endif /* purge only one message from the asynchronous queue */ pgm_event_t* event = g_async_queue_try_pop (async->commit_queue); if (event) { /* important that callback occurs out of lock to allow PGM layer to add more messages */ (*function) (event->data, event->len, user_data); /* return memory to receive window */ if (event->len) g_free (event->data); pgm_event_unref (async, event); } return TRUE; } /* synchronous reading from the queue. * * returns GIOStatus with success, error, again, or eof. */ GIOStatus pgm_async_recv ( pgm_async_t* const async, gpointer data, const gsize len, gsize* const bytes_read, const int flags, /* MSG_DONTWAIT for non-blocking */ GError** error ) { g_return_val_if_fail (NULL != async, G_IO_STATUS_ERROR); if (len) g_return_val_if_fail (NULL != data, G_IO_STATUS_ERROR); g_trace ("pgm_async_recv (async:%p data:%p len:%" G_GSIZE_FORMAT" bytes-read:%p flags:%d error:%p)", (gpointer)async, data, len, (gpointer)bytes_read, flags, (gpointer)error); pgm_event_t* event = NULL; g_async_queue_lock (async->commit_queue); if (g_async_queue_length_unlocked (async->commit_queue) == 0) { g_async_queue_unlock (async->commit_queue); if (flags & MSG_DONTWAIT || async->is_nonblocking) return G_IO_STATUS_AGAIN; #ifndef _WIN32 fd_set readfds; int n_fds, ready, fd = async->commit_pipe[0]; do { FD_ZERO(&readfds); FD_SET(fd, &readfds); n_fds = fd + 1; ready = select (n_fds, &readfds, NULL, NULL, NULL); if (-1 == ready || async->is_destroyed) /* errno = EINTR */ return G_IO_STATUS_ERROR; } while (ready <= 0); char tmp; while (sizeof(tmp) == read (async->commit_pipe[0], &tmp, sizeof(tmp))); #else DWORD cEvents = 1; WSAEVENT waitEvents[ cEvents ]; waitEvents[0] = async->commit_event; WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, WSA_INFINITE, FALSE); WSAResetEvent (async->commit_event); #endif g_async_queue_lock (async->commit_queue); } event = g_async_queue_pop_unlocked (async->commit_queue); g_async_queue_unlock (async->commit_queue); /* pass data back to callee */ if (event->len > len) { *bytes_read = len; memcpy (data, event->data, *bytes_read); g_set_error (error, PGM_ASYNC_ERROR, PGM_ASYNC_ERROR_OVERFLOW, _("Message too large to be stored in buffer.")); pgm_event_unref (async, event); return G_IO_STATUS_ERROR; } if (bytes_read) *bytes_read = event->len; memcpy (data, event->data, event->len); /* cleanup */ if (event->len) g_free (event->data); pgm_event_unref (async, event); return G_IO_STATUS_NORMAL; } gboolean pgm_async_set_nonblocking ( pgm_async_t* const async, const gboolean nonblocking ) { g_return_val_if_fail (NULL != async, FALSE); async->is_nonblocking = nonblocking; return TRUE; } GQuark pgm_async_error_quark (void) { return g_quark_from_static_string ("pgm-async-error-quark"); } static PGMAsyncError pgm_async_error_from_errno ( const gint err_no ) { switch (err_no) { #ifdef EFAULT case EFAULT: return PGM_ASYNC_ERROR_FAULT; break; #endif #ifdef EMFILE case EMFILE: return PGM_ASYNC_ERROR_MFILE; break; #endif #ifdef ENFILE case ENFILE: return PGM_ASYNC_ERROR_NFILE; break; #endif default : return PGM_ASYNC_ERROR_FAILED; break; } } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/nak_parity.pl0000755000175000017500000000343211640407354021225 0ustar locallocal#!/usr/bin/perl # nak_parity.pl # 5.3. Repairs use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create ao"); $sim->say ("set ao FEC RS(255,4)"); $sim->say ("bind ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("set ao FEC RS(255,4)"); $app->say ("bind ao"); $app->say ("listen ao"); # to process NAK requests print "app: publish test data.\n"; $app->say ("send ao ringo"); $app->say ("send ao ichigo"); $app->say ("send ao momo"); $app->say ("send ao budo"); $app->say ("send ao nashi"); $app->say ("send ao anzu"); $app->say ("send ao kaki"); my $odata = undef; my $ocnt = 0; for (1..7) { print "mon: wait for odata ...\n"; $odata = $mon->wait_for_odata; $ocnt++; print "mon: received $ocnt x odata.\n"; } print "sim: send nak to app (transmission group = 0, packet count = 1).\n"; $sim->say ("net send parity nak ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 1"); print "mon: wait for rdata ...\n"; my $rdata = $mon->wait_for_rdata; print "mon: rdata received.\n"; die "Selective RDATA received, parityPacket=false\n" unless $rdata->{PGM}->{options}->{parityPacket}; print "Parity RDATA received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/monitor.c0000644000175000017500000002375011640407354020364 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM link monitor. * * Copyright (c) 2006-2007 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #ifndef _WIN32 # include # include # include # include # include # include # include #else # include # include #endif #include #include #include #include #include #include "dump-json.h" #ifndef _WIN32 # define closesocket close #endif #ifndef MSG_DONTWAIT # define MSG_DONTWAIT 0 #endif /* globals */ static const char* g_network = "239.192.0.1"; static struct in_addr g_filter /* = { 0 } */; static GIOChannel* g_io_channel = NULL; static GIOChannel* g_stdin_channel = NULL; static GMainLoop* g_loop = NULL; #ifndef _WIN32 static void on_signal (int, gpointer); #else static BOOL on_console_ctrl (DWORD); #endif static gboolean on_startup (gpointer); static gboolean on_mark (gpointer); static gboolean on_io_data (GIOChannel*, GIOCondition, gpointer); static gboolean on_io_error (GIOChannel*, GIOCondition, gpointer); static gboolean on_stdin_data (GIOChannel*, GIOCondition, gpointer); int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[] ) { /* pre-initialise PGM messages module to add hook for GLib logging */ pgm_messages_init(); log_init (); puts ("monitor"); /* dispatch loop */ g_loop = g_main_loop_new(NULL, FALSE); /* setup signal handlers */ #ifndef _WIN32 signal (SIGSEGV, on_sigsegv); signal (SIGHUP, SIG_IGN); pgm_signal_install (SIGINT, on_signal, g_loop); pgm_signal_install (SIGTERM, on_signal, g_loop); #else SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE); setvbuf (stdout, (char *) NULL, _IONBF, 0); #endif #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif g_filter.s_addr = 0; /* delayed startup */ puts ("scheduling startup."); g_timeout_add(0, (GSourceFunc)on_startup, NULL); puts ("entering main event loop ... "); g_main_loop_run(g_loop); puts ("event loop terminated, cleaning up."); /* cleanup */ g_main_loop_unref(g_loop); g_loop = NULL; if (g_io_channel) { puts ("closing socket."); GError *err = NULL; g_io_channel_shutdown (g_io_channel, FALSE, &err); g_io_channel = NULL; } if (g_stdin_channel) { puts ("unbinding stdin."); g_io_channel_unref (g_stdin_channel); g_stdin_channel = NULL; } puts ("finished."); #ifdef _WIN32 WSACleanup(); #endif pgm_messages_shutdown(); return 0; } #ifndef _WIN32 static void on_signal ( int signum, gpointer user_data ) { GMainLoop* loop = (GMainLoop*)user_data; g_message ("on_signal (signum:%d user-data:%p)", signum, user_data); g_main_loop_quit (loop); } #else static BOOL on_console_ctrl ( DWORD dwCtrlType ) { g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType); g_main_loop_quit (g_loop); return TRUE; } #endif /* !_WIN32 */ static gboolean on_startup ( G_GNUC_UNUSED gpointer data ) { int e; puts ("startup."); /* find PGM protocol id */ // TODO: fix valgrind errors int ipproto_pgm = IPPROTO_PGM; #if HAVE_GETPROTOBYNAME_R char b[1024]; struct protoent protobuf, *proto; e = getprotobyname_r("pgm", &protobuf, b, sizeof(b), &proto); if (e != -1 && proto != NULL) { if (proto->p_proto != ipproto_pgm) { printf("Setting PGM protocol number to %i from /etc/protocols.\n"); ipproto_pgm = proto->p_proto; } } #else struct protoent *proto = getprotobyname("pgm"); if (proto != NULL) { if (proto->p_proto != ipproto_pgm) { printf("Setting PGM protocol number to %i from /etc/protocols.\n", proto ->p_proto); ipproto_pgm = proto->p_proto; } } #endif /* open socket for snooping */ puts ("opening raw socket."); #ifndef _WIN32 int sock = socket(PF_INET, SOCK_RAW, ipproto_pgm); if (-1 == sock) { printf("socket failed: %s(%d)\n", strerror(errno), errno); if (EPERM == errno && 0 != getuid()) { puts ("PGM protocol requires this program to run as superuser."); } g_main_loop_quit(g_loop); return FALSE; } /* drop out of setuid 0 */ if (0 == getuid()) { puts ("dropping superuser privileges."); setuid((gid_t)65534); setgid((uid_t)65534); } #else SOCKET sock = socket(PF_INET, SOCK_RAW, ipproto_pgm); if (INVALID_SOCKET == sock) { printf("socket failed: (%d)\n", WSAGetLastError()); g_main_loop_quit(g_loop); return FALSE; } #endif #ifndef _WIN32 int optval = 1; #else DWORD optval = 1; #endif e = setsockopt(sock, IPPROTO_IP, IP_HDRINCL, (const char*)&optval, sizeof(optval)); if (-1 == e) { #ifndef _WIN32 printf("setsockopt(IP_HDRINCL) failed: %s(%d)\n", strerror(errno), errno); #else printf("setsockopt(IP_HDRINCL) failed: (%d)\n", WSAGetLastError()); #endif closesocket(sock); g_main_loop_quit(g_loop); return FALSE; } /* buffers */ socklen_t len = sizeof(optval); e = getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&optval, &len); if (e == 0) { printf ("receive buffer set at %i bytes.\n", (int)optval); } e = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*)&optval, &len); if (e == 0) { printf ("send buffer set at %i bytes.\n", (int)optval); } /* bind */ struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_ANY); e = bind(sock, (struct sockaddr*)&addr, sizeof(addr)); if (-1 == e) { #ifndef _WIN32 printf("bind failed: %s(%d)\n", strerror(errno), errno); #else printf("bind failed: %d\n", WSAGetLastError()); #endif closesocket(sock); g_main_loop_quit(g_loop); return FALSE; } /* multicast */ struct ip_mreq mreq; memset(&mreq, 0, sizeof(mreq)); mreq.imr_interface.s_addr = htonl(INADDR_ANY); printf ("listening on interface %s.\n", inet_ntoa(mreq.imr_interface)); mreq.imr_multiaddr.s_addr = inet_addr(g_network); printf ("subscription on multicast address %s.\n", inet_ntoa(mreq.imr_multiaddr)); e = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&mreq, sizeof(mreq)); if (-1 == e) { #ifndef _WIN32 printf("setsockopt(IP_ADD_MEMBERSHIP) failed: %s(%d)\n", strerror(errno), errno); #else printf("setsockopt(IP_ADD_MEMBERSHIP) failed: (%d)\n", WSAGetLastError()); #endif closesocket(sock); g_main_loop_quit(g_loop); return FALSE; } /* multicast loopback */ /* multicast ttl */ /* add socket to event manager */ #ifdef G_OS_UNIX g_io_channel = g_io_channel_unix_new (sock); #else g_io_channel = g_io_channel_win32_new_socket (sock); #endif printf ("socket opened with encoding %s.\n", g_io_channel_get_encoding(g_io_channel)); /* guint event = */ g_io_add_watch (g_io_channel, G_IO_IN | G_IO_PRI, on_io_data, NULL); /* guint event = */ g_io_add_watch (g_io_channel, G_IO_ERR | G_IO_HUP | G_IO_NVAL, on_io_error, NULL); /* add stdin to event manager */ #ifdef G_OS_UNIX g_stdin_channel = g_io_channel_unix_new (fileno(stdin)); #else g_stdin_channel = g_io_channel_win32_new_fd (fileno(stdin)); #endif printf ("binding stdin with encoding %s.\n", g_io_channel_get_encoding(g_stdin_channel)); g_io_add_watch (g_stdin_channel, G_IO_IN | G_IO_PRI, on_stdin_data, NULL); /* period timer to indicate some form of life */ // TODO: Gnome 2.14: replace with g_timeout_add_seconds() g_timeout_add(10 * 1000, (GSourceFunc)on_mark, NULL); puts ("READY"); fflush (stdout); return FALSE; } static gboolean on_mark ( G_GNUC_UNUSED gpointer data ) { g_message ("-- MARK --"); return TRUE; } static gboolean on_io_data ( GIOChannel* source, G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data ) { char buffer[4096]; int fd = g_io_channel_unix_get_fd(source); struct sockaddr_in addr; socklen_t addr_len = sizeof(addr); int len = recvfrom(fd, buffer, sizeof(buffer), MSG_DONTWAIT, (struct sockaddr*)&addr, &addr_len); if (g_filter.s_addr && g_filter.s_addr != addr.sin_addr.s_addr) { return TRUE; } printf ("%i bytes received from %s.\n", len, inet_ntoa(addr.sin_addr)); monitor_packet (buffer, len); fflush (stdout); return TRUE; } static gboolean on_io_error ( GIOChannel* source, G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data ) { puts ("on_error."); GError *err; g_io_channel_shutdown (source, FALSE, &err); /* remove event */ return FALSE; } /* process input commands from stdin/fd */ static gboolean on_stdin_data ( GIOChannel* source, G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data ) { gchar* str = NULL; gsize len = 0; gsize term = 0; GError* err = NULL; g_io_channel_read_line (source, &str, &len, &term, &err); if (len > 0) { if (term) str[term] = 0; if (strcmp(str, "quit") == 0) { g_main_loop_quit(g_loop); } else if (strncmp(str, "filter ", strlen("filter ")) == 0) { unsigned a, b, c, d; int retval = sscanf(str, "filter %u.%u.%u.%u", &a, &b, &c, &d); if (retval == 4) { g_filter.s_addr = (d << 24) | (c << 16) | (b << 8) | a; puts ("READY"); } else { printf ("invalid syntax for filter command."); } } else { printf ("unknown command: %s\n", str); } } fflush (stdout); g_free (str); return TRUE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spm.pl0000755000175000017500000000145611640407354017667 0ustar locallocal#!/usr/bin/perl # spm.pl # 5.1.4. Ambient SPMs use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $app->connect; sub close_ssh { $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); print "app: ready.\n"; print "mon: wait for spm ...\n"; $mon->wait_for_spm; print "mon: received spm.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spm_jump2.pl0000755000175000017500000000271211640407354021000 0ustar locallocal#!/usr/bin/perl # spm_jump2.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish SPM txw_trail 90,001 txw_lead 90,001 at spm_sqn 3201.\n"; $sim->say ("net send spm ao 3201 90001 90001"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; print "sim: NAK received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/outofwindow_ncf.pl0000755000175000017500000000602211640407354022274 0ustar locallocal#!/usr/bin/perl # outofwindow_ncf.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; ## first run through with regular NAK generation to get regular backoff interval print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); my $t0 = [gettimeofday]; print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; my $normal_backoff = tv_interval ( $t0, [gettimeofday] ); print "sim: NAK received in $normal_backoff seconds.\n"; ## cleanup by publishing repair data print "sim: publish RDATA sqn 90,002.\n"; $sim->say ("net send odata ao 90002 90001 momo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; ## second run with NAK suppression $t0 = [gettimeofday]; print "sim: publish ODATA sqn 90,005.\n"; $sim->say ("net send odata ao 90005 90001 anzu"); print "sim: publish NCF sqn 90,004.\n"; $sim->say ("net send ncf ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 90002"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; my $outofwindow_backoff = tv_interval ( $t0, [gettimeofday] ); print "sim: NAK received in $outofwindow_backoff seconds.\n"; # allow 100ms tolerance my $fabs = abs( ($outofwindow_backoff - $normal_backoff) * 1000 ); die "Out-of-window NCF altered back-off interval by $fabs ms.\n" unless ($fabs < 100); print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/rdata_completion_parity_var_pktlen.pl0000755000175000017500000000535411640407354026232 0ustar locallocal#!/usr/bin/perl # rdata_completion_parity_var_pktlen.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("set ao FEC RS(255,4)"); $app->say ("bind ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("set ao FEC RS(255,4)"); $sim->say ("bind ao"); print "sim: publish SPM txw_trail 32,769 txw_lead 32,768 at spm_sqn 3200, advertise on-demand parity, k=4.\n"; $sim->say ("net send spm ao 3200 32768 32767 on-demand 4"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 32,768.\n"; $sim->say ("net send odata ao 32768 32768 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 32,770.\n"; $sim->say ("net send odata ao 32770 32768 momo"); print "sim: publish ODATA sqn 32,771.\n"; $sim->say ("net send odata ao 32771 32768 yakitori"); print "sim: publish ODATA sqn 32,772.\n"; $sim->say ("net send odata ao 32772 32768 sasami"); print "sim: publish ODATA sqn 32,773.\n"; $sim->say ("net send odata ao 32773 32768 tebasaki"); print "sim: waiting for valid parity NAK.\n"; my $nak = $sim->wait_for_nak; die "Selective NAK received, parityPacket=false\n" unless $nak->{PGM}->{options}->{parityPacket}; print "sim: Parity NAK received.\n"; print "sim: publish parity RDATA, tg_sqn 32,768, pkt_cnt 1 (sqn 32,768).\n"; $sim->say ("net send parity rdata ao 32768 32768 ringo ichigo momo yakitori"); for (1..5) { print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spmr_after_spm.pl0000755000175000017500000000403211640407354022102 0ustar locallocal#!/usr/bin/perl # spmr.pl # 13.3.1. SPM Requests use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; my $t0 = [gettimeofday]; my $elapsed; ## spm hearbeats are going to clear out the data, lets wait for some quiet print "mon: wait for SPM interval > 5 seconds ...\n"; do { $mon->wait_for_spm; $elapsed = tv_interval ( $t0, [gettimeofday] ); print "mon: received SPM after $elapsed seconds.\n"; } while ($elapsed < 5); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; ## app needs to send packet for sim to learn of local NLA $app->say ("send ao budo"); print "sim: wait for odata ...\n"; $odata = $sim->wait_for_odata; print "sim: odata received.\n"; print "sim: request SPM via SPMR.\n"; $sim->say ("net send spmr ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort}"); $t0 = [gettimeofday]; print "sim: wait for SPM ...\n"; $sim->wait_for_spm; $elapsed = tv_interval ( $t0, [gettimeofday] ); print "sim: SPM received after $elapsed seconds.\n"; die "SPM interval too large, indicates heartbeat not SPMR induced.\n" unless ($elapsed < 5.0); print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/sudoers.example0000644000175000017500000000106311640407354021563 0ustar locallocal# /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Host alias specification # User alias specification User_Alias PGM_USER = steve-o # Cmnd alias specification Cmnd_Alias PGM_CONFORMANCE = /miru/projects/openpgm/pgm/ref/debug/test/* # Defaults Defaults !lecture,tty_tickets,!fqdn # User privilege specification root ALL=(ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # PGM testing PGM_USER ALL = NOPASSWD: PGM_CONFORMANCE libpgm-5.1.118-1~dfsg/openpgm/pgm/test/nak_cancellation.pl0000755000175000017500000000730111640407354022350 0ustar locallocal#!/usr/bin/perl # nak_cancellation.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use IO::Handle; use JSON; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); pipe(FROM_PARENT, TO_CHILD) or die "pipe: $!"; FROM_PARENT->autoflush(1); $mon->connect; $sim->connect; $app->connect; sub close_ssh { close FROM_PARENT; close TO_CHILD; $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("set ao NAK_BO_IVL 5000"); # increase to count for test system latency $app->say ("set ao NAK_RPT_IVL 10000"); $app->say ("set ao NAK_RDATA_IVL 10000"); $app->say ("set ao NAK_NCF_RETRIES 15"); $app->say ("set ao NAK_DATA_RETRIES 10"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); my $t0 = [gettimeofday]; if (my $pid = fork) { # parent close FROM_PARENT; sleep 10; print "app: wait for data ...\n"; my $data = $app->wait_for_data({ 'timeout' => 0 }); print "app: data received [$data].\n"; print TO_CHILD "die\n"; close TO_CHILD; waitpid($pid,0); } else { # child die "cannot fork: $!" unless defined $pid; close TO_CHILD; print "sim: loop waiting for NAKs ...\n"; my $fh = $sim->{in}; vec(my $rin, fileno(FROM_PARENT), 1) = 1; vec($rin, fileno($fh), 1) = 1; my $rout = undef; my $b = ''; my $state = 0; my $json = new JSON; my $io = IO::Handle->new_from_fd( fileno($fh), "r" ); my $cnt = 0; while (select($rout = $rin, undef, undef, undef)) { last if( vec($rout, fileno(FROM_PARENT), 1) ); while (defined($_ = $io->getline)) { chomp; my $l = $_; if ($state == 0) { if ($l =~ /{$/) { $state = 1; } else { print "sim [$l]\n"; last; } } if ($state == 1) { $b .= $l; if ($l =~ /^}$/) { $state = 0; my $obj = $json->decode($b); if ($obj->{PGM}->{type} =~ /NAK/) { $cnt++; my $elapsed = tv_interval ( $t0, [gettimeofday] ); print "sim: $cnt x NAK received in $elapsed seconds.\n"; $sim->say ("net send ncf ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 90002"); } # reset $b = ''; last; } } } last if ($io->eof); } print "sim: loop finished.\n"; close FROM_PARENT; exit; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata.pl0000755000175000017500000000155211640407354020155 0ustar locallocal#!/usr/bin/perl # odata.pl # 3.6.2.1. ODATA - Original Data use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $app->connect; sub close_ssh { $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); print "app: publish test data.\n"; $app->say ("send ao ringo"); print "mon: wait for odata ...\n"; $mon->wait_for_odata; print "mon: received odata.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/heartbeat_spm.pl0000755000175000017500000000231711640407354021703 0ustar locallocal#!/usr/bin/perl # heartbeat_spm.pl # 5.1.5. Heartbeat SPMs use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $app->connect; sub close_ssh { $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); print "app: publish test data.\n"; $app->say ("send ao ringo"); print "mon: wait for odata ...\n"; $mon->wait_for_odata; my $t0 = [gettimeofday]; for (1..4) # look for four consecutive heartbeat SPMs less than 5000ms apart { print "mon: wait for spm ...\n"; $mon->wait_for_spm ({ 'timeout' => 5 }); my $tn = [gettimeofday]; my $elapsed = tv_interval ( $t0, $tn ); $t0 = $tn; print "mon: spm received after $elapsed seconds.\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/test.conf.pl0000644000175000017500000000161311640407354020763 0ustar locallocal# test.conf.pl use vars qw ( %config ); %config = ( app => { # Linux host # host => 'ayaka', # ip => '10.6.28.31', # cmd => 'sudo /miru/projects/openpgm/pgm/ref/release-Linux-x86_64/test/app', # network => 'eth0;239.192.0.1' # Solaris host host => 'ryoko', ip => '10.6.28.36', cmd => 'sudo LD_LIBRARY_PATH=/opt/glib-sunstudio/lib:$LD_LIBRARY_PATH /miru/projects/openpgm/pgm/ref/release-SunOS-sun4u-sunstudio/test/app', network => 'eri0;239.192.0.1' # Windows host # host => 'Administrator@sora', # ip => '10.6.28.35', # cmd => '/cygdrive/c/temp/app.exe', # network => '10.6.28.35;239.192.0.1' }, mon => { host => 'momo', cmd => 'sudo /miru/projects/openpgm/pgm/ref/release-FreeBSD-amd64/test/monitor', network => 'bge0;239.192.0.1' }, sim => { host => 'kiku', cmd => 'sudo /miru/projects/openpgm/pgm/ref/release-Linux-x86_64/test/sim', network => 'eth0;239.192.0.1' }, ); libpgm-5.1.118-1~dfsg/openpgm/pgm/test/app.c0000644000175000017500000007360411640407354017460 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM conformance test application. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #ifndef _WIN32 # include # include # include # include # include # include # include #else # include # include #endif #include #include #include #include #include #include #include #include #include "async.h" /* typedefs */ struct idle_source { GSource source; guint64 expiration; }; struct app_session { char* name; pgm_sock_t* sock; pgm_async_t* async; }; /* globals */ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "app" static int g_port = 7500; static const char* g_network = ";239.192.0.1"; static guint g_max_tpdu = 1500; static guint g_sqns = 100 * 1000; static GHashTable* g_sessions = NULL; static GMainLoop* g_loop = NULL; static GIOChannel* g_stdin_channel = NULL; #ifndef _WIN32 static void on_signal (int, gpointer); #else static BOOL on_console_ctrl (DWORD); #endif static gboolean on_startup (gpointer); static gboolean on_mark (gpointer); static void destroy_session (gpointer, gpointer, gpointer); static int on_data (gpointer, guint, gpointer); static gboolean on_stdin_data (GIOChannel*, GIOCondition, gpointer); G_GNUC_NORETURN static void usage (const char* bin) { fprintf (stderr, "Usage: %s [options]\n", bin); fprintf (stderr, " -n : Multicast group or unicast IP address\n"); fprintf (stderr, " -s : IP port\n"); exit (1); } int main ( int argc, char *argv[] ) { pgm_error_t* err = NULL; /* pre-initialise PGM messages module to add hook for GLib logging */ pgm_messages_init(); log_init (); g_message ("app"); if (!pgm_init (&err)) { g_error ("Unable to start PGM engine: %s", (err && err->message) ? err->message : "(null)"); pgm_error_free (err); pgm_messages_shutdown(); return EXIT_FAILURE; } /* parse program arguments */ #ifdef _WIN32 const char* binary_name = strrchr (argv[0], '\\'); #else const char* binary_name = strrchr (argv[0], '/'); #endif if (NULL == binary_name) binary_name = argv[0]; else binary_name++; int c; while ((c = getopt (argc, argv, "s:n:h")) != -1) { switch (c) { case 'n': g_network = optarg; break; case 's': g_port = atoi (optarg); break; case 'h': case '?': pgm_messages_shutdown(); usage (binary_name); } } g_loop = g_main_loop_new (NULL, FALSE); /* setup signal handlers */ #ifndef _WIN32 signal (SIGSEGV, on_sigsegv); signal (SIGHUP, SIG_IGN); pgm_signal_install (SIGINT, on_signal, g_loop); pgm_signal_install (SIGTERM, on_signal, g_loop); #else SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE); setvbuf (stdout, (char *) NULL, _IONBF, 0); #endif /* !_WIN32 */ /* delayed startup */ g_message ("scheduling startup."); g_timeout_add (0, (GSourceFunc)on_startup, NULL); /* dispatch loop */ g_message ("entering main event loop ... "); g_main_loop_run (g_loop); g_message ("event loop terminated, cleaning up."); /* cleanup */ g_main_loop_unref(g_loop); g_loop = NULL; if (g_sessions) { g_message ("destroying sessions."); g_hash_table_foreach_remove (g_sessions, (GHRFunc)destroy_session, NULL); g_hash_table_unref (g_sessions); g_sessions = NULL; } if (g_stdin_channel) { puts ("unbinding stdin."); g_io_channel_unref (g_stdin_channel); g_stdin_channel = NULL; } g_message ("PGM engine shutdown."); pgm_shutdown(); g_message ("finished."); pgm_messages_shutdown(); return EXIT_SUCCESS; } static void destroy_session ( gpointer key, /* session name */ gpointer value, /* transport_session object */ G_GNUC_UNUSED gpointer user_data ) { struct app_session* sess = (struct app_session*)value; g_message ("closing socket \"%s\"", (char*)key); pgm_close (sess->sock, TRUE); sess->sock = NULL; if (sess->async) { g_message ("destroying asynchronous session on \"%s\"", (char*)key); pgm_async_destroy (sess->async); sess->async = NULL; } g_free (sess->name); sess->name = NULL; g_free (sess); } #ifndef _WIN32 static void on_signal ( int signum, gpointer user_data ) { GMainLoop* loop = (GMainLoop*)user_data; g_message ("on_signal (signum:%d user-data:%p)", signum, user_data); g_main_loop_quit (loop); } #else static BOOL on_console_ctrl ( DWORD dwCtrlType ) { g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType); g_main_loop_quit (g_loop); return TRUE; } #endif /* !_WIN32 */ static gboolean on_startup ( G_GNUC_UNUSED gpointer data ) { g_message ("startup."); g_sessions = g_hash_table_new (g_str_hash, g_str_equal); /* add stdin to event manager */ #ifndef G_OS_WIN32 g_stdin_channel = g_io_channel_unix_new (fileno(stdin)); #else g_stdin_channel = g_io_channel_win32_new_fd (fileno(stdin)); #endif printf ("binding stdin with encoding %s.\n", g_io_channel_get_encoding(g_stdin_channel)); g_io_add_watch (g_stdin_channel, G_IO_IN | G_IO_PRI, on_stdin_data, NULL); /* period timer to indicate some form of life */ // TODO: Gnome 2.14: replace with g_timeout_add_seconds() g_timeout_add(10 * 1000, (GSourceFunc)on_mark, NULL); puts ("READY"); fflush (stdout); return FALSE; } static int on_data ( gpointer data, G_GNUC_UNUSED guint len, G_GNUC_UNUSED gpointer user_data ) { printf ("DATA: %s\n", (char*)data); fflush (stdout); return 0; } static void session_create ( char* session_name ) { pgm_error_t* pgm_err = NULL; /* check for duplicate */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess != NULL) { printf ("FAILED: duplicate session name '%s'\n", session_name); return; } /* create new and fill in bits */ sess = g_new0(struct app_session, 1); sess->name = g_memdup (session_name, strlen(session_name)+1); if (!pgm_socket (&sess->sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) { printf ("FAILED: pgm_socket(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); goto err_free; } /* success */ g_hash_table_insert (g_sessions, sess->name, sess); printf ("created new session \"%s\"\n", sess->name); puts ("READY"); return; err_free: g_free(sess->name); g_free(sess); } static void session_set_nak_bo_ivl ( char* session_name, guint milliseconds ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (pgm_msecs (milliseconds) > INT_MAX) { puts ("FAILED: value out of bounds"); return; } const int nak_bo_ivl = pgm_msecs (milliseconds); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl))) printf ("FAILED: set NAK_BO_IVL = %dms\n", milliseconds); else puts ("READY"); } static void session_set_nak_rpt_ivl ( char* session_name, guint milliseconds ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (pgm_msecs (milliseconds) > INT_MAX) { puts ("FAILED: value out of bounds"); return; } const int nak_rpt_ivl = pgm_msecs (milliseconds); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl))) printf ("FAILED: set NAK_RPT_IVL = %dms\n", milliseconds); else puts ("READY"); } static void session_set_nak_rdata_ivl ( char* session_name, guint milliseconds ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (pgm_msecs (milliseconds) > INT_MAX) { puts ("FAILED: value out of bounds"); return; } const int nak_rdata_ivl = pgm_msecs (milliseconds); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl))) printf ("FAILED: set NAK_RDATA_IVL = %dms\n", milliseconds); else puts ("READY"); } static void session_set_nak_ncf_retries ( char* session_name, guint retry_count ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (retry_count > INT_MAX) { puts ("FAILED: value out of bounds"); return; } const int nak_ncf_retries = retry_count; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries))) printf ("FAILED: set NAK_NCF_RETRIES = %d\n", retry_count); else puts ("READY"); } static void session_set_nak_data_retries ( char* session_name, guint retry_count ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (retry_count > INT_MAX) { puts ("FAILED: value out of bounds"); return; } const int nak_data_retries = retry_count; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries))) printf ("FAILED: set NAK_DATA_RETRIES = %d\n", retry_count); else puts ("READY"); } static void session_set_txw_max_rte ( char* session_name, guint bitrate ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (bitrate > INT_MAX) { puts ("FAILED: value out of bounds"); return; } const int txw_max_rte = bitrate; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &txw_max_rte, sizeof(txw_max_rte))) printf ("FAILED: set TXW_MAX_RTE = %d\n", bitrate); else puts ("READY"); } static void session_set_fec ( char* session_name, guint block_size, guint group_size ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (block_size > UINT8_MAX || group_size > UINT8_MAX) { puts ("FAILED: value out of bounds"); return; } const struct pgm_fecinfo_t fecinfo = { .block_size = block_size, .proactive_packets = 0, .group_size = group_size, .ondemand_parity_enabled = TRUE, .var_pktlen_enabled = TRUE }; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo))) printf ("FAILED: set FEC = RS(%d, %d)\n", block_size, group_size); else puts ("READY"); } static void session_bind ( char* session_name ) { pgm_error_t* pgm_err = NULL; /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* Use RFC 2113 tagging for PGM Router Assist */ const int no_router_assist = 0; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist))) puts ("FAILED: disable IP_ROUTER_ALERT"); /* set PGM parameters */ const int send_and_receive = 0, active = 0, mtu = g_max_tpdu, txw_sqns = g_sqns, rxw_sqns = g_sqns, ambient_spm = pgm_secs (30), heartbeat_spm[] = { pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (1300), pgm_secs (7), pgm_secs (16), pgm_secs (25), pgm_secs (30) }, peer_expiry = pgm_secs (300), spmr_expiry = pgm_msecs (250), nak_bo_ivl = pgm_msecs (50), nak_rpt_ivl = pgm_secs (2), nak_rdata_ivl = pgm_secs (2), nak_data_retries = 50, nak_ncf_retries = 50; g_assert (G_N_ELEMENTS(heartbeat_spm) > 0); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_SEND_ONLY, &send_and_receive, sizeof(send_and_receive))) puts ("FAILED: set bi-directional transport"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_RECV_ONLY, &send_and_receive, sizeof(send_and_receive))) puts ("FAILED: set bi-directional transport"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_PASSIVE, &active, sizeof(active))) puts ("FAILED: set active transport"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_MTU, &mtu, sizeof(mtu))) printf ("FAILED: set MAX_TPDU = %d bytes\n", mtu); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_TXW_SQNS, &txw_sqns, sizeof(txw_sqns))) printf ("FAILED: set TXW_SQNS = %d\n", txw_sqns); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_RXW_SQNS, &rxw_sqns, sizeof(rxw_sqns))) printf ("FAILED: set RXW_SQNS = %d\n", rxw_sqns); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm))) printf ("FAILED: set AMBIENT_SPM = %ds\n", (int)pgm_to_secs (ambient_spm)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm))) { char buffer[1024]; sprintf (buffer, "%d", heartbeat_spm[0]); for (unsigned i = 1; i < G_N_ELEMENTS(heartbeat_spm); i++) { char t[1024]; sprintf (t, ", %d", heartbeat_spm[i]); strcat (buffer, t); } printf ("FAILED: set HEARTBEAT_SPM = { %s }\n", buffer); } if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry))) printf ("FAILED: set PEER_EXPIRY = %ds\n",(int) pgm_to_secs (peer_expiry)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry))) printf ("FAILED: set SPMR_EXPIRY = %dms\n", (int)pgm_to_msecs (spmr_expiry)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl))) printf ("FAILED: set NAK_BO_IVL = %dms\n", (int)pgm_to_msecs (nak_bo_ivl)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl))) printf ("FAILED: set NAK_RPT_IVL = %dms\n", (int)pgm_to_msecs (nak_rpt_ivl)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl))) printf ("FAILED: set NAK_RDATA_IVL = %dms\n", (int)pgm_to_msecs (nak_rdata_ivl)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries))) printf ("FAILED: set NAK_DATA_RETRIES = %d\n", nak_data_retries); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries))) printf ("FAILED: set NAK_NCF_RETRIES = %d\n", nak_ncf_retries); /* create global session identifier */ struct pgm_sockaddr_t addr; memset (&addr, 0, sizeof(addr)); addr.sa_port = g_port; addr.sa_addr.sport = 0; if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) { printf ("FAILED: pgm_gsi_create_from_hostname(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); } { char buffer[1024]; pgm_tsi_print_r (&addr.sa_addr, buffer, sizeof(buffer)); printf ("pgm_bind (sock:%p addr:{port:%d tsi:%s} err:%p)\n", (gpointer)sess->sock, addr.sa_port, buffer, (gpointer)&pgm_err); } if (!pgm_bind (sess->sock, &addr, sizeof(addr), &pgm_err)) { printf ("FAILED: pgm_bind(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); } else puts ("READY"); } static void session_connect ( char* session_name ) { struct pgm_addrinfo_t hints = { .ai_family = AF_INET }, *res = NULL; pgm_error_t* pgm_err = NULL; /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (!pgm_getaddrinfo (g_network, &hints, &res, &pgm_err)) { printf ("FAILED: pgm_getaddrinfo(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); return; } /* join IP multicast groups */ for (unsigned i = 0; i < res->ai_recv_addrs_len; i++) if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req))) { char group[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&res->ai_recv_addrs[i].gsr_group, sizeof(struct sockaddr_in), group, sizeof(group), NULL, 0, NI_NUMERICHOST); printf ("FAILED: join group (#%u %s)\n", (unsigned)res->ai_recv_addrs[i].gsr_interface, group); } if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req))) { char group[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, sizeof(struct sockaddr_in), group, sizeof(group), NULL, 0, NI_NUMERICHOST); printf ("FAILED: send group (#%u %s)\n", (unsigned)res->ai_send_addrs[0].gsr_interface, group); } pgm_freeaddrinfo (res); /* set IP parameters */ const int non_blocking = 1, no_multicast_loop = 0, multicast_hops = 16, dscp = 0x2e << 2; /* Expedited Forwarding PHB for network elements, no ECN. */ if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &no_multicast_loop, sizeof(no_multicast_loop))) puts ("FAILED: disable multicast loop"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops))) printf ("FAILED: set TTL = %d\n", multicast_hops); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp))) printf ("FAILED: set TOS = 0x%x\n", dscp); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NOBLOCK, &non_blocking, sizeof(non_blocking))) puts ("FAILED: set non-blocking sockets"); if (!pgm_connect (sess->sock, &pgm_err)) { printf ("FAILED: pgm_connect(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); } else puts ("READY"); } static void session_send ( char* session_name, char* string ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* send message */ int status; gsize stringlen = strlen(string) + 1; struct timeval tv; #ifdef CONFIG_HAVE_POLL int n_fds = 1; struct pollfd fds[ n_fds ]; int timeout; #else int send_sock; DWORD cEvents = 1; WSAEVENT waitEvents[ cEvents ]; DWORD timeout, dwEvents; socklen_t socklen = sizeof(int); waitEvents[0] = WSACreateEvent (); pgm_getsockopt (sess->sock, IPPROTO_PGM, PGM_SEND_SOCK, &send_sock, &socklen); WSAEventSelect (send_sock, waitEvents[0], FD_WRITE); #endif again: printf ("pgm_send (sock:%p string:\"%s\" stringlen:%" G_GSIZE_FORMAT " NULL)\n", (gpointer)sess->sock, string, stringlen); status = pgm_send (sess->sock, string, stringlen, NULL); switch (status) { case PGM_IO_STATUS_NORMAL: puts ("READY"); break; case PGM_IO_STATUS_TIMER_PENDING: { socklen_t optlen = sizeof (tv); pgm_getsockopt (sess->sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen); } goto block; case PGM_IO_STATUS_RATE_LIMITED: { socklen_t optlen = sizeof (tv); pgm_getsockopt (sess->sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen); } /* fall through */ case PGM_IO_STATUS_WOULD_BLOCK: block: #ifdef CONFIG_HAVE_POLL timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); memset (fds, 0, sizeof(fds)); pgm_poll_info (sess->sock, fds, &n_fds, POLLOUT); poll (fds, n_fds, timeout /* ms */); #else timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, timeout, FALSE); switch (dwEvents) { case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[0]); break; default: break; } #endif goto again; default: puts ("FAILED: pgm_send()"); break; } #ifndef CONFIG_HAVE_POLL WSACloseEvent (waitEvents[0]); #endif } static void session_listen ( char* session_name ) { GError* err = NULL; /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* listen */ printf ("pgm_async_create (async:%p sock:%p err:%p)\n", (gpointer)&sess->async, (gpointer)sess->sock, (gpointer)&err); if (!pgm_async_create (&sess->async, sess->sock, &err)) { printf ("FAILED: pgm_async_create(): %s", err->message); g_error_free (err); return; } pgm_async_add_watch (sess->async, on_data, sess); puts ("READY"); } static void session_destroy ( char* session_name ) { /* check that session exists */ struct app_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* remove from hash table */ g_hash_table_remove (g_sessions, session_name); /* stop any async thread */ if (sess->async) { pgm_async_destroy (sess->async); sess->async = NULL; } pgm_close (sess->sock, TRUE); sess->sock = NULL; g_free (sess->name); sess->name = NULL; g_free (sess); puts ("READY"); } /* process input commands from stdin/fd */ static gboolean on_stdin_data ( GIOChannel* source, G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data ) { gchar* str = NULL; gsize len = 0; gsize term = 0; GError* err = NULL; g_io_channel_read_line (source, &str, &len, &term, &err); if (len > 0) { if (term) str[term] = 0; /* quit */ if (strcmp(str, "quit") == 0) { g_main_loop_quit(g_loop); goto out; } regex_t preg; regmatch_t pmatch[10]; /* create socket */ const char *re = "^create[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_create (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set NAK_BO_IVL */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+NAK_BO_IVL[[:space:]]+([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; guint nak_bo_ivl = strtol (p, &p, 10); session_set_nak_bo_ivl (name, nak_bo_ivl); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set NAK_RPT_IVL */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+NAK_RPT_IVL[[:space:]]+([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; guint nak_rpt_ivl = strtol (p, &p, 10); session_set_nak_rpt_ivl (name, nak_rpt_ivl); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set NAK_RDATA_IVL */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+NAK_RDATA_IVL[[:space:]]+([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; guint nak_rdata_ivl = strtol (p, &p, 10); session_set_nak_rdata_ivl (name, nak_rdata_ivl); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set NAK_NCF_RETRIES */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+NAK_NCF_RETRIES[[:space:]]+([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; guint nak_ncf_retries = strtol (p, &p, 10); session_set_nak_ncf_retries (name, nak_ncf_retries); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set NAK_DATA_RETRIES */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+NAK_DATA_RETRIES[[:space:]]+([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; guint nak_data_retries = strtol (p, &p, 10); session_set_nak_data_retries (name, nak_data_retries); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set TXW_MAX_RTE */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+TXW_MAX_RTE[[:space:]]+([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; guint txw_max_rte = strtol (p, &p, 10); session_set_txw_max_rte (name, txw_max_rte); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* enable Reed-Solomon Forward Error Correction */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+FEC[[:space:]]+RS[[:space:]]*\\([[:space:]]*([0-9]+)[[:space:]]*,[[:space:]]*([0-9]+)[[:space:]]*\\)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; *(str + pmatch[2].rm_eo) = 0; guint n = strtol (p, &p, 10); p = str + pmatch[3].rm_so; *(str + pmatch[3].rm_eo) = 0; guint k = strtol (p, &p, 10); session_set_fec (name, n, k); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* bind socket */ re = "^bind[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_bind (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* connect socket */ re = "^connect[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_connect (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* send packet */ re = "^send[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *string = g_memdup (str + pmatch[2].rm_so, pmatch[2].rm_eo - pmatch[2].rm_so + 1 ); string[ pmatch[2].rm_eo - pmatch[2].rm_so ] = 0; session_send (name, string); g_free (name); g_free (string); regfree (&preg); goto out; } regfree (&preg); /* listen */ re = "^listen[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_listen (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* destroy transport */ re = "^destroy[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_destroy (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set PGM network */ re = "^set[[:space:]]+network[[:space:]]+([[:print:]]*;[[:print:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char* pgm_network = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); pgm_network[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; g_network = pgm_network; puts ("READY"); regfree (&preg); goto out; } regfree (&preg); printf ("unknown command: %s\n", str); } out: fflush (stdout); g_free (str); return TRUE; } /* idle log notification */ static gboolean on_mark ( G_GNUC_UNUSED gpointer data ) { g_message ("-- MARK --"); return TRUE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spmr_from_odata.pl0000755000175000017500000000227211640407354022241 0ustar locallocal#!/usr/bin/perl # spmr_from_odata.pl # 13.3.1. SPM Requests use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); my $data = $app->wait_for_data; print "app: received data [$data].\n"; print "mon: wait for SPMR ...\n"; $mon->wait_for_spmr; print "mon: received SPMR.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/rdata_completion.pl0000755000175000017500000000430211640407354022405 0ustar locallocal#!/usr/bin/perl # rdata_completion.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; print "sim: NAK received.\n"; print "sim: publish RDATA sqn 90,002.\n"; $sim->say ("net send rdata ao 90002 90001 momo"); for (1..2) { print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata_jump.pl0000755000175000017500000000342411640407354021210 0ustar locallocal#!/usr/bin/perl # odata_jump.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; print "sim: NAK received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/dump-json.c0000644000175000017500000011463711640407354020616 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * JSON packet dump. * * Copyright (c) 2006-2008 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #ifndef _WIN32 # include # include # include # include # include # include #else # include # include #endif #include #include #include #include "dump-json.h" /* globals */ #define OPTIONS_TOTAL_LEN(x) *(guint16*)( ((char*)(x)) + sizeof(guint16) ) int verify_ip_header (struct pgm_ip*, guint); void print_ip_header (struct pgm_ip*); int verify_pgm_header (struct pgm_header*, guint); void print_pgm_header (struct pgm_header*); int verify_spm (struct pgm_header*, char*, guint); void print_spm (struct pgm_header*, char*); int verify_poll (struct pgm_header*, char*, guint); void print_poll (struct pgm_header*, char*); int verify_polr (struct pgm_header*, char*, guint); void print_polr (struct pgm_header*, char*); int verify_odata (struct pgm_header*, char*, guint); void print_odata (struct pgm_header*, char*); int verify_rdata (struct pgm_header*, char*, guint); void print_rdata (struct pgm_header*, char*); static int generic_verify_nak (const char*, struct pgm_header*, char*, guint); static void generic_print_nak (const char*, struct pgm_header*, char*); int verify_nak (struct pgm_header*, char*, guint); void print_nak (struct pgm_header*, char*); int verify_nnak (struct pgm_header*, char*, guint); void print_nnak (struct pgm_header*, char*); int verify_ncf (struct pgm_header*, char*, guint); void print_ncf (struct pgm_header*, char*); int verify_spmr (struct pgm_header*, char*, guint); void print_spmr (struct pgm_header*, char*); int verify_options (char*, guint); void print_options (char*); int monitor_packet ( char* data, guint len ) { static int count = 0; puts ("{"); printf ("\t\"id\": %i,\n", ++count); int retval = 0; struct pgm_ip* ip = (struct pgm_ip*)data; if (verify_ip_header (ip, len) < 0) { puts ("\t\"valid\": false"); retval = -1; goto out; } struct pgm_header* pgm = (struct pgm_header*)(data + (ip->ip_hl * 4)); guint pgm_len = len - (ip->ip_hl * 4); if (verify_pgm_header (pgm, pgm_len) < 0) { puts ("\t\"valid\": false"); retval = -1; goto out; } char* pgm_data = (char*)(pgm + 1); guint pgm_data_len = pgm_len - sizeof(struct pgm_header); switch (pgm->pgm_type) { case PGM_SPM: retval = verify_spm (pgm, pgm_data, pgm_data_len); break; case PGM_POLL: retval = verify_poll (pgm, pgm_data, pgm_data_len); break; case PGM_POLR: retval = verify_polr (pgm, pgm_data, pgm_data_len); break; case PGM_ODATA: retval = verify_odata (pgm, pgm_data, pgm_data_len); break; case PGM_RDATA: retval = verify_rdata (pgm, pgm_data, pgm_data_len); break; case PGM_NAK: retval = verify_nak (pgm, pgm_data, pgm_data_len); break; case PGM_NNAK: retval = verify_nnak (pgm, pgm_data, pgm_data_len); break; case PGM_NCF: retval = verify_ncf (pgm, pgm_data, pgm_data_len); break; case PGM_SPMR: retval = verify_spmr (pgm, pgm_data, pgm_data_len); break; } if (retval < 0) { puts ("\t\"valid\": false"); goto out; } /* packet verified correct */ puts ("\t\"valid\": true,"); print_ip_header (ip); print_pgm_header (pgm); switch (pgm->pgm_type) { case PGM_SPM: print_spm (pgm, pgm_data); break; case PGM_POLL: print_poll (pgm, pgm_data); break; case PGM_POLR: print_polr (pgm, pgm_data); break; case PGM_ODATA: print_odata (pgm, pgm_data); break; case PGM_RDATA: print_rdata (pgm, pgm_data); break; case PGM_NAK: print_nak (pgm, pgm_data); break; case PGM_NNAK: print_nnak (pgm, pgm_data); break; case PGM_NCF: print_ncf (pgm, pgm_data); break; case PGM_SPMR: print_spmr (pgm, pgm_data); break; } out: puts ("}"); return retval; } int verify_ip_header ( struct pgm_ip* ip, guint len ) { /* minimum size should be IP header plus PGM header */ if (len < (sizeof(struct pgm_ip) + sizeof(struct pgm_header))) { printf ("\t\"message\": \"IP: packet size too small: %i bytes, expecting at least %" G_GSIZE_FORMAT " bytes.\",\n", len, sizeof(struct pgm_header)); return -1; } /* IP packet header: IPv4 * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |Version| HL | ToS | Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Fragment ID |R|D|M| Fragment Offset | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | TTL | Protocol | Checksum | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source IP Address | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Destination IP Address | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | IP Options when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+ ... * | Data ... * +-+-+- ... * * IPv6: n/a */ /* decode IP header */ if (ip->ip_v != 4 && ip->ip_v != 6) { /* IP version, 4 or 6 */ printf ("\t\"message\": \"IP: unknown IP version %i.\",\n", ip->ip_v); return -1; } guint ip_header_length = ip->ip_hl * 4; /* IP header length in 32bit octets */ if (ip_header_length < sizeof(struct pgm_ip)) { printf ("\t\"message\": \"IP: bad IP header length %i, should be at least %" G_GSIZE_FORMAT "lu bytes.\",\n", ip_header_length, sizeof(struct pgm_ip)); return -1; } /* ip_len can equal packet_length - ip_header_length in FreeBSD/NetBSD * Stevens/Fenner/Rudolph, Unix Network Programming Vol.1, p.739 * * RFC3828 allows partial packets such that len < packet_length with UDP lite */ #ifndef CONFIG_HOST_ORDER_IP_LEN guint packet_length = g_ntohs(ip->ip_len); /* total packet length */ #else guint packet_length = ip->ip_len; #endif if (len == packet_length + ip_header_length) { packet_length += ip_header_length; } if (len < packet_length) { /* redundant: often handled in kernel */ printf ("\t\"message\": \"IP: truncated IP packet: header reports %i actual length %i bytes.\",\n", (int)len, (int)packet_length); return -1; } /* TCP Segmentation Offload (TSO) might have zero length here */ if (packet_length < ip_header_length) { printf ("\t\"message\": \"IP: header reports %i less than IP header length %i.\",\n", (int)packet_length, (int)ip_header_length); return -1; } /* packets that fail checksum will generally not be passed upstream except with rfc3828 */ #ifdef PGM_CHECK_IN_CKSUM int sum = in_cksum((char*)ip, ip_header_length, 0); if (sum != 0) { const int ip_sum = g_ntohs(ip->ip_sum); printf ("\t\"message\": \"IP: IP header checksum incorrect: %#x.\",\n", ip_sum); return -2; } #endif if (ip->ip_p != IPPROTO_PGM) { printf ("\t\"message\": \"IP: packet IP protocol not PGM: %i.\",\n", ip->ip_p); return -1; } /* fragmentation offset, bit 0: 0, bit 1: do-not-fragment, bit 2: more-fragments */ #ifndef CONFIG_HOST_ORDER_IP_OFF int offset = g_ntohs(ip->ip_off); #else int offset = ip->ip_off; #endif if ((offset & 0x1fff) != 0) { printf ("\t\"message\": \"IP: fragmented IP packet, ignoring.\",\n"); return -1; } return 0; } void print_ip_header ( struct pgm_ip* ip ) { puts ("\t\"IP\": {"); printf ("\t\t\"version\": %i,\n", ip->ip_v ); printf ("\t\t\"headerLength\": %i,\n", ip->ip_hl ); printf ("\t\t\"ToS\": %i,\n", ip->ip_tos & 0x3 ); printf ("\t\t\"length\": %i,\n", #ifndef CONFIG_HOST_ORDER_IP_LEN g_ntohs(ip->ip_len) #else ip->ip_len #endif ); printf ("\t\t\"fragmentId\": %i,\n", g_ntohs(ip->ip_id) ); printf ("\t\t\"DF\": %s,\n", (g_ntohs(ip->ip_off) & 0x4000) ? "true" : "false" ); printf ("\t\t\"MF\": %s,\n", (g_ntohs(ip->ip_off) & 0x2000) ? "true" : "false" ); printf ("\t\t\"fragmentOffset\": %i,\n", g_ntohs(ip->ip_off) & 0x1fff ); printf ("\t\t\"TTL\": %i,\n", ip->ip_ttl ); printf ("\t\t\"protocol\": %i,\n", ip->ip_p ); printf ("\t\t\"sourceIp\": \"%s\",\n", inet_ntoa(*(struct in_addr*)&ip->ip_src) ); printf ("\t\t\"destinationIp\": \"%s\",\n", inet_ntoa(*(struct in_addr*)&ip->ip_dst) ); puts ("\t\t\"IpOptions\": {"); puts ("\t\t}"); puts ("\t},"); } int verify_pgm_header ( struct pgm_header* pgm, guint pgm_len ) { /* PGM payload, header looks as follows: * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source Port | Destination Port | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Type | Options | Checksum | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Global Source ID ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | ... Global Source ID | TSDU Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Type specific data ... * +-+-+-+-+-+-+-+-+-+- ... */ if (pgm_len < sizeof(pgm)) { printf ("\t\"message\": \"PGM: packet size less than PGM header: %i bytes.\",\n", pgm_len); return -1; } if (pgm->pgm_checksum) { int sum = pgm->pgm_checksum; pgm->pgm_checksum = 0; int pgm_sum = pgm_csum_fold (pgm_csum_partial ((const char*)pgm, pgm_len, 0)); pgm->pgm_checksum = sum; if (pgm_sum != sum) { printf ("\t\"message\": \"PGM: PGM packet checksum incorrect, packet %#x calculated %#x.\",\n", sum, pgm_sum); return -2; } } else { if (pgm->pgm_type != PGM_ODATA && pgm->pgm_type != PGM_RDATA) { printf ("\t\"message\": \"PGM: No PGM checksum value, mandatory for ODATA/RDATA.\",\n"); return -1; } } if ( pgm->pgm_type != PGM_SPM && pgm->pgm_type != PGM_POLL && pgm->pgm_type != PGM_POLR && pgm->pgm_type != PGM_ODATA && pgm->pgm_type != PGM_RDATA && pgm->pgm_type != PGM_NAK && pgm->pgm_type != PGM_NNAK && pgm->pgm_type != PGM_NCF && pgm->pgm_type != PGM_SPMR ) { printf ("\t\"message\": \"PGM: Not a valid PGM packet type: %i.\",\n", pgm->pgm_type); return -1; } return 0; } /* note: output trails tsdu length line to allow for comma */ void print_pgm_header ( struct pgm_header* pgm ) { puts ("\t\"PGM\": {"); printf ("\t\t\"sourcePort\": %i,\n", g_ntohs(pgm->pgm_sport)); printf ("\t\t\"destinationPort\": %i,\n", g_ntohs(pgm->pgm_dport)); printf ("\t\t\"type\": \"%s\",\n", pgm_type_string(pgm->pgm_type & 0xf)); printf ("\t\t\"version\": %i,\n", (pgm->pgm_type & 0xc0) >> 6); puts ("\t\t\"options\": {"); printf ("\t\t\t\"networkSignificant\": %s,\n", (pgm->pgm_options & PGM_OPT_NETWORK) ? "true" : "false"); printf ("\t\t\t\"parityPacket\": %s,\n", (pgm->pgm_options & PGM_OPT_PARITY) ? "true" : "false"); printf ("\t\t\t\"variableLength\": %s\n", (pgm->pgm_options & PGM_OPT_VAR_PKTLEN) ? "true" : "false"); puts ("\t\t},"); printf ("\t\t\"checksum\": %i,\n", pgm->pgm_checksum); printf ("\t\t\"gsi\": \"%i.%i.%i.%i.%i.%i\",\n", pgm->pgm_gsi[0], pgm->pgm_gsi[1], pgm->pgm_gsi[2], pgm->pgm_gsi[3], pgm->pgm_gsi[4], pgm->pgm_gsi[5]); printf ("\t\t\"tsduLength\": %i", g_ntohs(pgm->pgm_tsdu_length)); } /* 8.1. Source Path Messages (SPM) * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | SPM's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Trailing Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Leading Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Path NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * NLA = Network Layer Address * NLA AFI = NLA Address Family Indicator: rfc 1700 (ADDRESS FAMILY NUMBERS) * => Path NLA = IP address of last network element */ int verify_spm ( struct pgm_header* header, char* data, guint len ) { int retval = 0; /* truncated packet */ if (len < sizeof(struct pgm_spm)) { printf ("\t\"message\": \"SPM: packet length: %i less than minimum SPM length: %" G_GSIZE_FORMAT "lu bytes.\",\n", len, sizeof(struct pgm_spm)); retval = -1; goto out; } struct pgm_spm* spm = (struct pgm_spm*)data; char* opt_offset = (char*)(spm + 1); guint opt_len = len - sizeof(spm); switch (g_ntohs(spm->spm_nla_afi)) { case AFI_IP6: if (len < sizeof(struct pgm_spm6)) { printf ("\t\"message\": \"SPM: packet length: %i less than minimum IPv6 SPM length: %" G_GSIZE_FORMAT "lu bytes.\",\n", len, sizeof(struct pgm_spm6)); retval = -1; goto out; } opt_offset += sizeof(struct pgm_spm6) - sizeof(struct pgm_spm); opt_len -= sizeof(struct pgm_spm6) - sizeof(struct pgm_spm); case AFI_IP: break; default: printf ("\t\"message\": \"SPM: invalid AFI of source NLA: %i.\",\n", g_ntohs(spm->spm_nla_afi)); retval = -1; goto out; } /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { retval = verify_options (opt_offset, opt_len); } out: return retval; } void print_spm ( struct pgm_header* header, char* data ) { struct pgm_spm* spm = (struct pgm_spm*)data; struct pgm_spm6* spm6 = (struct pgm_spm6*)data; char* opt_offset = (char*)(spm + 1); puts (","); printf ("\t\t\"spmSqn\": %i,\n", g_ntohl(spm->spm_sqn)); printf ("\t\t\"spmTrail\": %i,\n", g_ntohl(spm->spm_trail)); printf ("\t\t\"spmLead\": %i,\n", g_ntohl(spm->spm_lead)); printf ("\t\t\"spmNlaAfi\": %i,\n", g_ntohs (spm->spm_nla_afi)); char s[INET6_ADDRSTRLEN]; switch (g_ntohs(spm->spm_nla_afi)) { case AFI_IP: pgm_inet_ntop ( AF_INET, &spm->spm_nla, s, sizeof (s) ); break; case AFI_IP6: pgm_inet_ntop ( AF_INET6, &spm6->spm6_nla, s, sizeof (s) ); opt_offset += sizeof(struct pgm_spm6) - sizeof(struct pgm_spm); break; } printf ("\t\t\"spmNla\": \"%s\"", s); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { puts (","); print_options (opt_offset); } puts ("\n\t}"); } /* 14.7.1. Poll Request * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLL's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLL's Round | POLL's Sub-type | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Path NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | POLL's Back-off Interval | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Random String | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Matching Bit-Mask | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Sent to ODATA multicast group with IP Router Alert option. */ #define PGM_MIN_POLL_SIZE ( sizeof(struct pgm_poll) ) int verify_poll ( G_GNUC_UNUSED struct pgm_header* header, G_GNUC_UNUSED char* data, G_GNUC_UNUSED guint len ) { return -1; } void print_poll ( G_GNUC_UNUSED struct pgm_header* header, G_GNUC_UNUSED char* data ) { } /* 14.7.2. Poll Response * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLR's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLR's Round | reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ int verify_polr ( G_GNUC_UNUSED struct pgm_header* header, G_GNUC_UNUSED char* data, G_GNUC_UNUSED guint len ) { return -1; } void print_polr ( G_GNUC_UNUSED struct pgm_header* header, G_GNUC_UNUSED char* data ) { } /* 8.2. Data Packet * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Data Packet Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Trailing Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Data ... * +-+-+- ... */ int verify_odata ( struct pgm_header* header, char* data, guint len ) { int retval = 0; if (len < sizeof(struct pgm_data)) { printf ("\t\"message\": \"ODATA: packet length: %i less than minimum ODATA length: %" G_GSIZE_FORMAT " bytes.\",\n", len, sizeof(struct pgm_data)); retval = -1; goto out; } char* tsdu = data + sizeof(struct pgm_data); guint tsdu_len = len - sizeof(struct pgm_data); if (header->pgm_options & PGM_OPT_PRESENT) { retval = verify_options (tsdu, tsdu_len); guint opt_total_len = g_ntohs( OPTIONS_TOTAL_LEN(tsdu) ); tsdu += opt_total_len; tsdu_len -= opt_total_len; } if (!retval && g_ntohs(header->pgm_tsdu_length) != tsdu_len) { printf ("\t\"message\": \"ODATA: TSDU truncated expected %i, found %i bytes.\",\n", g_ntohs(header->pgm_tsdu_length), tsdu_len); retval = -1; } out: return retval; } void print_odata ( struct pgm_header* header, char* data ) { struct pgm_data* odata = (struct pgm_data*)data; char* tsdu = data + sizeof(struct pgm_data); puts (","); printf ("\t\t\"odSqn\": %lu,\n", (gulong)g_ntohl(odata->data_sqn)); printf ("\t\t\"odTrail\": %lu,\n", (gulong)g_ntohl(odata->data_trail)); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { print_options (tsdu); tsdu += g_ntohs( OPTIONS_TOTAL_LEN(tsdu) ); puts (","); } /* data */ printf ("\t\t\"data\": \""); char* end = tsdu + g_ntohs (header->pgm_tsdu_length); while (tsdu < end) { if (isprint(*tsdu)) putchar(*tsdu); else putchar('.'); tsdu++; } puts ("\""); puts ("\t}"); } /* 8.2. Repair Data */ int verify_rdata ( struct pgm_header* header, char* data, guint len ) { int retval = 0; if (len < sizeof(struct pgm_data)) { printf ("\t\"message\": \"RDATA: packet length: %i less than minimum RDATA length: %" G_GSIZE_FORMAT " bytes.\",\n", len, sizeof(struct pgm_data)); retval = -1; goto out; } char* tsdu = data + sizeof(struct pgm_data); guint tsdu_len = len - sizeof(struct pgm_data); if (header->pgm_options & PGM_OPT_PRESENT) { retval = verify_options (tsdu, tsdu_len); guint opt_total_len = g_ntohs( OPTIONS_TOTAL_LEN(tsdu) ); tsdu += opt_total_len; tsdu_len -= opt_total_len; } if (!retval && g_ntohs(header->pgm_tsdu_length) != tsdu_len) { printf ("\t\"message\": \"RDATA: tsdu truncated expected %i, found %i bytes.\",\n", g_ntohs(header->pgm_tsdu_length), tsdu_len); retval = -1; } out: return retval; } void print_rdata ( struct pgm_header* header, char* data ) { struct pgm_data* rdata = (struct pgm_data*)data; char* tsdu = data + sizeof(struct pgm_data); puts (","); printf ("\t\t\"rdSqn\": %lu,\n", (gulong)g_ntohl(rdata->data_sqn)); printf ("\t\t\"rdTrail\": %lu,\n", (gulong)g_ntohl(rdata->data_trail)); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { print_options (tsdu); tsdu += g_ntohs( OPTIONS_TOTAL_LEN(tsdu) ); puts (","); } /* data */ printf ("\t\t\"data\": \""); char* end = tsdu + g_ntohs (header->pgm_tsdu_length); while (tsdu < end) { if (isprint(*tsdu)) putchar(*tsdu); else putchar('.'); tsdu++; } puts ("\""); puts ("\t}"); } /* 8.3. NAK * * Technically the AFI of the source and multicast group can be different * but that would be very wibbly wobbly. One example is using a local DLR * with a IPv4 address to reduce NAK cost for recovery on wide IPv6 * distribution. * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Requested Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Multicast Group NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ int verify_nak ( struct pgm_header* header, char* data, guint len ) { return generic_verify_nak ("NAK", header, data, len); } int verify_ncf ( struct pgm_header* header, char* data, guint len ) { return generic_verify_nak ("NCF", header, data, len); } int verify_nnak ( struct pgm_header* header, char* data, guint len ) { return generic_verify_nak ("NNAK", header, data, len); } static int generic_verify_nak ( const char* name, /* upper case */ G_GNUC_UNUSED struct pgm_header* header, char* data, guint len ) { int retval = 0; /* truncated packet */ if (len < sizeof(struct pgm_nak)) { printf ("\t\"message\": \"%s: packet length: %i less than minimum %s length: %" G_GSIZE_FORMAT " bytes.\",\n", name, len, name, sizeof(struct pgm_nak)); retval = -1; goto out; } struct pgm_nak* nak = (struct pgm_nak*)data; int nak_src_nla_afi = g_ntohs (nak->nak_src_nla_afi); int nak_grp_nla_afi = -1; /* check source NLA: unicast address of the ODATA sender */ switch (nak_src_nla_afi) { case AFI_IP: nak_grp_nla_afi = g_ntohs (nak->nak_grp_nla_afi); break; case AFI_IP6: nak_grp_nla_afi = g_ntohs (((struct pgm_nak6*)nak)->nak6_grp_nla_afi); break; default: printf ("\t\"message\": \"%s: invalid AFI of source NLA: %i.\",\n", name, nak_src_nla_afi); retval = -1; goto out; } /* check multicast group NLA */ switch (nak_grp_nla_afi) { case AFI_IP6: switch (nak_src_nla_afi) { /* IPv4 + IPv6 NLA */ case AFI_IP: if (len < ( sizeof(struct pgm_nak) + sizeof(struct in6_addr) - sizeof(struct in_addr) )) { printf ("\t\"message\": \"%s: packet length: %i less than joint IPv4/6 %s length: %" G_GSIZE_FORMAT " bytes.\",\n", name, len, name, ( sizeof(struct pgm_nak) + sizeof(struct in6_addr) - sizeof(struct in_addr) )); retval = -1; } break; /* IPv6 + IPv6 NLA */ case AFI_IP6: if (len < sizeof(struct pgm_nak6)) { printf ("\t\"message\": \"%s: packet length: %i less than IPv6 %s length: %" G_GSIZE_FORMAT " bytes.\",\n", name, len, name, sizeof(struct pgm_nak6)); retval = -1; } break; } break; case AFI_IP: if (nak_src_nla_afi == AFI_IP6) { if (len < ( sizeof(struct pgm_nak) + sizeof(struct in6_addr) - sizeof(struct in_addr) )) { printf ("\t\"message\": \"%s: packet length: %i less than joint IPv6/4 %s length: %" G_GSIZE_FORMAT " bytes.\",\n", name, len, name, ( sizeof(struct pgm_nak) + sizeof(struct in6_addr) - sizeof(struct in_addr) )); retval = -1; } } break; default: printf ("\t\"message\": \"%s: invalid AFI of group NLA: %i.\",\n", name, nak_grp_nla_afi); retval = -1; break; } out: return retval; } void print_nak ( struct pgm_header* header, char* data ) { generic_print_nak ("nak", header, data); } void print_ncf ( struct pgm_header* header, char* data ) { generic_print_nak ("ncf", header, data); } void print_nnak ( struct pgm_header* header, char* data ) { generic_print_nak ("nnak", header, data); } static void generic_print_nak ( const char* name, /* lower case */ struct pgm_header* header, char* data ) { struct pgm_nak* nak = (struct pgm_nak*)data; struct pgm_nak6* nak6 = (struct pgm_nak6*)data; char* opt_offset = (char*)(nak + 1); puts (","); printf ("\t\t\"%sSqn\": %lu,\n", name, (gulong)g_ntohl(nak->nak_sqn)); guint16 nak_src_nla_afi = g_ntohs (nak->nak_src_nla_afi); guint16 nak_grp_nla_afi = 0; char s[INET6_ADDRSTRLEN]; printf ("\t\t\"%sSourceNlaAfi\": %i,\n", name, nak_src_nla_afi); /* source nla */ switch (nak_src_nla_afi) { case AFI_IP: pgm_inet_ntop ( AF_INET, &nak->nak_src_nla, s, sizeof(s) ); nak_grp_nla_afi = g_ntohs (nak->nak_grp_nla_afi); break; case AFI_IP6: pgm_inet_ntop ( AF_INET6, &nak6->nak6_src_nla, s, sizeof(s) ); nak_grp_nla_afi = g_ntohs (nak6->nak6_grp_nla_afi); opt_offset += sizeof(struct in6_addr) - sizeof(struct in_addr); break; } printf ("\t\t\"%sSourceNla\": \"%s\",\n", name, s); printf ("\t\t\"%sGroupNlaAfi\": %i,\n", name, nak_grp_nla_afi); switch (nak_grp_nla_afi) { case AFI_IP6: switch (nak_src_nla_afi) { /* IPv4 + IPv6 NLA */ case AFI_IP: pgm_inet_ntop ( AF_INET6, &nak->nak_grp_nla, s, sizeof(s) ); break; /* IPv6 + IPv6 NLA */ case AFI_IP6: pgm_inet_ntop ( AF_INET6, &nak6->nak6_grp_nla, s, sizeof(s) ); break; } opt_offset += sizeof(struct in6_addr) - sizeof(struct in_addr); break; case AFI_IP: switch (nak_src_nla_afi) { /* IPv4 + IPv4 NLA */ case AFI_IP: pgm_inet_ntop ( AF_INET, &nak->nak_grp_nla, s, sizeof(s) ); break; /* IPv6 + IPv4 NLA */ case AFI_IP6: pgm_inet_ntop ( AF_INET, &nak6->nak6_grp_nla, s, sizeof(s) ); break; } break; } printf ("\t\t\"%sGroupNla\": \"%s\"", name, s); /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { puts (","); print_options (opt_offset); } puts ("\n\t}"); } /* 13.6. SPM Request * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ int verify_spmr ( struct pgm_header* header, char* data, guint len ) { int retval = 0; char* opt_offset = data; guint opt_len = len; /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { retval = verify_options (opt_offset, opt_len); } return retval; } void print_spmr ( struct pgm_header* header, char* data ) { char* opt_offset = data; /* option extensions */ if (header->pgm_options & PGM_OPT_PRESENT) { print_options (opt_offset); puts (""); } puts ("\t}"); } /* Parse PGM options fields: * * assume at least two options, one the mandatory OPT_LENGTH */ #define PGM_MIN_OPT_SIZE ( sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_length) ) int verify_options ( char* data, guint len ) { int retval = 0; if (len < PGM_MIN_OPT_SIZE) { printf ("\t\"message\": \"PGM options: packet size too small for options.\",\n"); retval = -1; goto out; } /* OPT_LENGTH first */ struct pgm_opt_length* opt_len = (struct pgm_opt_length*)data; if ((opt_len->opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) { printf ("\t\"message\": \"PGM options: first option not OPT_LENGTH.\",\n"); retval = -1; goto out; } if (opt_len->opt_length != sizeof(struct pgm_opt_length)) { printf ("\t\"message\": \"PGM options: OPT_LENGTH incorrect option length: %i, expecting %" G_GSIZE_FORMAT " bytes.\",\n", opt_len->opt_length, sizeof(struct pgm_opt_length)); retval = -1; goto out; } if (g_ntohs(opt_len->opt_total_length) < PGM_MIN_OPT_SIZE) { printf ("\t\"message\": \"PGM options: OPT_LENGTH total length too short: %i bytes.\",\n", g_ntohs(opt_len->opt_total_length)); retval = -1; goto out; } if (g_ntohs(opt_len->opt_total_length) > len) { printf ("\t\"message\": \"PGM options: OPT_LENGTH total length longer than packet allows: %i bytes.\",\n", g_ntohs(opt_len->opt_total_length)); retval = -1; goto out; } /* iterate through options (max 16) */ guint count = 0; guint total_length = g_ntohs(opt_len->opt_total_length); guint opt_counters[256]; memset (&opt_counters, 0, sizeof(opt_counters)); struct pgm_opt_header* opt_header = (struct pgm_opt_header*)data; for (;;) { total_length -= opt_header->opt_length; if (total_length < sizeof(struct pgm_opt_header)) { printf ("\t\"message\": \"PGM options: option #%i shorter than minimum option size.\",\n", count + 1); retval = -1; goto out; } opt_header = (struct pgm_opt_header*)( ((char*)opt_header) + opt_header->opt_length ); if (((int)total_length - (int)opt_header->opt_length) < 0) { printf ("\t\"message\": \"PGM options: option #%i shorter than embedded size.\",\n", count + 1); retval = -1; goto out; } if (opt_counters[opt_header->opt_type]++) { printf ("\t\"message\": \"PGM options: duplicate option %i.\",\n", opt_header->opt_type); retval = -1; goto out; } /* check option types */ switch (opt_header->opt_type & PGM_OPT_MASK) { case PGM_OPT_FRAGMENT: { if (opt_header->opt_length != sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment)) { printf ("\t\"message\": \"PGM options: OPT_FRAGMENT incorrect size: %i bytes.\",\n", opt_header->opt_length); retval = -1; goto out; } struct pgm_opt_fragment* opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); if (g_ntohl(opt_fragment->opt_frag_off) > g_ntohl(opt_fragment->opt_frag_len)) { printf ("\t\"message\": \"PGM options: fragment offset longer than original packet.\",\n"); retval = -1; goto out; } break; } case PGM_OPT_NAK_LIST: { guint list_len = opt_header->opt_length - sizeof(struct pgm_opt_header) - sizeof(guint8); if (list_len & 1) { printf ("\t\"message\": \"PGM options: OPT_NAK_LIST invalid odd length: %i bytes.\",\n", opt_header->opt_length); retval = -1; goto out; } list_len /= 2; if (list_len == 0) { printf ("\t\"message\": \"PGM options: OPT_NAK_LIST empty.\",\n"); retval = -1; goto out; } if (list_len > 62) { printf ("\t\"message\": \"PGM options: OPT_NAK_LIST too long: %i sqns.\",\n", list_len); retval = -1; goto out; } break; } case PGM_OPT_PARITY_PRM: { struct pgm_opt_parity_prm* opt_parity_prm = (struct pgm_opt_parity_prm*)(opt_header + 1); if ((opt_parity_prm->opt_reserved & PGM_PARITY_PRM_MASK) == 0) { printf ("\t\"message\": \"PGM options: neither pro-active or on-demand parity set in OPT_PARITY_PRM.\",\n"); retval = -1; goto out; } guint32 parity_prm_tgs = g_ntohl (opt_parity_prm->parity_prm_tgs); if (parity_prm_tgs < 2 || parity_prm_tgs > 128) { printf ("\t\"message\": \"PGM options: transmission group size out of bounds: %i.\",\n", parity_prm_tgs); retval = -1; goto out; } break; } default: /* unknown option, skip */ break; } /* end option types */ if (opt_header->opt_type & PGM_OPT_END) { break; } if (count++ == 16) { printf ("\t\"message\": \"PGM options: more than 16 options found.\",\n"); retval = -1; goto out; } } out: return retval; } static const char *opx_text[4] = { "OPX_IGNORE", "OPX_INVALIDATE", "OPX_DISCARD", "OPX_UNKNOWN" }; void print_options ( char* data ) { struct pgm_opt_length* opt_len = (struct pgm_opt_length*)data; puts ("\t\t\"pgmOptions\": ["); puts ("\t\t\t{"); printf ("\t\t\t\t\"length\": \"%#x\",\n", opt_len->opt_length); puts ("\t\t\t\t\"type\": \"OPT_LENGTH\","); printf ("\t\t\t\t\"totalLength\": %i\n", g_ntohs (opt_len->opt_total_length)); printf ("\t\t\t}"); /* iterate through options */ struct pgm_opt_header* opt_header = (struct pgm_opt_header*)data; do { opt_header = (struct pgm_opt_header*)( ((char*)opt_header) + opt_header->opt_length ); puts (","); puts ("\t\t\t{"); printf ("\t\t\t\t\"length\": \"%#x\",\n", opt_header->opt_length); switch (opt_header->opt_type & PGM_OPT_MASK) { case PGM_OPT_FRAGMENT: { struct pgm_opt_fragment* opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); printf ("\t\t\t\t\"type\": \"OPT_FRAGMENT%s\",\n", (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s,\n", (opt_fragment->opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); printf ("\t\t\t\t\"firstSqn\": %i,\n", g_ntohl(opt_fragment->opt_sqn)); printf ("\t\t\t\t\"fragmentOffset\": %i,\n", g_ntohl(opt_fragment->opt_frag_off)); printf ("\t\t\t\t\"originalLength\": %i\n", g_ntohl(opt_fragment->opt_frag_len)); break; } case PGM_OPT_NAK_LIST: { struct pgm_opt_nak_list* opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); char* end = (char*)opt_header + opt_header->opt_length; printf ("\t\t\t\t\"type\": \"OPT_NAK_LIST%s\",\n", (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s,\n", (opt_nak_list->opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); char sqns[1024] = ""; guint i = 0; do { char sqn[1024]; sprintf (sqn, "%s%i", (i>0)?", ":"", g_ntohl(opt_nak_list->opt_sqn[i])); strcat (sqns, sqn); i++; } while ((char*)&opt_nak_list->opt_sqn[i] < end); printf ("\t\t\t\t\"sqn\": [%s]\n", sqns); break; } case PGM_OPT_PARITY_PRM: { struct pgm_opt_parity_prm* opt_parity_prm = (struct pgm_opt_parity_prm*)(opt_header + 1); printf ("\t\t\t\t\"type\": \"OPT_PARITY_PRM%s\",\n", (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s,\n", (opt_parity_prm->opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); printf ("\t\t\t\t\"P-bit\": %s,\n", (opt_parity_prm->opt_reserved & PGM_PARITY_PRM_PRO) ? "true" : "false"); printf ("\t\t\t\t\"O-bit\": %s,\n", (opt_parity_prm->opt_reserved & PGM_PARITY_PRM_OND) ? "true" : "false"); printf ("\t\t\t\t\"transmissionGroupSize\": %i\n", g_ntohl(opt_parity_prm->parity_prm_tgs)); break; } case PGM_OPT_CURR_TGSIZE: { struct pgm_opt_curr_tgsize* opt_curr_tgsize = (struct pgm_opt_curr_tgsize*)(opt_header + 1); printf ("\t\t\t\t\"type\": \"OPT_CURR_TGSIZE%s\",\n", (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s,\n", (opt_curr_tgsize->opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); printf ("\t\t\t\t\"actualTransmissionGroupSize\": %i\n", g_ntohl(opt_curr_tgsize->prm_atgsize)); break; } case PGM_OPT_SYN: { struct pgm_opt_syn* opt_syn = (struct pgm_opt_syn*)(opt_header + 1); printf ("\t\t\t\t\"type\": \"OPT_SYN%s\",\n", (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s\n", (opt_syn->opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); break; } case PGM_OPT_FIN: { struct pgm_opt_fin* opt_fin = (struct pgm_opt_fin*)(opt_header + 1); printf ("\t\t\t\t\"type\": \"OPT_FIN%s\",\n", (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s\n", (opt_fin->opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); break; } default: { guint8 opt_reserved = *(guint8*)(opt_header + 1); printf ("\t\t\t\t\"type\": \"%#x%s\",\n", opt_header->opt_type & PGM_OPT_MASK, (opt_header->opt_type & PGM_OPT_END) ? "|OPT_END" : ""); printf ("\t\t\t\t\"F-bit\": %s,\n", (opt_header->opt_reserved & PGM_OP_ENCODED) ? "true" : "false"); printf ("\t\t\t\t\"OPX\": \"%s\",\n", opx_text[opt_header->opt_reserved & PGM_OPX_MASK]); printf ("\t\t\t\t\"U-bit\": %s\n", (opt_reserved & PGM_OP_ENCODED_NULL) ? "true" : "false"); break; } } printf ("\t\t\t}"); } while (!(opt_header->opt_type & PGM_OPT_END)); printf ("\n\t\t]"); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/apdu.pl0000755000175000017500000000242711640407354020020 0ustar locallocal#!/usr/bin/perl # apdu.pl # 6.1. Data Reception use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("set network $config{app}{network}"); $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("set network $config{sim}{network}"); $sim->say ("create ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish APDU.\n"; $sim->say ("send ao ringo x 1000"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: received data [$data].\n"; my $ref_data = "ringo" x 1000; die "incoming data corrupt\n" unless ($data == $ref_data); print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/on-demand_spm.pl0000755000175000017500000000256511640407354021613 0ustar locallocal#!/usr/bin/perl # on-demand_spm.pl # 5.1.4. Ambient SPMs with on-demand parity flag use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $app->connect; sub close_ssh { $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("set ao FEC RS(255,64)"); $app->say ("bind ao"); print "app: ready.\n"; print "mon: wait for spm ...\n"; my $spm = $mon->wait_for_spm; print "mon: received spm.\n"; die "SPM does not contain any PGM options\n" unless $spm->{PGM}->{pgmOptions}; die "SPM does not contain a PGM_OPT_PARITY_PRM option\n" unless $spm->{PGM}->{pgmOptions}[1]->{type} =~ /OPT_PARITY_PRM/; print "pro-active parity " . ($spm->{PGM}->{pgmOptions}[1]->{'P-bit'} ? 'enabled' : 'disabled') . ", P-bit " . ($spm->{PGM}->{pgmOptions}[1]->{'P-bit'} ? 'true' : 'false') . "\n"; die "on-demand parity disabled, O-bit false\n" unless $spm->{PGM}->{pgmOptions}[1]->{'O-bit'}; print "on-demand parity enabled, O-bit true\n"; print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/async.h0000644000175000017500000000473711640407354020023 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * Asynchronous receive thread helper * * Copyright (c) 2006-2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGM_ASYNC_H__ #define __PGM_ASYNC_H__ #include #include #include #define PGM_ASYNC_ERROR pgm_async_error_quark () typedef enum { /* Derived from errno */ PGM_ASYNC_ERROR_FAULT, PGM_ASYNC_ERROR_MFILE, PGM_ASYNC_ERROR_NFILE, PGM_ASYNC_ERROR_OVERFLOW, PGM_ASYNC_ERROR_FAILED } PGMAsyncError; typedef struct pgm_async_t pgm_async_t; struct pgm_async_t { pgm_sock_t* sock; GThread* thread; GAsyncQueue* commit_queue; #ifndef _WIN32 int commit_pipe[2]; int destroy_pipe[2]; #else WSAEVENT commit_event; WSAEVENT destroy_event; #endif gboolean is_destroyed; gboolean is_nonblocking; }; typedef int (*pgm_eventfn_t)(gpointer, guint, gpointer); G_BEGIN_DECLS int pgm_async_create (pgm_async_t**, pgm_sock_t* const, GError**); int pgm_async_destroy (pgm_async_t* const); GIOStatus pgm_async_recv (pgm_async_t* const, gpointer, const gsize, gsize* const, const int, GError**); gboolean pgm_async_set_nonblocking (pgm_async_t* const, const gboolean); GSource* pgm_async_create_watch (pgm_async_t* const) G_GNUC_WARN_UNUSED_RESULT; int pgm_async_add_watch_full (pgm_async_t*, gint, pgm_eventfn_t, gpointer, GDestroyNotify); int pgm_async_add_watch (pgm_async_t*, pgm_eventfn_t, gpointer); GQuark pgm_async_error_quark (void); #ifndef _WIN32 static inline int pgm_async_get_fd (pgm_async_t* async) { g_return_val_if_fail (async != NULL, -EINVAL); return async->commit_pipe[0]; } #else static inline HANDLE pgm_async_get_event (pgm_async_t* async) { g_return_val_if_fail (async != NULL, NULL); return async->commit_event; } #endif /* _WIN32 */ G_END_DECLS #endif /* __PGM_ASYNC_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spm_reception.pl0000755000175000017500000000260011640407354021727 0ustar locallocal#!/usr/bin/perl # spm_reception.pl # 6.1. Data Reception use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,000.\n"; $sim->say ("net send spm ao 1 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90000 ichigo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: received data [$data].\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/nak.pl0000755000175000017500000000270711640407354017641 0ustar locallocal#!/usr/bin/perl # nak.pl # 5.3. Repairs use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); # to process NAK requests print "app: publish test data.\n"; $app->say ("send ao ringo"); $app->say ("send ao ichigo"); $app->say ("send ao momo"); my $odata = undef; my $ocnt = 0; for (1..3) { print "mon: wait for odata ...\n"; $odata = $mon->wait_for_odata; $ocnt++; print "mon: received $ocnt x odata.\n"; } print "sim: send nak to app.\n"; $sim->say ("net send nak ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 2"); print "mon: wait for rdata ...\n"; $mon->wait_for_rdata; print "mon: rdata received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata_rate.pl0000755000175000017500000000312011640407354021161 0ustar locallocal#!/usr/bin/perl # odata_number.pl # 5.1.1. Maximum Cumulative Transmit Rate use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $app->connect; sub close_ssh { $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("set ao TXW_MAX_RTE 1500"); $app->say ("bind ao"); $app->say ("connect ao"); print "app: send 50 data packets ...\n"; my $t0 = [gettimeofday]; # hide stdout open(OLDOUT, ">&STDOUT"); open(STDOUT, ">/dev/null") or die "Can't redirect stdout: $!"; my $payload = "ringo" x 100; my $bytes = 0; for (1..50) { $app->say ("send ao $payload"); my $odata = $mon->wait_for_odata; $bytes += $odata->{IP}->{length}; } close(STDOUT) or die "Can't close STDOUT: $!"; open(STDOUT, ">&OLDOUT") or die "Can't restore stdout: $!"; close(OLDOUT) or die "Can't close OLDOUT: $!"; my $elapsed = tv_interval ( $t0, [gettimeofday] ); print "mon: received 50 x odata, $bytes bytes in $elapsed seconds.\n"; my $rate = $bytes / $elapsed; $rate = $bytes if ($rate > $bytes); print "mon: incoming data rate $rate bps.\n"; die "incoming rate exceeds set TXW_MAX_RTE\n" unless $rate < 1650; print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/PGM/0000755000175000017500000000000011640407424017143 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/test/PGM/Test.pm0000644000175000017500000001643011640407354020426 0ustar locallocalpackage PGM::Test; use strict; our($VERSION); use Carp; use IO::File; use IPC::Open2; use Net::SSH qw(sshopen2); use Sys::Hostname; use POSIX ":sys_wait_h"; use JSON; $VERSION = '1.00'; =head1 NAME PGM::Test - PGM test module =head1 SYNOPSIS $test = PGM::Test->new(); =cut my $json = new JSON; sub new { my $class = shift; my $self = {}; my %params = @_; $self->{tag} = exists $params{tag} ? $params{tag} : confess "tag parameter is required"; $self->{host} = exists $params{host} ? $params{host} : confess "host parameter is required"; $self->{cmd} = exists $params{cmd} ? $params{cmd} : confess "cmd parameter is required"; $self->{in} = IO::File->new(); $self->{out} = IO::File->new(); $self->{pid} = undef; bless $self, $class; return $self; } sub connect { my $self = shift; my $host = hostname; if ($self->{host} =~ /^(localhost|127\.1|127\.0\.0\.1|$host)$/) { print "$self->{tag}: opening local connection\n"; $self->{pid} = open2 ($self->{in}, $self->{out}, "uname -a && $self->{cmd}") or croak "open2 failed $!"; } else { print "$self->{tag}: opening SSH connection to $self->{host} ...\n"; $self->{pid} = sshopen2 ($self->{host}, $self->{in}, $self->{out}, "uname -a && $self->{cmd}") or croak "SSH failed: $!"; } print "$self->{tag}: connected.\n"; $self->wait_for_ready; } sub disconnect { my($self,$quiet) = @_; my $out = $self->{out}; print "$self->{tag}: sending quit command ...\n"; eval { local($SIG{ALRM}) = sub { die "alarm\n"; }; alarm 10; print $out "quit\n"; while (readline($self->{in})) { chomp; s/\r//; print "$self->{tag} [$_]\n" if (!$quiet); } alarm 0; }; if ($@) { print "$self->{tag}: alarm raised on quit command.\n"; } else { print "$self->{tag}: eof.\n"; } print "$self->{tag}: closing SSH connection ...\n"; close ($self->{in}); close ($self->{out}); print "$self->{tag}: closed.\n"; } sub DESTROY { my $self = shift; if ($self->{pid}) { print "$self->{tag}: waiting child to terminate ...\n"; eval { local($SIG{ALRM}) = sub { die "alarm\n"; }; alarm 10; waitpid $self->{pid}, 0; alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; local($SIG{CHLD}) = 'IGNORE'; print "$self->{tag}: killing child ...\n"; kill 'INT' => $self->{pid}; print "$self->{tag}: killed.\n"; } else { print "$self->{tag}: terminated.\n"; } } } sub wait_for_ready { my $self = shift; while (readline($self->{in})) { chomp; s/\r//; print "$self->{tag} [$_]\n"; last if /^READY/; } } sub wait_for_block { my $self = shift; my $fh = $self->{in}; my $b = ''; my $state = 0; while (<$fh>) { chomp(); s/\r//; my $l = $_; if ($state == 0) { if ($l =~ /^{$/) { $state = 1; } else { print "$self->{tag} [$l]\n"; } } if ($state == 1) { $b .= $l; if ($l =~ /^}$/) { $state = 0; return $b; } } } } sub wait_for_spm { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /SPM$/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for spm.\n"; } return $obj; } sub wait_for_spmr { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /SPMR/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for spmr.\n"; } return $obj; } sub die_on_spmr { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /SPMR/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; return $obj; } confess "$self->{tag}: spmr received during blackout.\n"; } # data to {app} sub wait_for_data { my $self = shift; my $fh = $self->{in}; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $data = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; while (<$fh>) { chomp; s/\r//; if (/^DATA: (.+)$/) { $data = $1; last; } print "$self->{tag} [$_]\n"; } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for data.\n"; } return $data; } sub wait_for_odata { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /ODATA/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for odata.\n"; } return $obj; } sub wait_for_rdata { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /RDATA/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for rdata.\n"; } return $obj; } sub die_on_nak { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /NAK/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; return $obj; } confess "$self->{tag}: nak received during blackout.\n"; } sub wait_for_nak { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /NAK/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for nak.\n"; } return $obj; } sub wait_for_ncf { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $obj = undef; eval { local $SIG{ALRM} = sub { die "alarm\n"; }; alarm $timeout; for (;;) { my $block = $self->wait_for_block; $obj = $json->decode($block); last if ($obj->{PGM}->{type} =~ /NCF/); } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised waiting for ncf.\n"; } return $obj; } sub print { my $self = shift; my $timeout = ref($_[0]) ? $_[0]->{'timeout'} : 10; my $out = $self->{out}; print "$self->{tag}> @_"; eval { local($SIG{ALRM}) = sub { die "alarm\n"; }; alarm $timeout; print $out "@_"; $self->wait_for_ready; alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; confess "$self->{tag}: alarm raised.\n"; } } sub say { my $self = shift; $self->print ("@_\n"); } 1; libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spmr_suppression.pl0000755000175000017500000000272711640407354022525 0ustar locallocal#!/usr/bin/perl # spmr_suppression.pl # 13.3.1. SPM Requests use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish ODATA sqn 90,001 to monitor for GSI.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); ## capture GSI of test sim (not app!) my $odata = $mon->wait_for_odata; $mon->say ("filter $config{app}{ip}"); $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); print "sim: re-publish ODATA sqn 90,001 to app.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); $sim->say ("net send spmr ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort}"); my $data = $app->wait_for_data; print "app: received data [$data].\n"; print "mon: wait for erroneous SPMR ...\n"; $mon->die_on_spmr({ 'timeout' => 2 }); print "mon: no SPMR received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/ncf_suppression.pl0000755000175000017500000000565611640407354022316 0ustar locallocal#!/usr/bin/perl # ncf_suppression.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; ## first run through with regular NAK generation to get regular backoff interval print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); my $t0 = [gettimeofday]; print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; my $normal_backoff = tv_interval ( $t0, [gettimeofday] ); print "sim: NAK received in $normal_backoff seconds.\n"; ## cleanup by publishing repair data print "sim: publish RDATA sqn 90,002.\n"; $sim->say ("net send odata ao 90002 90001 momo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; ## second run with NAK suppression $t0 = [gettimeofday]; print "sim: publish ODATA sqn 90,005.\n"; $sim->say ("net send odata ao 90005 90001 anzu"); print "sim: publish NCF sqn 90,004.\n"; $sim->say ("net send ncf ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 90004"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; my $suppressed_backoff = tv_interval ( $t0, [gettimeofday] ); print "sim: NAK received in $suppressed_backoff seconds.\n"; die "NAK suppression failed.\n" unless ($suppressed_backoff > $normal_backoff); print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/apdu_parity.pl0000755000175000017500000000245611640407354021412 0ustar locallocal#!/usr/bin/perl # apdu_parity.pl # 6.1. Data Reception use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $sim->connect; $app->connect; sub close_ssh { $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $app->say ("create ao"); ##$app->say ("set ao FEC RS(255,4)"); $app->say ("bind ao"); $app->say ("listen ao"); $sim->say ("create ao"); $sim->say ("set ao FEC RS(255,4)"); $sim->say ("bind ao"); print "sim: publish APDU.\n"; $sim->say ("send brokn ao ringo x 1200"); print "sim: insert parity NAK from app.\n"; #print "sim: wait for NAK.\n"; #my $nak = $sim->wait_for_nak; #die "Selective NAK received, parityPacket=false\n" unless $nak->{PGM}->{options}->{parityPacket}; #print "Parity NAK received.\n"; print "sim: insert parity RDATA from sim.\n"; print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: received data [$data].\n"; my $ref_data = "ringo" x 1200; die "incoming data corrupt\n" unless ($data == $ref_data); print "test completed successfully.\n"; $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/nak_list.pl0000755000175000017500000000277711640407354020703 0ustar locallocal#!/usr/bin/perl # nak_list.pl # 9.3. NAK List Option - OPT_NAK_LIST use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); print "app: publish test data.\n"; $app->say ("send ao ringo"); $app->say ("send ao ichigo"); $app->say ("send ao momo"); my $odata = undef; my $ocnt = 0; for (1..3) { print "mon: wait for odata ...\n"; $odata = $mon->wait_for_odata; $ocnt++; print "mon: received $ocnt x odata.\n"; } print "sim: send nak to app.\n"; $sim->say ("net send nak ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 0,1,2"); my $rcnt = 0; for (1..3) { print "mon: wait for rdata ...\n"; $mon->wait_for_rdata; $rcnt++; print "mon: received $rcnt x rdata.\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata_number.pl0000755000175000017500000000245611640407354021531 0ustar locallocal#!/usr/bin/perl # odata_number.pl # 5.1.1. Maximum Cumulative Transmit Rate use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $app->connect; sub close_ssh { $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); print "app: send 1000 data packets ...\n"; # hide stdout open(OLDOUT, ">&STDOUT"); open(STDOUT, ">/dev/null") or die "Can't redirect stdout: $!"; for (0..999) { my $i = $_; $app->say ("send ao $i"); my $odata = $mon->wait_for_odata; die "out of sequence ODATA, received $odata->{PGM}->{odSqn} expected $i\n" unless $odata->{PGM}->{odSqn} == $i; } # restore stdout close(STDOUT) or die "Can't close STDOUT: $!"; open(STDOUT, ">&OLDOUT") or die "Can't restore stdout: $!"; close(OLDOUT) or die "Can't close OLDOUT: $!"; print "mon: received 1000 x odata.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/rdata_completion_parity.pl0000755000175000017500000000536311640407354024005 0ustar locallocal#!/usr/bin/perl # rdata_completion_parity.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("set ao FEC RS(255,4)"); $app->say ("bind ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("set ao FEC RS(255,4)"); $sim->say ("bind ao"); print "sim: publish SPM txw_trail 32,769 txw_lead 32,768 at spm_sqn 3200, advertise on-demand parity, k=4.\n"; $sim->say ("net send spm ao 3200 32768 32767 on-demand 4"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 32,768.\n"; $sim->say ("net send odata ao 32768 32768 ringo000"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 32,770.\n"; $sim->say ("net send odata ao 32770 32768 momo0000"); print "sim: publish ODATA sqn 32,771.\n"; $sim->say ("net send odata ao 32771 32768 yakitori"); print "sim: publish ODATA sqn 32,772.\n"; $sim->say ("net send odata ao 32772 32768 sasami00"); print "sim: publish ODATA sqn 32,773.\n"; $sim->say ("net send odata ao 32773 32768 tebasaki"); print "sim: waiting for valid parity NAK.\n"; my $nak = $sim->wait_for_nak; die "Selective NAK received, parityPacket=false\n" unless $nak->{PGM}->{options}->{parityPacket}; print "sim: Parity NAK received.\n"; print "sim: publish parity RDATA, tg_sqn 32,768, pkt_cnt 1 (sqn 32,768).\n"; $sim->say ("net send parity rdata ao 32768 32768 ringo000 ichigo00 momo0000 yakitori"); for (1..5) { print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/rdata_jump.pl0000755000175000017500000000342411640407354021213 0ustar locallocal#!/usr/bin/perl # rdata_jump.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish RDATA sqn 90,003.\n"; $sim->say ("net send rdata ao 90003 90001 ichigo"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; print "sim: NAK received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/ambient_spm.pl0000755000175000017500000000342211640407354021361 0ustar locallocal#!/usr/bin/perl # ambient_spm.pl # 5.1.4. Ambient SPMs use strict; use PGM::Test; use IO::Handle; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); pipe(FROM_PARENT, TO_CHILD) or die "pipe: $!"; FROM_PARENT->autoflush(1); $mon->connect; $app->connect; sub close_ssh { close FROM_PARENT; close TO_CHILD; $mon = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); if (my $pid = fork) { # parent close FROM_PARENT; print "mon: wait for odata ...\n"; $mon->wait_for_odata; print "mon: odata received.\n"; print "mon: wait for spm ...\n"; $mon->wait_for_spm ({ 'timeout' => 45 }); print "mon: received spm.\n"; print TO_CHILD "die\n"; close TO_CHILD; waitpid($pid,0); } else { # child die "cannot fork: $!" unless defined $pid; close TO_CHILD; print "app: loop sending data.\n"; vec(my $rin, fileno(FROM_PARENT), 1) = 1; my $rout = undef; # hide stdout open(OLDOUT, ">&STDOUT"); open(STDOUT, ">/dev/null") or die "Can't redirect stdout: $!"; # send every ~50ms while (! select($rout = $rin, undef, undef, 0.05)) { $app->say ("send ao ringo"); } # restore stdout close(STDOUT) or die "Can't close STDOUT: $!"; open(STDOUT, ">&OLDOUT") or die "Can't restore stdout: $!"; close(OLDOUT) or die "Can't close OLDOUT: $!"; print "app: loop finished.\n"; close FROM_PARENT; exit; } print "test completed successfully.\n"; $mon->disconnect (1); $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/ncf.pl0000755000175000017500000000270411640407354017633 0ustar locallocal#!/usr/bin/perl # ncf.pl # 5.2. Negative Acknowledgment Confirmation use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); print "app: publish test data.\n"; $app->say ("send ao ringo"); $app->say ("send ao ichigo"); $app->say ("send ao momo"); my $odata = undef; my $ocnt = 0; for (1..3) { print "mon: wait for odata ...\n"; $odata = $mon->wait_for_odata; $ocnt++; print "mon: received $ocnt x odata.\n"; } print "sim: send nak to app.\n"; $sim->say ("net send nak ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 2"); print "mon: wait for ncf ...\n"; $mon->wait_for_ncf; print "mon: ncf received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spm_jump.pl0000755000175000017500000000277011640407354020722 0ustar locallocal#!/usr/bin/perl # spm_jump.pl # 6.2. Source Path Messages use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish SPM txw_trail 90,001 txw_lead 90,005 at spm_sqn 20.\n"; $sim->say ("net send spm ao 20 90001 90005"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/SConscript0000644000175000017500000000060311640407354020533 0ustar locallocal# -*- mode: python -*- # OpenPGM build script # $Id$ Import('env') e = env.Clone(); e.Prepend(LIBS = ['libpgm', 'libpgmex']); e.MergeFlags(env['GLIB_FLAGS']); e.MergeFlags(env.get('REGEX_FLAGS','')); e.Append(CCFLAGS = '-DGETTEXT_PACKAGE=\'"pgm"\''); e.Program(['monitor.c', 'dump-json.c']) e.Program(['app.c', 'async.c']) e.Program(['sim.c', 'dump-json.c', 'async.c']) # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/test/rdata_reception.pl0000755000175000017500000000261311640407354022227 0ustar locallocal#!/usr/bin/perl # rdata_reception.pl # 6.1. Data Reception use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish RDATA sqn 90,000.\n"; $sim->say ("net send rdata ao 90000 90000 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: received data [$data].\n"; # no NAKs should be generated. # TODO: test for silence in {mon} print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90000 ichigo"); print "app: wait for data ...\n"; $data = $app->wait_for_data; print "app: received data [$data].\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/ncf_cancellation.pl0000755000175000017500000000643411640407354022353 0ustar locallocal#!/usr/bin/perl # ncf_cancellation.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use IO::Handle; use JSON; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); pipe(FROM_PARENT, TO_CHILD) or die "pipe: $!"; FROM_PARENT->autoflush(1); $mon->connect; $sim->connect; $app->connect; sub close_ssh { close FROM_PARENT; close TO_CHILD; $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); my $t0 = [gettimeofday]; if (my $pid = fork) { # parent close FROM_PARENT; print "app: wait for data ...\n"; my $data = $app->wait_for_data({ 'timeout' => 0 }); print "app: data received [$data].\n"; print TO_CHILD "die\n"; close TO_CHILD; waitpid($pid,0); } else { # child die "cannot fork: $!" unless defined $pid; close TO_CHILD; print "sim: loop waiting for NAKs ...\n"; my $fh = $sim->{in}; vec(my $rin, fileno(FROM_PARENT), 1) = 1; vec($rin, fileno($fh), 1) = 1; my $rout = undef; my $b = ''; my $state = 0; my $json = new JSON; my $io = IO::Handle->new_from_fd( fileno($fh), "r" ); my $cnt = 0; while (select($rout = $rin, undef, undef, undef)) { last if( vec($rout, fileno(FROM_PARENT), 1) ); last unless (defined($_ = $io->getline)); chomp; my $l = $_; if ($state == 0) { if ($l =~ /{$/) { $state = 1; } else { print "sim [$l]\n"; } } if ($state == 1) { $b .= $l; if ($l =~ /^}$/) { $state = 0; my $obj = $json->decode($b); if ($obj->{PGM}->{type} =~ /NAK/) { $cnt++; my $elapsed = tv_interval ( $t0, [gettimeofday] ); print "sim: $cnt x NAK received in $elapsed seconds.\n"; } # reset $b = ''; } } } print "sim: loop finished.\n"; close FROM_PARENT; exit; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata_jump_parity.pl0000755000175000017500000000450711640407354022603 0ustar locallocal#!/usr/bin/perl # odata_jump_parity.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("listen ao"); $sim->say ("create fake ao"); $sim->say ("bind ao"); print "sim: publish SPM txw_trail 32,769 txw_lead 32,768 at spm_sqn 3200, advertise on-demand parity, k=4.\n"; $sim->say ("net send spm ao 3200 32769 32768 on-demand 4"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 32,769.\n"; $sim->say ("net send odata ao 32769 32769 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; # force window into next transmission group print "sim: publish ODATA sqn 32,771.\n"; $sim->say ("net send odata ao 32771 32769 ichigo"); print "sim: publish ODATA sqn 32,772.\n"; $sim->say ("net send odata ao 32772 32769 momo"); print "sim: publish ODATA sqn 32,773.\n"; $sim->say ("net send odata ao 32773 32769 yakitori"); print "sim: publish ODATA sqn 32,774.\n"; $sim->say ("net send odata ao 32774 32769 sasami"); print "sim: publish ODATA sqn 32,775.\n"; $sim->say ("net send odata ao 32775 32769 tebasaki"); print "sim: waiting for valid NAK.\n"; my $nak = $sim->wait_for_nak; print "sim: NAK received.\n"; die "Selective NAK received, parityPacket=false\n" unless $nak->{PGM}->{options}->{parityPacket}; print "Parity NAK received.\n"; print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/dump-json.h0000644000175000017500000000176311640407354020616 0ustar locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab * * JSON packet dump. * * Copyright (c) 2006-2007 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGM_DUMP_JSON_H__ #define __PGM_DUMP_JSON_H__ G_BEGIN_DECLS int monitor_packet (char*, guint); G_END_DECLS #endif /* __PGM_DUMP_JSON_H__ */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/odata_completion.pl0000755000175000017500000000430211640407354022402 0ustar locallocal#!/usr/bin/perl # odata_completion.pl # 6.3. Data Recovery by Negative Acknowledgment use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: publish SPM txw_trail 90,001 txw_lead 90,000 at spm_sqn 3200.\n"; $sim->say ("net send spm ao 3200 90001 90000"); # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,001.\n"; $sim->say ("net send odata ao 90001 90001 ringo"); print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; # no NAKs should be generated. print "sim: waiting 2 seconds for erroneous NAKs ...\n"; $sim->die_on_nak ({ 'timeout' => 2 }); print "sim: no NAKs received.\n"; print "sim: publish ODATA sqn 90,003.\n"; $sim->say ("net send odata ao 90003 90001 ichigo"); print "sim: waiting for valid NAK.\n"; $sim->wait_for_nak; print "sim: NAK received.\n"; print "sim: publish ODATA sqn 90,002.\n"; $sim->say ("net send odata ao 90002 90001 momo"); for (1..2) { print "app: wait for data ...\n"; my $data = $app->wait_for_data; print "app: data received [$data].\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/sim.c0000644000175000017500000023453311640407354017470 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM conformance endpoint simulator. * * Copyright (c) 2006-2008 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #ifndef _WIN32 # include # include # include # include # include # include # include # include # include #else # include # include #endif #include #include #include #include #include #include #include #include #include #include #include "dump-json.h" #include "async.h" /* typedefs */ struct idle_source { GSource source; guint64 expiration; }; struct sim_session { char* name; pgm_sock_t* sock; gboolean is_transport_fake; GIOChannel* recv_channel; pgm_async_t* async; }; /* globals */ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "sim" #ifndef SOL_IP # define SOL_IP IPPROTO_IP #endif #ifndef SOL_IPV6 # define SOL_IPV6 IPPROTO_IPV6 #endif static int g_port = 7500; static const char* g_network = ";239.192.0.1"; static int g_max_tpdu = 1500; static int g_sqns = 100 * 1000; static GList* g_sessions_list = NULL; static GHashTable* g_sessions = NULL; static GMainLoop* g_loop = NULL; static GIOChannel* g_stdin_channel = NULL; #ifndef _WIN32 static void on_signal (int, gpointer); #else static BOOL on_console_ctrl (DWORD); #endif static gboolean on_startup (gpointer); static gboolean on_mark (gpointer); static void destroy_session (struct sim_session*); static int on_data (gpointer, guint, gpointer); static gboolean on_stdin_data (GIOChannel*, GIOCondition, gpointer); void generic_net_send_nak (guint8, char*, pgm_tsi_t*, struct pgm_sqn_list_t*); G_GNUC_NORETURN static void usage (const char* bin) { fprintf (stderr, "Usage: %s [options]\n", bin); fprintf (stderr, " -n : Multicast group or unicast IP address\n"); fprintf (stderr, " -s : IP port\n"); exit (1); } int main ( int argc, char *argv[] ) { pgm_error_t* pgm_err = NULL; /* pre-initialise PGM messages module to add hook for GLib logging */ pgm_messages_init(); log_init (); g_message ("sim"); if (!pgm_init (&pgm_err)) { g_error ("Unable to start PGM engine: %s", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); pgm_messages_shutdown(); return EXIT_FAILURE; } /* parse program arguments */ #ifdef _WIN32 const char* binary_name = strrchr (argv[0], '\\'); #else const char* binary_name = strrchr (argv[0], '/'); #endif if (NULL == binary_name) binary_name = argv[0]; else binary_name++; int c; while ((c = getopt (argc, argv, "s:n:h")) != -1) { switch (c) { case 'n': g_network = optarg; break; case 's': g_port = atoi (optarg); break; case 'h': case '?': pgm_messages_shutdown(); usage (binary_name); } } g_loop = g_main_loop_new (NULL, FALSE); /* setup signal handlers */ #ifndef _WIN32 signal (SIGSEGV, on_sigsegv); signal (SIGHUP, SIG_IGN); pgm_signal_install (SIGINT, on_signal, g_loop); pgm_signal_install (SIGTERM, on_signal, g_loop); #else SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE); setvbuf (stdout, (char *) NULL, _IONBF, 0); #endif /* !_WIN32 */ /* delayed startup */ g_message ("scheduling startup."); g_timeout_add (0, (GSourceFunc)on_startup, NULL); /* dispatch loop */ g_message ("entering main event loop ... "); g_main_loop_run (g_loop); g_message ("event loop terminated, cleaning up."); /* cleanup */ g_main_loop_unref(g_loop); g_loop = NULL; if (g_sessions) { g_message ("destroying sessions."); while (g_sessions_list) { destroy_session (g_sessions_list->data); g_sessions_list = g_list_delete_link (g_sessions_list, g_sessions_list); } g_hash_table_unref (g_sessions); g_sessions = NULL; } if (g_stdin_channel) { puts ("unbinding stdin."); g_io_channel_unref (g_stdin_channel); g_stdin_channel = NULL; } g_message ("PGM engine shutdown."); pgm_shutdown(); g_message ("finished."); pgm_messages_shutdown(); return EXIT_SUCCESS; } static void destroy_session ( struct sim_session* sess ) { printf ("destroying socket \"%s\"\n", sess->name); pgm_close (sess->sock, TRUE); sess->sock = NULL; g_free (sess->name); sess->name = NULL; g_free (sess); } #ifndef _WIN32 static void on_signal ( int signum, gpointer user_data ) { GMainLoop* loop = (GMainLoop*)user_data; g_message ("on_signal (signum:%d user-data:%p)", signum, user_data); g_main_loop_quit (loop); } #else static BOOL on_console_ctrl ( DWORD dwCtrlType ) { g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType); g_main_loop_quit (g_loop); return TRUE; } #endif /* !_WIN32 */ static gboolean on_startup ( G_GNUC_UNUSED gpointer data ) { g_message ("startup."); g_sessions = g_hash_table_new (g_str_hash, g_str_equal); /* add stdin to event manager */ #ifdef G_OS_UNIX g_stdin_channel = g_io_channel_unix_new (fileno(stdin)); #else g_stdin_channel = g_io_channel_win32_new_fd (fileno(stdin)); #endif printf ("binding stdin with encoding %s.\n", g_io_channel_get_encoding(g_stdin_channel)); g_io_add_watch (g_stdin_channel, G_IO_IN | G_IO_PRI, on_stdin_data, NULL); /* period timer to indicate some form of life */ // TODO: Gnome 2.14: replace with g_timeout_add_seconds() g_timeout_add(10 * 1000, (GSourceFunc)on_mark, NULL); puts ("READY"); fflush (stdout); return FALSE; } static bool fake_pgm_socket ( pgm_sock_t**restrict sock, const sa_family_t family, const int pgm_sock_type, const int protocol, G_GNUC_UNUSED pgm_error_t**restrict error ) { pgm_sock_t* new_sock; g_return_val_if_fail (NULL != sock, FALSE); g_return_val_if_fail (AF_INET == family || AF_INET6 == family, FALSE); g_return_val_if_fail (SOCK_SEQPACKET == pgm_sock_type, FALSE); g_return_val_if_fail (IPPROTO_UDP == protocol || IPPROTO_PGM == protocol, FALSE); new_sock = pgm_new0 (pgm_sock_t, 1); new_sock->family = family; new_sock->socket_type = pgm_sock_type; new_sock->protocol = protocol; new_sock->can_send_data = TRUE; new_sock->can_send_nak = TRUE; new_sock->can_recv_data = TRUE; new_sock->dport = DEFAULT_DATA_DESTINATION_PORT; new_sock->tsi.sport = DEFAULT_DATA_SOURCE_PORT; new_sock->adv_mode = 0; /* advance with time */ /* PGMCC */ new_sock->acker_nla.ss_family = family; /* open sockets to implement PGM */ int socket_type; if (IPPROTO_UDP == new_sock->protocol) { puts ("Opening UDP encapsulated sockets."); socket_type = SOCK_DGRAM; new_sock->udp_encap_ucast_port = DEFAULT_UDP_ENCAP_UCAST_PORT; new_sock->udp_encap_mcast_port = DEFAULT_UDP_ENCAP_MCAST_PORT; } else { puts ("Opening raw sockets."); socket_type = SOCK_RAW; } if ((new_sock->recv_sock = socket (new_sock->family, socket_type, new_sock->protocol)) == INVALID_SOCKET) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Creating receive socket: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); #ifndef _WIN32 if (EPERM == save_errno) { g_critical ("PGM protocol requires CAP_NET_RAW capability, e.g. sudo execcap 'cap_net_raw=ep'"); } #endif goto err_destroy; } if ((new_sock->send_sock = socket (new_sock->family, socket_type, new_sock->protocol)) == INVALID_SOCKET) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Creating send socket: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); goto err_destroy; } if ((new_sock->send_with_router_alert_sock = socket (new_sock->family, socket_type, new_sock->protocol)) == INVALID_SOCKET) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Creating IP Router Alert (RFC 2113) send socket: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); goto err_destroy; } *sock = new_sock; puts ("PGM socket successfully created."); return TRUE; err_destroy: if (INVALID_SOCKET != new_sock->recv_sock) { if (SOCKET_ERROR == closesocket (new_sock->recv_sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; g_warning ("Close on receive socket failed: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); } new_sock->recv_sock = INVALID_SOCKET; } if (INVALID_SOCKET != new_sock->send_sock) { if (SOCKET_ERROR == closesocket (new_sock->send_sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; g_warning ("Close on send socket failed: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); } new_sock->send_sock = INVALID_SOCKET; } if (INVALID_SOCKET != new_sock->send_with_router_alert_sock) { if (SOCKET_ERROR == closesocket (new_sock->send_with_router_alert_sock)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; g_warning ("Close on IP Router Alert (RFC 2113) send socket failed: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); } new_sock->send_with_router_alert_sock = INVALID_SOCKET; } pgm_free (new_sock); return FALSE; } static gboolean on_io_data ( GIOChannel* source, G_GNUC_UNUSED GIOCondition condition, gpointer data ) { pgm_sock_t* sock = data; struct pgm_sk_buff_t* skb = pgm_alloc_skb (sock->max_tpdu); int fd = g_io_channel_unix_get_fd(source); struct sockaddr_storage src_addr; socklen_t src_addr_len = sizeof(src_addr); skb->len = recvfrom(fd, skb->head, sock->max_tpdu, MSG_DONTWAIT, (struct sockaddr*)&src_addr, &src_addr_len); printf ("%i bytes received from %s.\n", skb->len, inet_ntoa(((struct sockaddr_in*)&src_addr)->sin_addr)); monitor_packet (skb->data, skb->len); fflush (stdout); /* parse packet to maintain peer database */ if (sock->udp_encap_ucast_port) { if (!pgm_parse_udp_encap (skb, NULL)) goto out; } else { struct sockaddr_storage addr; if (!pgm_parse_raw (skb, (struct sockaddr*)&addr, NULL)) goto out; } if (PGM_IS_UPSTREAM (skb->pgm_header->pgm_type) || PGM_IS_PEER (skb->pgm_header->pgm_type)) goto out; /* ignore */ /* downstream = source to receivers */ if (!PGM_IS_DOWNSTREAM (skb->pgm_header->pgm_type)) goto out; /* pgm packet DPORT contains our transport DPORT */ if (skb->pgm_header->pgm_dport != sock->dport) goto out; /* search for TSI peer context or create a new one */ pgm_peer_t* sender = pgm_hashtable_lookup (sock->peers_hashtable, &skb->tsi); if (sender == NULL) { printf ("new peer, tsi %s, local nla %s\n", pgm_tsi_print (&skb->tsi), inet_ntoa(((struct sockaddr_in*)&src_addr)->sin_addr)); pgm_peer_t* peer = g_new0 (pgm_peer_t, 1); memcpy (&peer->tsi, &skb->tsi, sizeof(pgm_tsi_t)); ((struct sockaddr_in*)&peer->nla)->sin_addr.s_addr = INADDR_ANY; memcpy (&peer->local_nla, &src_addr, src_addr_len); pgm_hashtable_insert (sock->peers_hashtable, &peer->tsi, peer); sender = peer; } /* handle SPMs for advertised NLA */ if (skb->pgm_header->pgm_type == PGM_SPM) { char *pgm_data = (char*)(skb->pgm_header + 1); struct pgm_spm* spm = (struct pgm_spm*)pgm_data; guint32 spm_sqn = g_ntohl (spm->spm_sqn); if ( pgm_uint32_gte (spm_sqn, sender->spm_sqn) || ( ((struct sockaddr*)&sender->nla)->sa_family == 0 ) ) { pgm_nla_to_sockaddr (&spm->spm_nla_afi, (struct sockaddr*)&sender->nla); sender->spm_sqn = spm_sqn; } } out: return TRUE; } static bool fake_pgm_bind3 ( pgm_sock_t* restrict sock, const struct pgm_sockaddr_t*const restrict sockaddr, const socklen_t sockaddrlen, const struct pgm_interface_req_t*const send_req, /* only use gr_interface and gr_group::sin6_scope */ const socklen_t send_req_len, const struct pgm_interface_req_t*const recv_req, const socklen_t recv_req_len, pgm_error_t** restrict error /* maybe NULL */ ) { g_return_val_if_fail (NULL != sock, FALSE); g_return_val_if_fail (NULL != sockaddr, FALSE); g_return_val_if_fail (0 != sockaddrlen, FALSE); if (sockaddr->sa_addr.sport) pgm_return_val_if_fail (sockaddr->sa_addr.sport != sockaddr->sa_port, FALSE); g_return_val_if_fail (NULL != send_req, FALSE); g_return_val_if_fail (sizeof(struct pgm_interface_req_t) == send_req_len, FALSE); g_return_val_if_fail (NULL != recv_req, FALSE); g_return_val_if_fail (sizeof(struct pgm_interface_req_t) == recv_req_len, FALSE); if (sock->is_bound || sock->is_destroyed) { pgm_return_val_if_reached (FALSE); } memcpy (&sock->tsi, &sockaddr->sa_addr, sizeof(pgm_tsi_t)); sock->dport = htons (sockaddr->sa_port); if (sock->tsi.sport) { sock->tsi.sport = htons (sock->tsi.sport); } else { do { sock->tsi.sport = htons (pgm_random_int_range (0, UINT16_MAX)); } while (sock->tsi.sport == sock->dport); } /* UDP encapsulation port */ if (sock->udp_encap_mcast_port) { ((struct sockaddr_in*)&sock->send_gsr.gsr_group)->sin_port = htons (sock->udp_encap_mcast_port); } /* pseudo-random number generator for back-off intervals */ pgm_rand_create (&sock->rand_); /* PGM Children support of POLLs requires 32-bit random node identifier RAND_NODE_ID */ if (sock->can_recv_data) { sock->rand_node_id = pgm_rand_int (&sock->rand_); } /* determine IP header size for rate regulation engine & stats */ sock->iphdr_len = (AF_INET == sock->family) ? sizeof(struct pgm_ip) : sizeof(struct pgm_ip6_hdr); pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming IP header size of %" PRIzu " bytes", sock->iphdr_len); if (sock->udp_encap_ucast_port) { const size_t udphdr_len = sizeof(struct pgm_udphdr); printf ("Assuming UDP header size of %" PRIzu " bytes\n", udphdr_len); sock->iphdr_len += udphdr_len; } const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; sock->max_tsdu = sock->max_tpdu - sock->iphdr_len - pgm_pkt_offset (FALSE, pgmcc_family); sock->max_tsdu_fragment = sock->max_tpdu - sock->iphdr_len - pgm_pkt_offset (TRUE, pgmcc_family); const unsigned max_fragments = sock->txw_sqns ? MIN( PGM_MAX_FRAGMENTS, sock->txw_sqns ) : PGM_MAX_FRAGMENTS; sock->max_apdu = MIN( PGM_MAX_APDU, max_fragments * sock->max_tsdu_fragment ); /* create peer list */ if (sock->can_recv_data) { sock->peers_hashtable = pgm_hashtable_new (pgm_tsi_hash, pgm_tsi_equal); pgm_assert (NULL != sock->peers_hashtable); } /* IP/PGM only */ { const sa_family_t recv_family = sock->family; if (AF_INET == recv_family) { /* include IP header only for incoming data, only works for IPv4 */ puts ("Request IP headers."); if (SOCKET_ERROR == pgm_sockaddr_hdrincl (sock->recv_sock, recv_family, TRUE)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Enabling IP header in front of user data: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); return FALSE; } } else { pgm_assert (AF_INET6 == recv_family); puts ("Request socket packet-info."); if (SOCKET_ERROR == pgm_sockaddr_pktinfo (sock->recv_sock, recv_family, TRUE)) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Enabling receipt of control message per incoming datagram: %s", pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); return FALSE; } } } union { struct sockaddr sa; struct sockaddr_in s4; struct sockaddr_in6 s6; struct sockaddr_storage ss; } recv_addr, recv_addr2, send_addr, send_with_router_alert_addr; #ifdef CONFIG_BIND_INADDR_ANY /* force default interface for bind-only, source address is still valid for multicast membership. * effectively same as running getaddrinfo(hints = {ai_flags = AI_PASSIVE}) */ if (AF_INET == sock->family) { memset (&recv_addr.s4, 0, sizeof(struct sockaddr_in)); recv_addr.s4.sin_family = AF_INET; recv_addr.s4.sin_addr.s_addr = INADDR_ANY; } else { memset (&recv_addr.s6, 0, sizeof(struct sockaddr_in6)); recv_addr.s6.sin6_family = AF_INET6; recv_addr.s6.sin6_addr = in6addr_any; } puts ("Binding receive socket to INADDR_ANY."); #else if (!pgm_if_indextoaddr (recv_req->ir_interface, sock->family, recv_req->ir_scope_id, &recv_addr.sa, error)) { return FALSE; } printf ("Binding receive socket to interface index %u scope %u\n"), recv_req->ir_interface, recv_req->ir_scope_id); #endif /* CONFIG_BIND_INADDR_ANY */ memcpy (&recv_addr2.sa, &recv_addr.sa, pgm_sockaddr_len (&recv_addr.sa)); ((struct sockaddr_in*)&recv_addr)->sin_port = htons (sock->udp_encap_mcast_port); if (SOCKET_ERROR == bind (sock->recv_sock, &recv_addr.sa, pgm_sockaddr_len (&recv_addr.sa))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&recv_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Binding receive socket to address %s: %s", addr, pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); return FALSE; } { char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&recv_addr, s, sizeof(s)); printf ("bind succeeded on recv_gsr[0] interface %s\n", s); } /* keep a copy of the original address source to re-use for router alert bind */ memset (&send_addr, 0, sizeof(send_addr)); if (!pgm_if_indextoaddr (send_req->ir_interface, sock->family, send_req->ir_scope_id, (struct sockaddr*)&send_addr, error)) { return FALSE; } else { printf ("Binding send socket to interface index %u scope %u\n", send_req->ir_interface, send_req->ir_scope_id); } memcpy (&send_with_router_alert_addr, &send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)); if (SOCKET_ERROR == bind (sock->send_sock, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Binding send socket to address %s: %s", addr, pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); return FALSE; } /* resolve bound address if 0.0.0.0 */ if (AF_INET == send_addr.ss.ss_family) { if ((INADDR_ANY == ((struct sockaddr_in*)&send_addr)->sin_addr.s_addr) && !pgm_if_getnodeaddr (AF_INET, (struct sockaddr*)&send_addr, sizeof(send_addr), error)) { return FALSE; } } else if ((memcmp (&in6addr_any, &((struct sockaddr_in6*)&send_addr)->sin6_addr, sizeof(in6addr_any)) == 0) && !pgm_if_getnodeaddr (AF_INET6, (struct sockaddr*)&send_addr, sizeof(send_addr), error)) { return FALSE; } { char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_addr, s, sizeof(s)); printf ("bind succeeded on send_gsr interface %s\n", s); } if (SOCKET_ERROR == bind (sock->send_with_router_alert_sock, (struct sockaddr*)&send_with_router_alert_addr, pgm_sockaddr_len((struct sockaddr*)&send_with_router_alert_addr))) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; char addr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_with_router_alert_addr, addr, sizeof(addr)); pgm_set_error (error, PGM_ERROR_DOMAIN_SOCKET, pgm_error_from_sock_errno (save_errno), "Binding IP Router Alert (RFC 2113) send socket to address %s: %s", addr, pgm_sock_strerror_s (errbuf, sizeof(errbuf), save_errno)); return FALSE; } { char s[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&send_with_router_alert_addr, s, sizeof(s)); printf ("bind (router alert) succeeded on send_gsr interface %s\n", s); } /* save send side address for broadcasting as source nla */ memcpy (&sock->send_addr, &send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)); sock->is_controlled_spm = FALSE; sock->is_controlled_odata = FALSE; sock->is_controlled_rdata = FALSE; /* allocate first incoming packet buffer */ sock->rx_buffer = pgm_alloc_skb (sock->max_tpdu); /* bind complete */ sock->is_bound = TRUE; /* cleanup */ puts ("PGM socket successfully bound."); return TRUE; } static bool fake_pgm_bind ( pgm_sock_t* restrict sock, const struct pgm_sockaddr_t*const restrict sockaddr, const socklen_t sockaddrlen, pgm_error_t** restrict error ) { struct pgm_interface_req_t null_req; memset (&null_req, 0, sizeof(null_req)); return fake_pgm_bind3 (sock, sockaddr, sockaddrlen, &null_req, sizeof(null_req), &null_req, sizeof(null_req), error); } static bool fake_pgm_connect ( pgm_sock_t* restrict sock, G_GNUC_UNUSED pgm_error_t** restrict error /* maybe NULL */ ) { g_return_val_if_fail (sock != NULL, FALSE); g_return_val_if_fail (sock->recv_gsr_len > 0, FALSE); #ifdef CONFIG_TARGET_WINE g_return_val_if_fail (sock->recv_gsr_len == 1, FALSE); #endif for (unsigned i = 0; i < sock->recv_gsr_len; i++) { g_return_val_if_fail (sock->recv_gsr[i].gsr_group.ss_family == sock->recv_gsr[0].gsr_group.ss_family, FALSE); g_return_val_if_fail (sock->recv_gsr[i].gsr_group.ss_family == sock->recv_gsr[i].gsr_source.ss_family, FALSE); } g_return_val_if_fail (sock->send_gsr.gsr_group.ss_family == sock->recv_gsr[0].gsr_group.ss_family, FALSE); /* state */ if (PGM_UNLIKELY(sock->is_connected || !sock->is_bound || sock->is_destroyed)) { g_return_val_if_reached (FALSE); } sock->next_poll = pgm_time_update_now() + pgm_secs( 30 ); sock->is_connected = TRUE; /* cleanup */ puts ("PGM socket successfully connected."); return TRUE; } static bool fake_pgm_close ( pgm_sock_t* sock, G_GNUC_UNUSED bool flush ) { g_return_val_if_fail (sock != NULL, FALSE); g_return_val_if_fail (!sock->is_destroyed, FALSE); /* flag existing calls */ sock->is_destroyed = TRUE; /* cancel running blocking operations */ if (INVALID_SOCKET != sock->recv_sock) { puts ("Closing receive socket."); closesocket (sock->recv_sock); sock->recv_sock = INVALID_SOCKET; } if (INVALID_SOCKET != sock->send_sock) { puts ("Closing send socket."); closesocket (sock->send_sock); sock->send_sock = INVALID_SOCKET; } if (sock->peers_hashtable) { pgm_hashtable_destroy (sock->peers_hashtable); sock->peers_hashtable = NULL; } if (sock->peers_list) { do { pgm_list_t* next = sock->peers_list->next; pgm_peer_unref ((pgm_peer_t*)sock->peers_list->data); sock->peers_list = next; } while (sock->peers_list); } if (INVALID_SOCKET != sock->send_with_router_alert_sock) { puts ("Closing send with router alert socket."); closesocket (sock->send_with_router_alert_sock); sock->send_with_router_alert_sock = INVALID_SOCKET; } if (sock->spm_heartbeat_interval) { puts ("freeing SPM heartbeat interval data."); g_free (sock->spm_heartbeat_interval); sock->spm_heartbeat_interval = NULL; } if (sock->rx_buffer) { puts ("freeing receive buffer."); pgm_free_skb (sock->rx_buffer); sock->rx_buffer = NULL; } g_free (sock); return TRUE; } static void session_create ( char* session_name, gboolean is_fake ) { pgm_error_t* pgm_err = NULL; gboolean status; /* check for duplicate */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess != NULL) { printf ("FAILED: duplicate session name '%s'\n", session_name); return; } /* create new and fill in bits */ sess = g_new0(struct sim_session, 1); sess->name = g_memdup (session_name, strlen(session_name)+1); if (is_fake) { sess->is_transport_fake = TRUE; status = fake_pgm_socket (&sess->sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err); } else { status = pgm_socket (&sess->sock, AF_INET, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err); } if (!status) { printf ("FAILED: pgm_socket(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); goto err_free; } /* success */ g_hash_table_insert (g_sessions, sess->name, sess); g_sessions_list = g_list_prepend (g_sessions_list, sess); printf ("created new session \"%s\"\n", sess->name); puts ("READY"); return; err_free: g_free(sess->name); g_free(sess); } static void session_set_fec ( char* session_name, guint block_size, guint group_size ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (block_size > UINT8_MAX || group_size > UINT8_MAX) { puts ("FAILED: value out of bounds"); return; } const struct pgm_fecinfo_t fecinfo = { .block_size = block_size, .proactive_packets = 0, .group_size = group_size, .ondemand_parity_enabled = TRUE, .var_pktlen_enabled = TRUE }; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo))) printf ("FAILED: set FEC = RS(%d, %d)\n", block_size, group_size); else puts ("READY"); } static void session_bind ( char* session_name ) { pgm_error_t* pgm_err = NULL; /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* Use RFC 2113 tagging for PGM Router Assist */ const int no_router_assist = 0; if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist))) puts ("FAILED: disable IP_ROUTER_ALERT"); /* set PGM parameters */ const int send_and_receive = 0, active = 0, mtu = g_max_tpdu, txw_sqns = g_sqns, rxw_sqns = g_sqns, ambient_spm = pgm_secs (30), heartbeat_spm[] = { pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (1300), pgm_secs (7), pgm_secs (16), pgm_secs (25), pgm_secs (30) }, peer_expiry = pgm_secs (300), spmr_expiry = pgm_msecs (250), nak_bo_ivl = pgm_msecs (50), nak_rpt_ivl = pgm_secs (2), nak_rdata_ivl = pgm_secs (2), nak_data_retries = 50, nak_ncf_retries = 50; g_assert (G_N_ELEMENTS(heartbeat_spm) > 0); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_SEND_ONLY, &send_and_receive, sizeof(send_and_receive))) puts ("FAILED: set bi-directional transport"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_RECV_ONLY, &send_and_receive, sizeof(send_and_receive))) puts ("FAILED: set bi-directional transport"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_PASSIVE, &active, sizeof(active))) puts ("FAILED: set active transport"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_MTU, &mtu, sizeof(mtu))) printf ("FAILED: set MAX_TPDU = %d bytes\n", mtu); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_TXW_SQNS, &txw_sqns, sizeof(txw_sqns))) printf ("FAILED: set TXW_SQNS = %d\n", txw_sqns); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_RXW_SQNS, &rxw_sqns, sizeof(rxw_sqns))) printf ("FAILED: set RXW_SQNS = %d\n", rxw_sqns); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm))) printf ("FAILED: set AMBIENT_SPM = %ds\n", (int)pgm_to_secs (ambient_spm)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm))) { char buffer[1024]; sprintf (buffer, "%d", heartbeat_spm[0]); for (unsigned i = 1; i < G_N_ELEMENTS(heartbeat_spm); i++) { char t[1024]; sprintf (t, ", %d", heartbeat_spm[i]); strcat (buffer, t); } printf ("FAILED: set HEARTBEAT_SPM = { %s }\n", buffer); } if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry))) printf ("FAILED: set PEER_EXPIRY = %ds\n",(int) pgm_to_secs (peer_expiry)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry))) printf ("FAILED: set SPMR_EXPIRY = %dms\n", (int)pgm_to_msecs (spmr_expiry)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl))) printf ("FAILED: set NAK_BO_IVL = %dms\n", (int)pgm_to_msecs (nak_bo_ivl)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl))) printf ("FAILED: set NAK_RPT_IVL = %dms\n", (int)pgm_to_msecs (nak_rpt_ivl)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl))) printf ("FAILED: set NAK_RDATA_IVL = %dms\n", (int)pgm_to_msecs (nak_rdata_ivl)); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries))) printf ("FAILED: set NAK_DATA_RETRIES = %d\n", nak_data_retries); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries))) printf ("FAILED: set NAK_NCF_RETRIES = %d\n", nak_ncf_retries); /* create global session identifier */ struct pgm_sockaddr_t addr; memset (&addr, 0, sizeof(addr)); addr.sa_port = g_port; addr.sa_addr.sport = 0; if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) { printf ("FAILED: pgm_gsi_create_from_hostname(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); } { char buffer[1024]; pgm_tsi_print_r (&addr.sa_addr, buffer, sizeof(buffer)); printf ("pgm_bind (sock:%p addr:{port:%d tsi:%s} err:%p)\n", (gpointer)sess->sock, addr.sa_port, buffer, (gpointer)&pgm_err); } const bool status = sess->is_transport_fake ? fake_pgm_bind (sess->sock, &addr, sizeof(addr), &pgm_err) : pgm_bind (sess->sock, &addr, sizeof(addr), &pgm_err); if (!status) { printf ("FAILED: pgm_bind(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); } else puts ("READY"); } static void session_connect ( char* session_name ) { struct pgm_addrinfo_t hints = { .ai_family = AF_INET }, *res = NULL; pgm_error_t* pgm_err = NULL; /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } if (!pgm_getaddrinfo (g_network, &hints, &res, &pgm_err)) { printf ("FAILED: pgm_getaddrinfo(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); pgm_error_free (pgm_err); return; } /* join IP multicast groups */ for (unsigned i = 0; i < res->ai_recv_addrs_len; i++) if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req))) { char group[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&res->ai_recv_addrs[i].gsr_group, sizeof(struct sockaddr_in), group, sizeof(group), NULL, 0, NI_NUMERICHOST); printf ("FAILED: join group (#%u %s)\n", (unsigned)res->ai_recv_addrs[i].gsr_interface, group); } if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req))) { char group[INET6_ADDRSTRLEN]; getnameinfo ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, sizeof(struct sockaddr_in), group, sizeof(group), NULL, 0, NI_NUMERICHOST); printf ("FAILED: send group (#%u %s)\n", (unsigned)res->ai_send_addrs[0].gsr_interface, group); } pgm_freeaddrinfo (res); /* set IP parameters */ const int non_blocking = 1, no_multicast_loop = 0, multicast_hops = 16, dscp = 0x2e << 2; /* Expedited Forwarding PHB for network elements, no ECN. */ if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &no_multicast_loop, sizeof(no_multicast_loop))) puts ("FAILED: disable multicast loop"); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops))) printf ("FAILED: set TTL = %d\n", multicast_hops); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp))) printf ("FAILED: set TOS = 0x%x\n", dscp); if (!pgm_setsockopt (sess->sock, IPPROTO_PGM, PGM_NOBLOCK, &non_blocking, sizeof(non_blocking))) puts ("FAILED: set non-blocking sockets"); const bool status = sess->is_transport_fake ? fake_pgm_connect (sess->sock, &pgm_err) : pgm_connect (sess->sock, &pgm_err); if (!status) { printf ("FAILED: pgm_connect(): %s\n", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)"); return; } if (sess->is_transport_fake) { /* add receive socket(s) to event manager */ sess->recv_channel = g_io_channel_unix_new (sess->sock->recv_sock); GSource *source; source = g_io_create_watch (sess->recv_channel, G_IO_IN); g_source_set_callback (source, (GSourceFunc)on_io_data, sess->sock, NULL); g_source_attach (source, NULL); g_source_unref (source); } else { pgm_async_create (&sess->async, sess->sock, 0); pgm_async_add_watch (sess->async, on_data, sess); } puts ("READY"); } static inline gssize pgm_sendto_hops ( pgm_sock_t* sock, G_GNUC_UNUSED gboolean rl, gboolean ra, const int hops, const void* buf, gsize len, const struct sockaddr* to, socklen_t tolen ) { const int send_sock = ra ? sock->send_with_router_alert_sock : sock->send_sock; pgm_mutex_lock (&sock->send_mutex); const ssize_t sent = sendto (send_sock, buf, len, 0, to, tolen); pgm_mutex_unlock (&sock->send_mutex); return sent > 0 ? (gssize)len : (gssize)sent; } static int pgm_reset_heartbeat_spm ( pgm_sock_t* sock ) { int retval = 0; pgm_mutex_lock (&sock->timer_mutex); /* re-set spm timer */ sock->spm_heartbeat_state = 1; sock->next_heartbeat_spm = pgm_time_update_now() + sock->spm_heartbeat_interval[sock->spm_heartbeat_state++]; /* prod timer thread if sleeping */ if (pgm_time_after( sock->next_poll, sock->next_heartbeat_spm )) sock->next_poll = sock->next_heartbeat_spm; pgm_mutex_unlock (&sock->timer_mutex); return retval; } static inline int brokn_send_apdu_unlocked ( pgm_sock_t* sock, const gchar* buf, gsize count, gsize* bytes_written ) { guint32 opt_sqn = pgm_txw_next_lead(sock->window); guint packets = 0; guint bytes_sent = 0; guint data_bytes_sent = 0; pgm_mutex_lock (&sock->source_mutex); do { /* retrieve packet storage from transmit window */ int header_length = sizeof(struct pgm_header) + sizeof(struct pgm_data) + sizeof(struct pgm_opt_length) + /* includes header */ sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); int tsdu_length = MIN(sock->max_tpdu - sock->iphdr_len - header_length, count - data_bytes_sent); int tpdu_length = header_length + tsdu_length; struct pgm_sk_buff_t* skb = pgm_alloc_skb (tsdu_length); pgm_skb_put (skb, tpdu_length); skb->pgm_header = (struct pgm_header*)skb->data; memcpy (skb->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); skb->pgm_header->pgm_sport = sock->tsi.sport; skb->pgm_header->pgm_dport = sock->dport; skb->pgm_header->pgm_type = PGM_ODATA; skb->pgm_header->pgm_options = PGM_OPT_PRESENT; skb->pgm_header->pgm_tsdu_length = g_htons (tsdu_length); /* ODATA */ skb->pgm_data = (struct pgm_data*)(skb->pgm_header + 1); skb->pgm_data->data_sqn = g_htonl (pgm_txw_next_lead(sock->window)); skb->pgm_data->data_trail = g_htonl (pgm_txw_trail(sock->window)); /* OPT_LENGTH */ struct pgm_opt_length* opt_len = (struct pgm_opt_length*)(skb->pgm_data + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = g_htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment) ); /* OPT_FRAGMENT */ struct pgm_opt_header* opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_FRAGMENT | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); skb->pgm_opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); skb->pgm_opt_fragment->opt_reserved = 0; skb->pgm_opt_fragment->opt_sqn = g_htonl (opt_sqn); skb->pgm_opt_fragment->opt_frag_off = g_htonl (data_bytes_sent); skb->pgm_opt_fragment->opt_frag_len = g_htonl (count); /* TODO: the assembly checksum & copy routine is faster than memcpy & pgm_cksum on >= opteron hardware */ skb->pgm_header->pgm_checksum = 0; int pgm_header_len = (char*)(skb->pgm_opt_fragment + 1) - (char*)skb->pgm_header; guint32 unfolded_header = pgm_csum_partial ((const void*)skb->pgm_header, pgm_header_len, 0); guint32 unfolded_odata = pgm_csum_partial_copy ((const void*)(buf + data_bytes_sent), (void*)(skb->pgm_opt_fragment + 1), tsdu_length, 0); skb->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, unfolded_odata, pgm_header_len)); /* add to transmit window */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, skb); pgm_spinlock_unlock (&sock->txw_spinlock); /* do not send send packet */ if (packets != 1) pgm_sendto_hops (sock, TRUE, FALSE, sock->hops, skb->data, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); /* save unfolded odata for retransmissions */ *(guint32*)&skb->cb = unfolded_odata; packets++; bytes_sent += tpdu_length + sock->iphdr_len; data_bytes_sent += tsdu_length; } while (data_bytes_sent < count); if (data_bytes_sent > 0 && bytes_written) *bytes_written = data_bytes_sent; /* release txw lock here in order to allow spms to lock mutex */ pgm_mutex_unlock (&sock->source_mutex); pgm_reset_heartbeat_spm (sock); return PGM_IO_STATUS_NORMAL; } static int brokn_send ( pgm_sock_t* sock, const gchar* data, gsize len, gsize* bytes_written ) { if ( len <= ( sock->max_tpdu - ( sizeof(struct pgm_header) + sizeof(struct pgm_data) ) ) ) { puts ("FAILED: cannot send brokn single TPDU length APDU"); return PGM_IO_STATUS_ERROR; } return brokn_send_apdu_unlocked (sock, data, len, bytes_written); } static void session_send ( char* session_name, char* string, gboolean is_brokn /* send broken apdu */ ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* send message */ int status; gsize stringlen = strlen(string) + 1; struct timeval tv; #ifndef _WIN32 int fds = 0; fd_set writefds; #else int send_sock; DWORD cEvents = 1; WSAEVENT waitEvents[ cEvents ]; DWORD dwTimeout, dwEvents; socklen_t socklen = sizeof(int); waitEvents[0] = WSACreateEvent (); pgm_getsockopt (sess->sock, IPPROTO_PGM, PGM_SEND_SOCK, &send_sock, &socklen); WSAEventSelect (send_sock, waitEvents[0], FD_WRITE); #endif again: if (is_brokn) status = brokn_send (sess->sock, string, stringlen, NULL); else status = pgm_send (sess->sock, string, stringlen, NULL); switch (status) { case PGM_IO_STATUS_NORMAL: puts ("READY"); break; case PGM_IO_STATUS_TIMER_PENDING: { socklen_t optlen = sizeof (tv); pgm_getsockopt (sess->sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen); } goto block; case PGM_IO_STATUS_RATE_LIMITED: { socklen_t optlen = sizeof (tv); pgm_getsockopt (sess->sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen); } /* fall through */ case PGM_IO_STATUS_WOULD_BLOCK: block: #ifndef _WIN32 FD_ZERO(&writefds); pgm_select_info (sess->sock, NULL, &writefds, &fds); const int ready = select (1, NULL, &writefds, NULL, &tv); #else dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE); #endif goto again; default: puts ("FAILED: pgm_send()"); break; } } static void session_destroy ( char* session_name ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* remove from hash table */ g_hash_table_remove (g_sessions, session_name); /* close down receive side first to stop new data incoming */ if (sess->recv_channel) { puts ("closing receive channel."); GError *err = NULL; g_io_channel_shutdown (sess->recv_channel, TRUE, &err); if (err) { g_warning ("i/o shutdown error %i %s", err->code, err->message); } /* TODO: flush GLib main loop with context specific to the recv channel */ sess->recv_channel = NULL; } if (sess->is_transport_fake) { fake_pgm_close (sess->sock, TRUE); } else { pgm_close (sess->sock, TRUE); } sess->sock = NULL; g_free (sess->name); sess->name = NULL; g_free (sess); puts ("READY"); } static void net_send_data ( char* session_name, guint8 pgm_type, /* PGM_ODATA or PGM_RDATA */ guint32 data_sqn, guint32 txw_trail, char* string ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } pgm_sock_t* sock = sess->sock; /* payload is string including terminating null. */ int count = strlen(string) + 1; /* send */ int retval = 0; int tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_data) + count; gchar buf[ tpdu_length ]; struct pgm_header *header = (struct pgm_header*)buf; struct pgm_data *data = (struct pgm_data*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = pgm_type; header->pgm_options = 0; header->pgm_tsdu_length = g_htons (count); /* O/RDATA */ data->data_sqn = g_htonl (data_sqn); data->data_trail = g_htonl (txw_trail); memcpy (data + 1, string, count); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial ((char*)header, tpdu_length, 0)); pgm_mutex_lock (&sock->send_mutex); retval = sendto (sock->send_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); pgm_mutex_unlock (&sock->send_mutex); puts ("READY"); } /* differs to net_send_data in that the string parameters contains every payload * for the transmission group. this is required to calculate the correct parity * as the fake transport does not own a transmission window. * * all payloads must be the same length unless variable TSDU support is enabled. */ static void net_send_parity ( char* session_name, guint8 pgm_type, /* PGM_ODATA or PGM_RDATA */ guint32 data_sqn, guint32 txw_trail, char* string ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } pgm_sock_t* sock = sess->sock; /* split string into individual payloads */ guint16 parity_length = 0; gchar** src; src = g_strsplit (string, " ", sock->rs_k); /* payload is string including terminating null. */ parity_length = strlen(*src) + 1; /* check length of payload array */ gboolean is_var_pktlen = FALSE; guint i; for (i = 0; src[i]; i++) { guint tsdu_length = strlen(src[i]) + 1; if (tsdu_length != parity_length) { is_var_pktlen = TRUE; if (tsdu_length > parity_length) parity_length = tsdu_length; } } if ( i != sock->rs_k ) { printf ("FAILED: payload array length %u, whilst rs_k is %u.\n", i, sock->rs_k); return; } /* add padding and append TSDU lengths */ if (is_var_pktlen) { for (i = 0; src[i]; i++) { guint tsdu_length = strlen(src[i]) + 1; gchar* new_string = g_new0 (gchar, parity_length + 2); strncpy (new_string, src[i], parity_length); *(guint16*)(new_string + parity_length) = tsdu_length; g_free (src[i]); src[i] = new_string; } parity_length += 2; } /* calculate FEC block offset */ guint32 tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; guint rs_h = data_sqn & ~tg_sqn_mask; /* send */ int retval = 0; int tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_data) + parity_length; gchar buf[ tpdu_length ]; struct pgm_header *header = (struct pgm_header*)buf; struct pgm_data *data = (struct pgm_data*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = pgm_type; header->pgm_options = is_var_pktlen ? (PGM_OPT_PARITY | PGM_OPT_VAR_PKTLEN) : PGM_OPT_PARITY; header->pgm_tsdu_length = g_htons (parity_length); /* O/RDATA */ data->data_sqn = g_htonl (data_sqn); data->data_trail = g_htonl (txw_trail); memset (data + 1, 0, parity_length); pgm_rs_t rs; pgm_rs_create (&rs, sock->rs_n, sock->rs_k); pgm_rs_encode (&rs, (const pgm_gf8_t**)src, sock->rs_k + rs_h, (pgm_gf8_t*)(data + 1), parity_length); pgm_rs_destroy (&rs); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial ((char*)header, tpdu_length, 0)); pgm_mutex_lock (&sock->send_mutex); retval = sendto (sock->send_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); pgm_mutex_unlock (&sock->send_mutex); g_strfreev (src); src = NULL; puts ("READY"); } static void net_send_spm ( char* session_name, guint32 spm_sqn, guint32 txw_trail, guint32 txw_lead, gboolean proactive_parity, gboolean ondemand_parity, guint k ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } pgm_sock_t* sock = sess->sock; /* send */ int retval = 0; int tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_spm); if (proactive_parity || ondemand_parity) { tpdu_length += sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_parity_prm); } gchar buf[ tpdu_length ]; struct pgm_header *header = (struct pgm_header*)buf; struct pgm_spm *spm = (struct pgm_spm*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = PGM_SPM; header->pgm_options = (proactive_parity || ondemand_parity) ? (PGM_OPT_PRESENT | PGM_OPT_NETWORK) : 0; header->pgm_tsdu_length = 0; /* SPM */ spm->spm_sqn = g_htonl (spm_sqn); spm->spm_trail = g_htonl (txw_trail); spm->spm_lead = g_htonl (txw_lead); pgm_sockaddr_to_nla ((struct sockaddr*)&sock->send_addr, (char*)&spm->spm_nla_afi); if (proactive_parity || ondemand_parity) { struct pgm_opt_length* opt_len = (struct pgm_opt_length*)(spm + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = g_htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_parity_prm) ); struct pgm_opt_header* opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_PARITY_PRM | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_parity_prm); struct pgm_opt_parity_prm* opt_parity_prm = (struct pgm_opt_parity_prm*)(opt_header + 1); opt_parity_prm->opt_reserved = (proactive_parity ? PGM_PARITY_PRM_PRO : 0) | (ondemand_parity ? PGM_PARITY_PRM_OND : 0); opt_parity_prm->parity_prm_tgs = g_htonl (k); } header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial ((char*)header, tpdu_length, 0)); retval = sendto (sock->send_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); puts ("READY"); } static void net_send_spmr ( char* session_name, pgm_tsi_t* tsi ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } pgm_sock_t* sock = sess->sock; /* check that the peer exists */ pgm_peer_t* peer = pgm_hashtable_lookup (sock->peers_hashtable, tsi); struct sockaddr_storage peer_nla; pgm_gsi_t* peer_gsi; guint16 peer_sport; if (peer == NULL) { /* ourself */ if (pgm_tsi_equal (tsi, &sock->tsi)) { peer_gsi = &sock->tsi.gsi; peer_sport = sock->tsi.sport; } else { printf ("FAILED: peer \"%s\" not found\n", pgm_tsi_print (tsi)); return; } } else { memcpy (&peer_nla, &peer->local_nla, sizeof(struct sockaddr_storage)); peer_gsi = &peer->tsi.gsi; peer_sport = peer->tsi.sport; } /* send */ int retval = 0; int tpdu_length = sizeof(struct pgm_header); gchar buf[ tpdu_length ]; struct pgm_header *header = (struct pgm_header*)buf; memcpy (header->pgm_gsi, peer_gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->dport; header->pgm_dport = peer_sport; header->pgm_type = PGM_SPMR; header->pgm_options = 0; header->pgm_tsdu_length = 0; header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial ((char*)header, tpdu_length, 0)); pgm_mutex_lock (&sock->send_mutex); /* TTL 1 */ pgm_sockaddr_multicast_hops (sock->send_sock, sock->send_gsr.gsr_group.ss_family, 1); retval = sendto (sock->send_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); /* default TTL */ pgm_sockaddr_multicast_hops (sock->send_sock, sock->send_gsr.gsr_group.ss_family, sock->hops); if (!pgm_tsi_equal (tsi, &sock->tsi)) { retval = sendto (sock->send_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&peer_nla, pgm_sockaddr_len((struct sockaddr*)&peer_nla)); } pgm_mutex_unlock (&sock->send_mutex); puts ("READY"); } /* Send a NAK on a valid transport. A fake transport would need to specify the senders NLA, * we use the peer list to bypass extracting it from the monitor output. */ static void net_send_ncf ( char* session_name, pgm_tsi_t* tsi, struct pgm_sqn_list_t* sqn_list /* list of sequence numbers */ ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* check that the peer exists */ pgm_sock_t* sock = sess->sock; pgm_peer_t* peer = pgm_hashtable_lookup (sock->peers_hashtable, tsi); if (peer == NULL) { printf ("FAILED: peer \"%s\" not found\n", pgm_tsi_print (tsi)); return; } /* check for valid nla */ if (((struct sockaddr*)&peer->nla)->sa_family == 0 ) { puts ("FAILED: peer NLA unknown, cannot send NCF."); return; } /* send */ int retval = 0; int tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak); if (sqn_list->len > 1) { tpdu_length += sizeof(struct pgm_opt_length) + /* includes header */ sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( (sqn_list->len-1) * sizeof(guint32) ); } gchar buf[ tpdu_length ]; struct pgm_header *header = (struct pgm_header*)buf; struct pgm_nak *ncf = (struct pgm_nak*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); struct sockaddr_storage peer_nla; memcpy (&peer_nla, &peer->nla, sizeof(struct sockaddr_storage)); /* dport & sport swap over for a nak */ header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = PGM_NCF; header->pgm_options = (sqn_list->len > 1) ? (PGM_OPT_PRESENT | PGM_OPT_NETWORK) : 0; header->pgm_tsdu_length = 0; /* NCF */ ncf->nak_sqn = g_htonl (sqn_list->sqn[0]); /* source nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&peer_nla, (char*)&ncf->nak_src_nla_afi); /* group nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&sock->recv_gsr[0].gsr_group, (char*)&ncf->nak_grp_nla_afi); /* OPT_NAK_LIST */ if (sqn_list->len > 1) { struct pgm_opt_length* opt_len = (struct pgm_opt_length*)(ncf + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = g_htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( (sqn_list->len-1) * sizeof(guint32) ) ); struct pgm_opt_header* opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_NAK_LIST | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( (sqn_list->len-1) * sizeof(guint32) ); struct pgm_opt_nak_list* opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); opt_nak_list->opt_reserved = 0; for (guint i = 1; i < sqn_list->len; i++) { opt_nak_list->opt_sqn[i-1] = g_htonl (sqn_list->sqn[i]); } } header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial ((char*)header, tpdu_length, 0)); retval = sendto (sock->send_with_router_alert_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); puts ("READY"); } static void net_send_nak ( char* session_name, pgm_tsi_t* tsi, struct pgm_sqn_list_t* sqn_list, /* list of sequence numbers */ gboolean is_parity /* TRUE = parity, FALSE = selective */ ) { /* check that session exists */ struct sim_session* sess = g_hash_table_lookup (g_sessions, session_name); if (sess == NULL) { printf ("FAILED: session '%s' not found\n", session_name); return; } /* check that the peer exists */ pgm_sock_t* sock = sess->sock; pgm_peer_t* peer = pgm_hashtable_lookup (sock->peers_hashtable, tsi); if (peer == NULL) { printf ("FAILED: peer \"%s\" not found\n", pgm_tsi_print(tsi)); return; } /* send */ int retval = 0; int tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak); if (sqn_list->len > 1) { tpdu_length += sizeof(struct pgm_opt_length) + /* includes header */ sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( (sqn_list->len-1) * sizeof(guint32) ); } gchar buf[ tpdu_length ]; struct pgm_header *header = (struct pgm_header*)buf; struct pgm_nak *nak = (struct pgm_nak*)(header + 1); memcpy (header->pgm_gsi, &peer->tsi.gsi, sizeof(pgm_gsi_t)); guint16 peer_sport = peer->tsi.sport; struct sockaddr_storage peer_nla; memcpy (&peer_nla, &peer->nla, sizeof(struct sockaddr_storage)); /* dport & sport swap over for a nak */ header->pgm_sport = sock->dport; header->pgm_dport = peer_sport; header->pgm_type = PGM_NAK; if (is_parity) { header->pgm_options = (sqn_list->len > 1) ? (PGM_OPT_PRESENT | PGM_OPT_NETWORK | PGM_OPT_PARITY) : PGM_OPT_PARITY; } else { header->pgm_options = (sqn_list->len > 1) ? (PGM_OPT_PRESENT | PGM_OPT_NETWORK) : 0; } header->pgm_tsdu_length = 0; /* NAK */ nak->nak_sqn = g_htonl (sqn_list->sqn[0]); /* source nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&peer_nla, (char*)&nak->nak_src_nla_afi); /* group nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&sock->recv_gsr[0].gsr_group, (char*)&nak->nak_grp_nla_afi); /* OPT_NAK_LIST */ if (sqn_list->len > 1) { struct pgm_opt_length* opt_len = (struct pgm_opt_length*)(nak + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = g_htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( (sqn_list->len-1) * sizeof(guint32) ) ); struct pgm_opt_header* opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_NAK_LIST | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_nak_list) + ( (sqn_list->len-1) * sizeof(guint32) ); struct pgm_opt_nak_list* opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); opt_nak_list->opt_reserved = 0; for (guint i = 1; i < sqn_list->len; i++) { opt_nak_list->opt_sqn[i-1] = g_htonl (sqn_list->sqn[i]); } } header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial ((char*)header, tpdu_length, 0)); retval = sendto (sock->send_with_router_alert_sock, (const void*)header, tpdu_length, 0, /* not expecting a reply */ (struct sockaddr*)&peer_nla, pgm_sockaddr_len((struct sockaddr*)&peer_nla)); puts ("READY"); } static int on_data ( gpointer data, G_GNUC_UNUSED guint len, G_GNUC_UNUSED gpointer user_data ) { printf ("DATA: %s\n", (char*)data); fflush (stdout); return 0; } /* process input commands from stdin/fd */ static gboolean on_stdin_data ( GIOChannel* source, G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data ) { gchar* str = NULL; gsize len = 0; gsize term = 0; GError* err = NULL; g_io_channel_read_line (source, &str, &len, &term, &err); if (len > 0) { if (term) str[term] = 0; /* quit */ if (strcmp(str, "quit") == 0) { g_main_loop_quit(g_loop); goto out; } regex_t preg; regmatch_t pmatch[10]; const char *re; /* endpoint simulator specific: */ /* send odata or rdata */ re = "^net[[:space:]]+send[[:space:]]+([or])data[[:space:]]+" "([[:alnum:]]+)[[:space:]]+" /* transport */ "([0-9]+)[[:space:]]+" /* sequence number */ "([0-9]+)[[:space:]]+" /* txw_trail */ "([[:alnum:]]+)$"; /* payload */ regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { guint8 pgm_type = *(str + pmatch[1].rm_so) == 'o' ? PGM_ODATA : PGM_RDATA; char *name = g_memdup (str + pmatch[2].rm_so, pmatch[2].rm_eo - pmatch[2].rm_so + 1 ); name[ pmatch[2].rm_eo - pmatch[2].rm_so ] = 0; char* p = str + pmatch[3].rm_so; guint32 data_sqn = strtoul (p, &p, 10); p = str + pmatch[4].rm_so; guint txw_trail = strtoul (p, &p, 10); char *string = g_memdup (str + pmatch[5].rm_so, pmatch[5].rm_eo - pmatch[5].rm_so + 1 ); string[ pmatch[5].rm_eo - pmatch[5].rm_so ] = 0; net_send_data (name, pgm_type, data_sqn, txw_trail, string); g_free (name); g_free (string); regfree (&preg); goto out; } regfree (&preg); /* send parity odata or rdata */ re = "^net[[:space:]]+send[[:space:]]+parity[[:space:]]+([or])data[[:space:]]+" "([[:alnum:]]+)[[:space:]]+" /* transport */ "([0-9]+)[[:space:]]+" /* sequence number */ "([0-9]+)[[:space:]]+" /* txw_trail */ "([a-z0-9 ]+)$"; /* payloads */ regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { guint8 pgm_type = *(str + pmatch[1].rm_so) == 'o' ? PGM_ODATA : PGM_RDATA; char *name = g_memdup (str + pmatch[2].rm_so, pmatch[2].rm_eo - pmatch[2].rm_so + 1 ); name[ pmatch[2].rm_eo - pmatch[2].rm_so ] = 0; char* p = str + pmatch[3].rm_so; guint32 data_sqn = strtoul (p, &p, 10); p = str + pmatch[4].rm_so; guint txw_trail = strtoul (p, &p, 10); /* ideally confirm number of payloads matches sess->sock::rs_k ... */ char *string = g_memdup (str + pmatch[5].rm_so, pmatch[5].rm_eo - pmatch[5].rm_so + 1 ); string[ pmatch[5].rm_eo - pmatch[5].rm_so ] = 0; net_send_parity (name, pgm_type, data_sqn, txw_trail, string); g_free (name); g_free (string); regfree (&preg); goto out; } regfree (&preg); /* send spm */ re = "^net[[:space:]]+send[[:space:]]+spm[[:space:]]+" "([[:alnum:]]+)[[:space:]]+" /* transport */ "([0-9]+)[[:space:]]+" /* spm sequence number */ "([0-9]+)[[:space:]]+" /* txw_trail */ "([0-9]+)" /* txw_lead */ "([[:space:]]+pro-active)?" /* pro-active parity */ "([[:space:]]+on-demand)?" /* on-demand parity */ "([[:space:]]+[0-9]+)?$"; /* transmission group size */ regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char* p = str + pmatch[2].rm_so; guint32 spm_sqn = strtoul (p, &p, 10); p = str + pmatch[3].rm_so; guint txw_trail = strtoul (p, &p, 10); p = str + pmatch[4].rm_so; guint txw_lead = strtoul (p, &p, 10); gboolean proactive_parity = pmatch[5].rm_eo > pmatch[5].rm_so; gboolean ondemand_parity = pmatch[6].rm_eo > pmatch[6].rm_so; p = str + pmatch[7].rm_so; guint k = (pmatch[7].rm_eo > pmatch[7].rm_so) ? strtoul (p, &p, 10) : 0; net_send_spm (name, spm_sqn, txw_trail, txw_lead, proactive_parity, ondemand_parity, k); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* send spmr */ re = "^net[[:space:]]+send[[:space:]]+spmr[[:space:]]+" "([[:alnum:]]+)[[:space:]]+" /* transport */ "([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)$"; /* TSI */ regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; pgm_tsi_t tsi; char *p = str + pmatch[2].rm_so; tsi.gsi.identifier[0] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[1] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[2] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[3] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[4] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[5] = strtol (p, &p, 10); ++p; tsi.sport = g_htons ( strtol (p, NULL, 10) ); net_send_spmr (name, &tsi); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* send nak/ncf */ re = "^net[[:space:]]+send[[:space:]](parity[[:space:]])?n(ak|cf)[[:space:]]+" "([[:alnum:]]+)[[:space:]]+" /* transport */ "([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)[[:space:]]+" /* TSI */ "([0-9,]+)$"; /* sequence number or list */ regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[3].rm_so, pmatch[3].rm_eo - pmatch[3].rm_so + 1 ); name[ pmatch[3].rm_eo - pmatch[3].rm_so ] = 0; pgm_tsi_t tsi; char *p = str + pmatch[4].rm_so; tsi.gsi.identifier[0] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[1] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[2] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[3] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[4] = strtol (p, &p, 10); ++p; tsi.gsi.identifier[5] = strtol (p, &p, 10); ++p; tsi.sport = g_htons ( strtol (p, NULL, 10) ); /* parse list of sequence numbers */ struct pgm_sqn_list_t sqn_list; sqn_list.len = 0; { #ifndef _WIN32 char* saveptr = NULL; for (p = str + pmatch[5].rm_so; ; p = NULL) { char* token = strtok_r (p, ",", &saveptr); if (!token) break; sqn_list.sqn[sqn_list.len++] = strtoul (token, NULL, 10); } #else for (p = str + pmatch[5].rm_so; ; p = NULL) { char* token = strtok (p, ","); if (!token) break; sqn_list.sqn[sqn_list.len++] = strtoul (token, NULL, 10); } #endif } if ( *(str + pmatch[2].rm_so) == 'a' ) { net_send_nak (name, &tsi, &sqn_list, (pmatch[1].rm_eo > pmatch[1].rm_so)); } else { net_send_ncf (name, &tsi, &sqn_list); } g_free (name); regfree (&preg); goto out; } regfree (&preg); /** same as test application: **/ /* create transport */ re = "^create[[:space:]]+(fake[[:space:]]+)?([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[2].rm_so, pmatch[2].rm_eo - pmatch[2].rm_so + 1 ); name[ pmatch[2].rm_eo - pmatch[2].rm_so ] = 0; session_create (name, (pmatch[1].rm_eo > pmatch[1].rm_so)); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* enable Reed-Solomon Forward Error Correction */ re = "^set[[:space:]]+([[:alnum:]]+)[[:space:]]+FEC[[:space:]]+RS[[:space:]]*\\([[:space:]]*([0-9]+)[[:space:]]*,[[:space:]]*([0-9]+)[[:space:]]*\\)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *p = str + pmatch[2].rm_so; *(str + pmatch[2].rm_eo) = 0; guint n = strtol (p, &p, 10); p = str + pmatch[3].rm_so; *(str + pmatch[3].rm_eo) = 0; guint k = strtol (p, &p, 10); session_set_fec (name, n, k); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* bind socket */ re = "^bind[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_bind (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* connect socket */ re = "^connect[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_connect (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* send packet */ re = "^send[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; char *string = g_memdup (str + pmatch[2].rm_so, pmatch[2].rm_eo - pmatch[2].rm_so + 1 ); string[ pmatch[2].rm_eo - pmatch[2].rm_so ] = 0; session_send (name, string, FALSE); g_free (name); g_free (string); regfree (&preg); goto out; } regfree (&preg); re = "^send[[:space:]]+(brokn[[:space:]]+)?([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+x[[:space:]]([0-9]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[2].rm_so, pmatch[2].rm_eo - pmatch[2].rm_so + 1 ); name[ pmatch[2].rm_eo - pmatch[2].rm_so ] = 0; char* p = str + pmatch[4].rm_so; int factor = strtol (p, &p, 10); int src_len = pmatch[3].rm_eo - pmatch[3].rm_so; char *string = g_malloc ( (factor * src_len) + 1 ); for (int i = 0; i < factor; i++) { memcpy (string + (i * src_len), str + pmatch[3].rm_so, src_len); } string[ factor * src_len ] = 0; session_send (name, string, (pmatch[1].rm_eo > pmatch[1].rm_so)); g_free (name); g_free (string); regfree (&preg); goto out; } regfree (&preg); /* destroy transport */ re = "^destroy[[:space:]]+([[:alnum:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *name = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); name[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; session_destroy (name); g_free (name); regfree (&preg); goto out; } regfree (&preg); /* set PGM network */ re = "^set[[:space:]]+network[[:space:]]+([[:print:]]*;[[:print:]]+)$"; regcomp (&preg, re, REG_EXTENDED); if (0 == regexec (&preg, str, G_N_ELEMENTS(pmatch), pmatch, 0)) { char *pgm_network = g_memdup (str + pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so + 1 ); pgm_network[ pmatch[1].rm_eo - pmatch[1].rm_so ] = 0; g_network = pgm_network; puts ("READY"); regfree (&preg); goto out; } regfree (&preg); printf ("unknown command: %s\n", str); } out: fflush (stdout); g_free (str); return TRUE; } /* idle log notification */ static gboolean on_mark ( G_GNUC_UNUSED gpointer data ) { g_message ("-- MARK --"); return TRUE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/test/spmr.pl0000755000175000017500000000354211640407354020047 0ustar locallocal#!/usr/bin/perl # spmr.pl # 13.3.1. SPM Requests use strict; use Time::HiRes qw( gettimeofday tv_interval ); use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create fake ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); ## capture GSI of test spp $app->say ("send ao nashi"); print "mon: wait for odata ...\n"; my $odata = $mon->wait_for_odata; print "mon: odata received.\n"; my $t0 = [gettimeofday]; my $elapsed; $mon->disconnect (1); ## spm hearbeats are going to clear out the data, lets wait for some quiet print "sim: wait for SPM interval > 5 seconds ...\n"; do { $sim->wait_for_spm; $elapsed = tv_interval ( $t0, [gettimeofday] ); print "sim: received SPM after $elapsed seconds.\n"; } while ($elapsed < 5); print "sim: request SPM via SPMR.\n"; $sim->say ("net send spmr ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort}"); $t0 = [gettimeofday]; print "sim: wait for SPM ...\n"; $sim->wait_for_spm; $elapsed = tv_interval ( $t0, [gettimeofday] ); print "sim: SPM received after $elapsed seconds.\n"; die "SPM interval too large, indicates heartbeat not SPMR induced.\n" unless ($elapsed < 5.0); print "test completed successfully.\n"; $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/test/nak_repeat.pl0000755000175000017500000000304511640407354021175 0ustar locallocal#!/usr/bin/perl # nak_repeat.pl # 5.3. Repairs use strict; use PGM::Test; BEGIN { require "test.conf.pl"; } $| = 1; my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd}); my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd}); my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd}); $mon->connect; $sim->connect; $app->connect; sub close_ssh { $mon = $sim = $app = undef; print "finished.\n"; } $SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); }; $mon->say ("filter $config{app}{ip}"); print "mon: ready.\n"; $sim->say ("create ao"); $sim->say ("bind ao"); $sim->say ("connect ao"); print "sim: ready.\n"; $app->say ("create ao"); $app->say ("bind ao"); $app->say ("connect ao"); $app->say ("listen ao"); # to process NAK requests print "app: publish test data.\n"; $app->say ("send ao " . ("ringo" x 200)); $app->say ("send ao " . ("ichigo" x 200)); $app->say ("send ao " . ("momo" x 200)); my $odata = undef; my $ocnt = 0; for (1..3) { print "mon: wait for odata ...\n"; $odata = $mon->wait_for_odata; $ocnt++; print "mon: received $ocnt x odata.\n"; } for (1..1000) { my $i = $_; print "sim: $i# send nak to app.\n"; $sim->say ("net send nak ao $odata->{PGM}->{gsi}.$odata->{PGM}->{sourcePort} 2"); print "mon: $i# wait for rdata ...\n"; $mon->wait_for_rdata; print "mon: $i# rdata received.\n"; } print "test completed successfully.\n"; $mon->disconnect (1); $sim->disconnect; $app->disconnect; close_ssh; # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/SConscript.libpgmhttp0000644000175000017500000000415411640407354021732 0ustar locallocal# -*- mode: python -*- # OpenPGM build script # $Id$ Import('env') e = env.Clone() e.Append(CCFLAGS = '-DGETTEXT_PACKAGE=\'"pgm-http"\''); # add binary tree to include path to find embedded htdocs e.Append(CPPPATH = ['.']); src = Split(""" http.c """) htdocs = Split(""" htdocs/404.html htdocs/base.css htdocs/robots.txt htdocs/xhtml10_strict.doctype """) pgmhttp = e.StaticLibrary('libpgmhttp', src); pgmhttppic = e.StaticSharedLibrary('libpgmhttp-pic', src); # embed htdocs into C headers embed_htdoc = Builder(action = './htdocs/convert_to_macro.pl $SOURCE > $TARGET') e.Append(BUILDERS = {'EmbedHtdoc' : embed_htdoc}) for htdoc in htdocs: embedded = htdoc + '.h' e.EmbedHtdoc(embedded, htdoc) #----------------------------------------------------------------------------- # unit testing if env['WITH_CHECK'] == 'true': te = e.Clone(); # add new suffix so we can re-use libpgm objects te['SHOBJSUFFIX'] = '.http' + te['SHOBJSUFFIX']; te['OBJSUFFIX'] = '.http' + te['OBJSUFFIX']; te.MergeFlags(env['GLIB_FLAGS']); te.MergeFlags(env['CHECK_FLAGS']); newCCFLAGS = []; for flag in te['CCFLAGS']: if ("-W" != flag[:2]) and ("-pedantic" != flag[:9]): newCCFLAGS.append(flag); te['CCFLAGS'] = newCCFLAGS; te.Program (['http_unittest.c', # framework te.Object('checksum.c'), te.Object('error.c'), te.Object('galois_tables.c'), te.Object('getifaddrs.c'), te.Object('getnodeaddr.c'), te.Object('hashtable.c'), te.Object('histogram.c'), te.Object('indextoaddr.c'), te.Object('indextoname.c'), te.Object('inet_network.c'), te.Object('list.c'), te.Object('math.c'), te.Object('md5.c'), te.Object('mem.c'), te.Object('messages.c'), te.Object('nametoindex.c'), te.Object('queue.c'), te.Object('rand.c'), te.Object('rate_control.c'), te.Object('reed_solomon.c'), te.Object('slist.c'), te.Object('sockaddr.c'), te.Object('string.c'), te.Object('thread.c'), te.Object('time.c'), te.Object('wsastrerror.c'), # sockets te.Object('tsi.c'), te.Object('gsi.c'), te.Object('version.c'), # sunpro linking te.Object('skbuff.c') ]); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/backtrace.c0000644000175000017500000000345511640407354017635 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Dump back trace to stderr and try gdb. * * Copyright (c) 2006-2007 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef CONFIG_HAVE_BACKTRACE # include # include # include # include #endif #include #include #include void on_sigsegv ( G_GNUC_UNUSED int signum ) { #ifdef CONFIG_HAVE_BACKTRACE void* array[256]; char** names; char cmd[1024]; int i, size; gchar *out, *err; gint exit_status; fprintf (stderr, "\n======= Backtrace: =========\n"); size = backtrace (array, G_N_ELEMENTS(array)); names = backtrace_symbols (array, size); for (i = 0; i < size; i++) fprintf (stderr, "%s\n", names[i]); free (names); fflush (stderr); sprintf (cmd, "gdb --ex 'attach %ld' --ex 'info threads' --ex 'thread apply all bt' --batch", (long)getpid ()); if ( g_spawn_command_line_sync (cmd, &out, &err, &exit_status, NULL) ) { fprintf (stderr, "======= GDB Backtrace: =========\n"); fprintf (stderr, "%s\n", out); } #endif /* CONFIG_HAVE_BACKTRACE */ abort (); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/getifaddrs.c.c89.patch0000644000175000017500000001054611640407354021531 0ustar locallocal--- getifaddrs.c 2011-03-29 20:41:43.000000000 +0800 +++ getifaddrs.c89.c 2011-03-29 20:41:58.000000000 +0800 @@ -539,7 +539,9 @@ /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ - for (unsigned i = MAX_TRIES; i; i--) + { + unsigned i; + for (i = MAX_TRIES; i; i--) { pgm_debug ("IP_ADAPTER_INFO buffer length %lu bytes.", ulOutBufLen); pAdapterInfo = (IP_ADAPTER_INFO*)_pgm_heap_alloc (ulOutBufLen); @@ -551,6 +553,7 @@ break; } } + } switch (dwRet) { case ERROR_SUCCESS: /* NO_ERROR */ @@ -575,12 +578,15 @@ } /* count valid adapters */ + { int n = 0, k = 0; for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { - for (IP_ADDR_STRING *pIPAddr = &pAdapter->IpAddressList; + { + IP_ADDR_STRING *pIPAddr; + for (pIPAddr = &pAdapter->IpAddressList; pIPAddr; pIPAddr = pIPAddr->Next) { @@ -590,10 +596,12 @@ ++n; } } + } pgm_debug ("GetAdaptersInfo() discovered %d interfaces.", n); /* contiguous block for adapter list */ + { struct _pgm_ifaddrs_t* ifa = pgm_new0 (struct _pgm_ifaddrs_t, n); struct _pgm_ifaddrs_t* ift = ifa; @@ -602,7 +610,9 @@ pAdapter; pAdapter = pAdapter->Next) { - for (IP_ADDR_STRING *pIPAddr = &pAdapter->IpAddressList; + { + IP_ADDR_STRING *pIPAddr; + for (pIPAddr = &pAdapter->IpAddressList; pIPAddr; pIPAddr = pIPAddr->Next) { @@ -635,11 +645,14 @@ ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } } + } } if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); *ifap = (struct pgm_ifaddrs_t*)ifa; + } + } return TRUE; } @@ -656,7 +669,9 @@ /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ - for (unsigned i = MAX_TRIES; i; i--) + { + unsigned i; + for (i = MAX_TRIES; i; i--) { pgm_debug ("IP_ADAPTER_ADDRESSES buffer length %lu bytes.", dwSize); pAdapterAddresses = (IP_ADAPTER_ADDRESSES*)_pgm_heap_alloc (dwSize); @@ -676,6 +691,7 @@ break; } } + } switch (dwRet) { case ERROR_SUCCESS: @@ -700,12 +716,15 @@ } /* count valid adapters */ + { int n = 0, k = 0; for (adapter = pAdapterAddresses; adapter; adapter = adapter->Next) { - for (IP_ADAPTER_UNICAST_ADDRESS *unicast = adapter->FirstUnicastAddress; + { + IP_ADAPTER_UNICAST_ADDRESS *unicast; + for (unicast = adapter->FirstUnicastAddress; unicast; unicast = unicast->Next) { @@ -718,9 +737,11 @@ ++n; } + } } /* contiguous block for adapter list */ + { struct _pgm_ifaddrs_t* ifa = pgm_new0 (struct _pgm_ifaddrs_t, n); struct _pgm_ifaddrs_t* ift = ifa; @@ -730,7 +751,9 @@ adapter = adapter->Next) { int unicastIndex = 0; - for (IP_ADAPTER_UNICAST_ADDRESS *unicast = adapter->FirstUnicastAddress; + { + IP_ADAPTER_UNICAST_ADDRESS *unicast; + for (unicast = adapter->FirstUnicastAddress; unicast; unicast = unicast->Next, ++unicastIndex) { @@ -764,9 +787,12 @@ ift->_ifa.ifa_netmask = (void*)&ift->_netmask; /* pre-Vista must hunt for matching prefix in linked list, otherwise use OnLinkPrefixLength */ + { int prefixIndex = 0; ULONG prefixLength = 0; - for (IP_ADAPTER_PREFIX *prefix = adapter->FirstPrefix; + { + IP_ADAPTER_PREFIX *prefix; + for (prefix = adapter->FirstPrefix; prefix; prefix = prefix->Next, ++prefixIndex) { @@ -775,6 +801,7 @@ break; } } + } /* map prefix to netmask */ ift->_ifa.ifa_netmask->sa_family = unicast->Address.lpSockaddr->sa_family; @@ -792,12 +819,16 @@ pgm_trace (PGM_LOG_ROLE_NETWORK,_("IPv6 adapter %s prefix length is 0, overriding to 128."), adapter->AdapterName); prefixLength = 128; } - for (ULONG i = prefixLength, j = 0; i > 0; i -= 8, ++j) + { + ULONG i, j; + for (i = prefixLength, j = 0; i > 0; i -= 8, ++j) { ((struct sockaddr_in6*)ift->_ifa.ifa_netmask)->sin6_addr.s6_addr[ j ] = i >= 8 ? 0xff : (ULONG)(( 0xffU << ( 8 - i ) ) & 0xffU ); } + } break; } + } /* next */ if (k++ < (n - 1)) { @@ -805,11 +836,14 @@ ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); } } + } } if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); *ifap = (struct pgm_ifaddrs_t*)ifa; + } + } return TRUE; } #endif /* _WIN32 */ libpgm-5.1.118-1~dfsg/openpgm/pgm/string.c.c89.patch0000644000175000017500000000221411640407354020714 0ustar locallocal--- string.c 2011-03-29 20:39:06.000000000 +0800 +++ string.c89.c 2011-03-29 20:40:06.000000000 +0800 @@ -98,17 +98,20 @@ free (strp); } #else + { # ifdef _MSC_VER /* can only copy on assignment, pointer to stack frame */ va_list args2 = args; # else +/* C99 va_copy macro */ va_list args2; va_copy (args2, args); # endif - *string = pgm_malloc (pgm_printf_string_upper_bound (format, args)); -/* NB: must be able to handle NULL args, fails on GCC */ - len = vsprintf (*string, format, args2); + len = pgm_printf_string_upper_bound (format, args); + *string = pgm_malloc (len); + len = pgm_vsnprintf_s (*string, len, _TRUNCATE, format, args2); va_end (args2); + } #endif return len; } @@ -139,13 +142,14 @@ #ifdef CONFIG_HAVE_STPCPY return stpcpy (dest, src); #else + { char *d = dest; const char *s = src; - do { *d++ = *s; } while (*s++ != '\0'); return d - 1; + } #endif } @@ -254,8 +258,11 @@ { if (PGM_LIKELY (NULL != str_array)) { - for (unsigned i = 0; str_array[i] != NULL; i++) + { + unsigned i; + for (i = 0; str_array[i] != NULL; i++) pgm_free (str_array[i]); + } pgm_free (str_array); } libpgm-5.1.118-1~dfsg/openpgm/pgm/gcov-seed.sh0000755000175000017500000000163011640407354017756 0ustar locallocal#!/bin/bash ./ref/debug/async_unittest ./ref/debug/checksum_unittest ./ref/debug/getifaddrs_unittest ./ref/debug/getnodeaddr_unittest ./ref/debug/gsi_unittest ./ref/debug/http_unittest ./ref/debug/if_unittest ./ref/debug/indextoaddr_unittest ./ref/debug/inet_network_unittest ./ref/debug/md5_unittest ./ref/debug/net_unittest ./ref/debug/packet_unittest ./ref/debug/pgmMIB_unittest ./ref/debug/pgm_unittest ./ref/debug/rate_control_unittest ./ref/debug/receiver_unittest ./ref/debug/recv_unittest ./ref/debug/reed_solomon_unittest ./ref/debug/rxwi_unittest ./ref/debug/signal_unittest ./ref/debug/snmp_unittest ./ref/debug/source_unittest ./ref/debug/timer_unittest ./ref/debug/time_unittest user=`id -nu` group=`id -ng` sudo execcap 'cap_net_raw=ep' /sbin/sucap $user $group ./ref/debug/transport_unittest sudo find ref/debug/ -user 0 -exec chown $user:$group {} \; ./ref/debug/tsi_unittest ./ref/debug/txwi_unittest libpgm-5.1.118-1~dfsg/openpgm/pgm/time.c0000644000175000017500000005303611640407354016654 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * high resolution timers. * * NB: RDTSC requires P5 microarchitecture. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include # include #endif #include #include //#define TIME_DEBUG /* globals */ pgm_time_update_func pgm_time_update_now PGM_GNUC_READ_MOSTLY; pgm_time_since_epoch_func pgm_time_since_epoch PGM_GNUC_READ_MOSTLY; /* locals */ #define msecs_to_secs(t) ( (t) / 1000 ) #define usecs_to_secs(t) ( (t) / 1000000UL ) #define nsecs_to_secs(t) ( (t) / 1000000000UL ) #define secs_to_msecs(t) ( (pgm_time_t)(t) * 1000 ) #define secs_to_usecs(t) ( (pgm_time_t)(t) * 1000000UL ) #define secs_to_nsecs(t) ( (pgm_time_t)(t) * 1000000000UL ) #define msecs_to_usecs(t) ( (pgm_time_t)(t) * 1000 ) #define msecs_to_nsecs(t) ( (pgm_time_t)(t) * 1000000UL ) #define usecs_to_msecs(t) ( (t) / 1000 ) #define usecs_to_nsecs(t) ( (pgm_time_t)(t) * 1000 ) #define nsecs_to_msecs(t) ( (t) / 1000000UL ) #define nsecs_to_usecs(t) ( (t) / 1000 ) #define fsecs_to_nsecs(t) ( (t) / 1000000UL ) #define fsecs_to_usecs(t) ( (t) / 1000000000UL ) static volatile uint32_t time_ref_count = 0; static pgm_time_t rel_offset PGM_GNUC_READ_MOSTLY = 0; #ifdef _WIN32 static UINT wTimerRes = 0; #endif static void pgm_time_conv (const pgm_time_t*const restrict, time_t*restrict); static void pgm_time_conv_from_reset (const pgm_time_t*const restrict, time_t*restrict); #if defined(CONFIG_HAVE_CLOCK_GETTIME) # include static pgm_time_t pgm_clock_update (void); #endif #ifdef CONFIG_HAVE_FTIME # include static pgm_time_t pgm_ftime_update (void); #endif #ifdef CONFIG_HAVE_GETTIMEOFDAY # include static pgm_time_t pgm_gettimeofday_update (void); #endif #ifdef CONFIG_HAVE_HPET # include # include # include # include # include # define HPET_MMAP_SIZE 0x400 # define HPET_GENERAL_CAPS_REGISTER 0x00 # define HPET_COUNTER_CLK_PERIOD 0x004 # define HPET_MAIN_COUNTER_REGISTER 0x0f0 # define HPET_COUNT_SIZE_CAP (1 << 13) /* HPET counter size maybe 64-bit or 32-bit */ # if defined(__x86_64__) typedef uint64_t hpet_counter_t; # else typedef uint32_t hpet_counter_t; # endif static int hpet_fd PGM_GNUC_READ_MOSTLY = -1; static char* hpet_ptr PGM_GNUC_READ_MOSTLY; static uint64_t hpet_offset = 0; static uint64_t hpet_wrap PGM_GNUC_READ_MOSTLY; static hpet_counter_t hpet_last = 0; # define HPET_NS_SCALE 22 # define HPET_US_SCALE 34 static uint_fast32_t hpet_ns_mul PGM_GNUC_READ_MOSTLY = 0; static uint_fast32_t hpet_us_mul PGM_GNUC_READ_MOSTLY = 0; static inline void set_hpet_mul ( const uint32_t hpet_period ) { hpet_ns_mul = fsecs_to_nsecs((uint64_t)hpet_period << HPET_NS_SCALE); hpet_us_mul = fsecs_to_usecs((uint64_t)hpet_period << HPET_US_SCALE); } static inline uint64_t hpet_to_ns ( const uint64_t hpet ) { return (hpet * hpet_ns_mul) >> HPET_NS_SCALE; } static inline uint64_t hpet_to_us ( const uint64_t hpet ) { return (hpet * hpet_us_mul) >> HPET_US_SCALE; } static bool pgm_hpet_init (pgm_error_t**); static bool pgm_hpet_shutdown (void); static pgm_time_t pgm_hpet_update (void); #endif #ifdef CONFIG_HAVE_RTC # include # include # include # include # include # include static int rtc_fd PGM_GNUC_READ_MOSTLY = -1; static int rtc_frequency PGM_GNUC_READ_MOSTLY = 8192; static pgm_time_t rtc_count = 0; static bool pgm_rtc_init (pgm_error_t**); static bool pgm_rtc_shutdown (void); static pgm_time_t pgm_rtc_update (void); #endif #ifdef CONFIG_HAVE_TSC # include # include # if defined(__APPLE__) || defined(__FreeBSD__) # include # elif defined(__sun) # include # endif # define TSC_NS_SCALE 10 /* 2^10, carefully chosen */ # define TSC_US_SCALE 20 static uint_fast32_t tsc_mhz PGM_GNUC_READ_MOSTLY = 0; static uint_fast32_t tsc_ns_mul PGM_GNUC_READ_MOSTLY = 0; static uint_fast32_t tsc_us_mul PGM_GNUC_READ_MOSTLY = 0; static inline void set_tsc_mul ( const unsigned khz ) { tsc_ns_mul = (1000000 << TSC_NS_SCALE) / khz; tsc_us_mul = (1000 << TSC_US_SCALE) / khz; } static inline uint64_t tsc_to_ns ( const uint64_t tsc ) { return (tsc * tsc_ns_mul) >> TSC_NS_SCALE; } static inline uint64_t ns_to_tsc ( const uint64_t ns ) { return (ns << TSC_NS_SCALE) / tsc_ns_mul; } static inline uint64_t tsc_to_us ( const uint64_t tsc ) { return (tsc * tsc_us_mul) >> TSC_US_SCALE; } static inline uint64_t us_to_tsc ( const uint64_t us ) { return (us << TSC_US_SCALE) / tsc_us_mul; } # ifndef _WIN32 static bool pgm_tsc_init (pgm_error_t**); # endif static pgm_time_t pgm_tsc_update (void); #endif /* initialize time system. * * returns TRUE on success, returns FALSE on error such as being unable to open * the RTC device, an unstable TSC, or system already initialized. */ PGM_GNUC_INTERNAL bool pgm_time_init ( #ifndef _WIN32 pgm_error_t** error #else PGM_GNUC_UNUSED pgm_error_t** error #endif ) { char *pgm_timer; size_t envlen; errno_t err; if (pgm_atomic_exchange_and_add32 (&time_ref_count, 1) > 0) return TRUE; /* current time */ err = pgm_dupenv_s (&pgm_timer, &envlen, "PGM_TIMER"); if (0 != err || 0 == envlen) { pgm_timer = pgm_strdup ( #ifdef CONFIG_HAVE_TSC "TSC" #else "GTOD" #endif ); } pgm_time_since_epoch = pgm_time_conv; switch (pgm_timer[0]) { #ifdef CONFIG_HAVE_FTIME case 'F': pgm_minor (_("Using ftime() timer.")); pgm_time_update_now = pgm_ftime_update; break; #endif #ifdef CONFIG_HAVE_CLOCK_GETTIME case 'C': pgm_minor (_("Using clock_gettime() timer.")); pgm_time_update_now = pgm_clock_update; break; #endif #ifdef CONFIG_HAVE_RTC case 'R': pgm_minor (_("Using /dev/rtc timer.")); pgm_time_update_now = pgm_rtc_update; pgm_time_since_epoch = pgm_time_conv_from_reset; break; #endif #ifdef CONFIG_HAVE_TSC # ifdef _WIN32 default: # endif case 'T': pgm_minor (_("Using TSC timer.")); pgm_time_update_now = pgm_tsc_update; pgm_time_since_epoch = pgm_time_conv_from_reset; break; #endif #ifdef CONFIG_HAVE_HPET case 'H': pgm_minor (_("Using HPET timer.")); pgm_time_update_now = pgm_hpet_update; pgm_time_since_epoch = pgm_time_conv_from_reset; break; #endif #ifdef CONFIG_HAVE_GETTIMEOFDAY # ifndef _WIN32 default: # endif case 'G': pgm_minor (_("Using gettimeofday() timer.")); pgm_time_update_now = pgm_gettimeofday_update; break; #endif } /* clean environment copy */ pgm_free (pgm_timer); #ifdef CONFIG_HAVE_RTC if (pgm_time_update_now == pgm_rtc_update) { pgm_error_t* sub_error = NULL; if (!pgm_rtc_init (&sub_error)) { pgm_propagate_error (error, sub_error); goto err_cleanup; } } #endif #ifdef CONFIG_HAVE_TSC if (pgm_time_update_now == pgm_tsc_update) { char *rdtsc_frequency; #ifdef CONFIG_HAVE_PROC /* attempt to parse clock ticks from kernel */ FILE *fp = fopen ("/proc/cpuinfo", "r"); if (fp) { char buffer[1024]; while (!feof(fp) && fgets (buffer, sizeof(buffer), fp)) { if (strstr (buffer, "cpu MHz")) { const char *p = strchr (buffer, ':'); if (p) tsc_mhz = atoi (p + 1) * 1000; break; } } fclose (fp); } #elif defined(_WIN32) /* iff reading TSC we could use HKLM/Hardware/Description/System/CentralProcessor/0/~Mhz * * MSDN statement: The frequency cannot change while the system is running. * http://msdn.microsoft.com/en-us/library/ms644905(v=vs.85).aspx */ LARGE_INTEGER frequency; if (QueryPerformanceFrequency (&frequency)) { tsc_mhz = (uint_fast32_t)(frequency.QuadPart / 1000); } else { const DWORD save_errno = GetLastError(); char winstr[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_FAILED, _("No supported high-resolution performance counter: %s"), pgm_win_strerror (winstr, sizeof (winstr), save_errno)); } #elif defined(__APPLE__) /* nb: RDTSC is non-functional on Darwin */ uint64_t cpufrequency; size_t len; len = sizeof (cpufrequency); if (0 == sysctlbyname ("hw.cpufrequency", &cpufrequency, &len, NULL, 0)) { tsc_mhz = (uint_fast32_t)(cpufrequency / 1000); } #elif defined(__FreeBSD__) unsigned long clockrate; size_t len; len = sizeof (clockrate); if (0 == sysctlbyname ("hw.clockrate", &clockrate, &len, NULL, 0)) { tsc_mhz = (uint_fast32_t)(clockrate * 1000); } #elif defined(KSTAT_DATA_INT32) /* ref: http://developers.sun.com/solaris/articles/kstatc.html */ kstat_ctl_t* kc; kstat_t* ksp; kstat_named_t* kdata; if (NULL != (kc = kstat_open()) && NULL != (ksp = kstat_lookup (kc, "cpu_info", -1, NULL)) && KSTAT_TYPE_NAMED == ksp->ks_type && -1 != kstat_read (kc, ksp, NULL) && NULL != (kdata = kstat_data_lookup (ksp, "clock_MHz")) && KSTAT_DATA_INT32 == kdata->data_type) { tsc_mhz = (uint_fast32_t)(kdata->value.i32 * 1000); kstat_close (kc); } #endif /* !_WIN32 */ /* e.g. export RDTSC_FREQUENCY=3200.000000 * * Value can be used to override kernel tick rate as well as internal calibration */ err = pgm_dupenv_s (&rdtsc_frequency, &envlen, "RDTSC_FREQUENCY"); if (0 == err && envlen > 0) { tsc_mhz = atoi (rdtsc_frequency) * 1000; pgm_free (rdtsc_frequency); } #ifndef _WIN32 /* calibrate */ if (0 >= tsc_mhz) { pgm_error_t* sub_error = NULL; if (!pgm_tsc_init (&sub_error)) { pgm_propagate_error (error, sub_error); goto err_cleanup; } } #endif pgm_minor (_("TSC frequency set to %u MHz"), (unsigned)(tsc_mhz / 1000)); set_tsc_mul (tsc_mhz); } #endif /* CONFIG_HAVE_TSC */ #ifdef CONFIG_HAVE_HPET if (pgm_time_update_now == pgm_hpet_update) { pgm_error_t* sub_error = NULL; if (!pgm_hpet_init (&sub_error)) { pgm_propagate_error (error, sub_error); goto err_cleanup; } } #endif pgm_time_update_now(); /* calculate relative time offset */ #if defined(CONFIG_HAVE_RTC) || defined(CONFIG_HAVE_TSC) if ( 0 # ifdef CONFIG_HAVE_RTC || pgm_time_update_now == pgm_rtc_update # endif # ifdef CONFIG_HAVE_TSC || pgm_time_update_now == pgm_tsc_update # endif ) { # if defined( CONFIG_HAVE_GETTIMEOFDAY ) rel_offset = pgm_gettimeofday_update() - pgm_time_update_now(); # elif defined( CONFIG_HAVE_FTIME ) rel_offset = pgm_ftime_update() - pgm_time_update_now(); # else # error "gettimeofday() or ftime() required to calculate counter offset" # endif } #else rel_offset = 0; #endif /* update Windows timer resolution to 1ms */ #ifdef _WIN32 TIMECAPS tc; if (TIMERR_NOERROR == timeGetDevCaps (&tc, sizeof (TIMECAPS))) { wTimerRes = min (max (tc.wPeriodMin, 1 /* ms */), tc.wPeriodMax); timeBeginPeriod (wTimerRes); pgm_debug ("Set timer resolution to %ums.", wTimerRes); } else { pgm_warn (_("Unable to determine timer device resolution.")); } #endif return TRUE; #if defined(CONFIG_HAVE_RTC) || (defined(CONFIG_HAVE_TSC) && !defined(_WIN32)) || defined(CONFIG_HAVE_HPET) err_cleanup: pgm_atomic_dec32 (&time_ref_count); return FALSE; #endif #if !defined(CONFIG_HAVE_RTC) && !defined(CONFIG_HAVE_TSC) && !defined(CONFIG_HAVE_HPET) /* unused parameters */ (void)error; #endif } /* returns TRUE if shutdown succeeded, returns FALSE on error. */ PGM_GNUC_INTERNAL bool pgm_time_shutdown (void) { bool retval = TRUE; pgm_return_val_if_fail (pgm_atomic_read32 (&time_ref_count) > 0, FALSE); if (pgm_atomic_exchange_and_add32 (&time_ref_count, (uint32_t)-1) != 1) return retval; #ifdef _WIN32 timeEndPeriod (wTimerRes); #endif #ifdef CONFIG_HAVE_RTC if (pgm_time_update_now == pgm_rtc_update) retval = pgm_rtc_shutdown (); #endif #ifdef CONFIG_HAVE_HPET if (pgm_time_update_now == pgm_hpet_update) retval = pgm_hpet_shutdown (); #endif return retval; } #ifdef CONFIG_HAVE_GETTIMEOFDAY static pgm_time_t pgm_gettimeofday_update (void) { struct timeval gettimeofday_now; pgm_time_t now; static pgm_time_t last = 0; gettimeofday (&gettimeofday_now, NULL); now = secs_to_usecs (gettimeofday_now.tv_sec) + gettimeofday_now.tv_usec; if (PGM_UNLIKELY(now < last)) return last; else return last = now; } #endif /* CONFIG_HAVE_GETTIMEOFDAY */ #ifdef CONFIG_HAVE_CLOCK_GETTIME static pgm_time_t pgm_clock_update (void) { struct timespec clock_now; pgm_time_t now; static pgm_time_t last = 0; clock_gettime (CLOCK_MONOTONIC, &clock_now); now = secs_to_usecs (clock_now.tv_sec) + nsecs_to_usecs (clock_now.tv_nsec); if (PGM_UNLIKELY(now < last)) return last; else return last = now; } #endif /* CONFIG_HAVE_CLOCK_GETTIME */ #ifdef CONFIG_HAVE_FTIME static pgm_time_t pgm_ftime_update (void) { #ifndef _WIN32 struct timeb ftime_now; #elif !defined( _MSC_VER ) struct _timeb ftime_now; #else struct __timeb64 ftime_now; #endif pgm_time_t now; static pgm_time_t last = 0; pgm_ftime_s (&ftime_now); now = secs_to_usecs (ftime_now.time) + msecs_to_usecs (ftime_now.millitm); if (PGM_UNLIKELY(now < last)) return last; else return last = now; } #endif /* CONFIG_HAVE_FTIME */ #ifdef CONFIG_HAVE_RTC /* Old PC/AT-Compatible driver: /dev/rtc * * Not so speedy 8192 Hz timer, thats 122us resolution. * * WARNING: time is relative to start of timer. * WARNING: only one process is allowed to access the RTC. */ static bool pgm_rtc_init ( pgm_error_t** error ) { pgm_return_val_if_fail (rtc_fd == -1, FALSE); rtc_fd = open ("/dev/rtc", O_RDONLY); if (-1 == rtc_fd) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_FAILED, _("Cannot open /dev/rtc for reading: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); return FALSE; } if (-1 == ioctl (rtc_fd, RTC_IRQP_SET, rtc_frequency)) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_FAILED, _("Cannot set RTC frequency to %i Hz: %s"), rtc_frequency, pgm_strerror_s (errbuf, sizeof (errbuf), errno)); return FALSE; } if (-1 == ioctl (rtc_fd, RTC_PIE_ON, 0)) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_FAILED, _("Cannot enable periodic interrupt (PIE) on RTC: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); return FALSE; } return TRUE; } /* returns TRUE on success even if RTC device cannot be closed or had an IO error, * returns FALSE if the RTC file descriptor is not set. */ static bool pgm_rtc_shutdown (void) { pgm_return_val_if_fail (rtc_fd, FALSE); pgm_warn_if_fail (0 == close (rtc_fd)); rtc_fd = -1; return TRUE; } /* RTC only indicates passed ticks therefore is by definition monotonic, we do not * need to check the difference with respect to the last value. */ static pgm_time_t pgm_rtc_update (void) { uint32_t data; /* returned value contains interrupt type and count of interrupts since last read */ pgm_warn_if_fail (sizeof(data) == read (rtc_fd, &data, sizeof(data))); rtc_count += data >> 8; return rtc_count * 1000000UL / rtc_frequency; } #endif /* CONFIG_HAVE_RTC */ #ifdef CONFIG_HAVE_TSC /* read time stamp counter (TSC), count of ticks from processor reset. * * NB: On Windows this will usually be HPET or PIC timer interpolated with TSC. */ static inline pgm_time_t rdtsc (void) { # ifndef _WIN32 uint32_t lo, hi; /* We cannot use "=A", since this would use %rax on x86_64 */ __asm volatile ("rdtsc" : "=a" (lo), "=d" (hi)); return (pgm_time_t)hi << 32 | lo; # else LARGE_INTEGER counter; QueryPerformanceCounter (&counter); return (pgm_time_t)counter.QuadPart; # endif } # ifndef _WIN32 /* determine ratio of ticks to nano-seconds, use /dev/rtc for high accuracy * millisecond timer and convert. * * WARNING: time is relative to start of timer. */ static bool pgm_tsc_init ( PGM_GNUC_UNUSED pgm_error_t** error ) { # ifdef CONFIG_HAVE_PROC /* Test for constant TSC from kernel */ FILE *fp = fopen ("/proc/cpuinfo", "r"); char buffer[1024], *flags = NULL; if (fp) { while (!feof(fp) && fgets (buffer, sizeof(buffer), fp)) { if (strstr (buffer, "flags")) { flags = strchr (buffer, ':'); break; } } fclose (fp); } if (!flags || !strstr (flags, " tsc")) { pgm_warn (_("Linux kernel reports no Time Stamp Counter (TSC).")); /* force both to stable clocks even though one might be OK */ pgm_time_update_now = pgm_gettimeofday_update; return TRUE; } if (!strstr (flags, " constant_tsc")) { pgm_warn (_("Linux kernel reports non-constant Time Stamp Counter (TSC).")); /* force both to stable clocks even though one might be OK */ pgm_time_update_now = pgm_gettimeofday_update; return TRUE; } # endif /* CONFIG_HAVE_PROC */ pgm_time_t start, stop, elapsed; const pgm_time_t calibration_usec = secs_to_usecs (4); struct timespec req = { .tv_sec = 4, .tv_nsec = 0 }; pgm_info (_("Running a benchmark to measure system clock frequency...")); start = rdtsc(); while (-1 == nanosleep (&req, &req) && EINTR == errno); stop = rdtsc(); if (stop < start) { pgm_warn (_("Finished RDTSC test. Unstable TSC detected. The benchmark resulted in a " "non-monotonic time response rendering the TSC unsuitable for high resolution " "timing. To prevent the start delay from this benchmark and use a stable clock " "source set the environment variable PGM_TIMER to GTOD.")); /* force both to stable clocks even though one might be OK */ pgm_time_update_now = pgm_gettimeofday_update; return TRUE; } /* TODO: this math needs to be scaled to reduce rounding errors */ elapsed = stop - start; if (elapsed > calibration_usec) { /* cpu > 1 Ghz */ tsc_mhz = (elapsed * 1000) / calibration_usec; } else { /* cpu < 1 Ghz */ tsc_mhz = -( (calibration_usec * 1000) / elapsed ); } pgm_info (_("Finished RDTSC test. To prevent the startup delay from this benchmark, " "set the environment variable RDTSC_FREQUENCY to %" PRIuFAST32 " on this " "system. This value is dependent upon the CPU clock speed and " "architecture and should be determined separately for each server."), tsc_mhz / 1000); return TRUE; } # endif /* TSC is monotonic on the same core but we do neither force the same core or save the count * for each core as if the counter is unstable system wide another timing mechanism should be * used, preferably HPET on x86/AMD64 or gettimeofday() on SPARC. */ static pgm_time_t pgm_tsc_update (void) { static pgm_time_t last = 0; const pgm_time_t now = tsc_to_us (rdtsc()); if (PGM_UNLIKELY(now < last)) return last; else return last = now; } #endif #ifdef CONFIG_HAVE_HPET /* High Precision Event Timer (HPET) created as a system wide stable high resolution timer * to replace dependency on core specific counters (TSC). * * NB: Only available on x86/AMD64 hardware post 2007 */ static bool pgm_hpet_init ( pgm_error_t** error ) { pgm_return_val_if_fail (hpet_fd == -1, FALSE); hpet_fd = open("/dev/hpet", O_RDONLY); if (hpet_fd < 0) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_FAILED, _("Cannot open /dev/hpet for reading: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); return FALSE; } hpet_ptr = mmap(NULL, HPET_MMAP_SIZE, PROT_READ, MAP_SHARED, hpet_fd, 0); if (MAP_FAILED == hpet_ptr) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_TIME, PGM_ERROR_FAILED, _("Error mapping HPET device: %s"), pgm_strerror_s (errbuf, sizeof (errbuf), errno)); close (hpet_fd); hpet_fd = -1; return FALSE; } /* HPET counter tick period is in femto-seconds, a value of 0 is not permitted, * the value must be <= 0x05f5e100 or 100ns. */ const uint32_t hpet_period = *((uint32_t*)(hpet_ptr + HPET_COUNTER_CLK_PERIOD)); set_hpet_mul (hpet_period); #if defined( __x86_64__ ) || defined( __amd64 ) const uint32_t hpet_caps = *((uint32_t*)(hpet_ptr + HPET_GENERAL_CAPS_REGISTER)); hpet_wrap = hpet_caps & HPET_COUNT_SIZE_CAP ? 0 : (1ULL << 32); #else hpet_wrap = 1ULL << 32; #endif return TRUE; } static bool pgm_hpet_shutdown (void) { pgm_return_val_if_fail (hpet_fd, FALSE); pgm_warn_if_fail (0 == close (hpet_fd)); hpet_fd = -1; return TRUE; } static pgm_time_t pgm_hpet_update (void) { const hpet_counter_t hpet_count = *((hpet_counter_t*)(hpet_ptr + HPET_MAIN_COUNTER_REGISTER)); /* 32-bit HPET counters wrap after ~4 minutes */ if (PGM_UNLIKELY(hpet_count < hpet_last)) hpet_offset += hpet_wrap; hpet_last = hpet_count; return hpet_to_us (hpet_offset + hpet_count); } #endif /* CONFIG_HAVE_HPET */ /* convert from pgm_time_t to time_t with pgm_time_t in microseconds since the epoch. */ static void pgm_time_conv ( const pgm_time_t* const restrict pgm_time_t_time, time_t* restrict time_t_time ) { *time_t_time = pgm_to_secs (*pgm_time_t_time); } /* convert from pgm_time_t to time_t with pgm_time_t in microseconds since the core started. */ static void pgm_time_conv_from_reset ( const pgm_time_t* const restrict pgm_time_t_time, time_t* restrict time_t_time ) { *time_t_time = pgm_to_secs (*pgm_time_t_time + rel_offset); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/nametoindex.c0000644000175000017500000001421311640407354020223 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * Windows interface name to interface index function. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef _WIN32 # include # include #endif #include #include //#define NAMETOINDEX_DEBUG #define MAX_TRIES 3 #define DEFAULT_BUFFER_SIZE 4096 #ifdef _WIN32 static inline void* _pgm_heap_alloc ( const size_t n_bytes ) { # ifdef CONFIG_USE_HEAPALLOC return HeapAlloc (GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, n_bytes); # else return pgm_malloc (n_bytes); # endif } static inline void _pgm_heap_free ( void* mem ) { # ifdef CONFIG_USE_HEAPALLOC HeapFree (GetProcessHeap(), 0, mem); # else pgm_free (mem); # endif } /* Retrieve adapter index via name. * Wine edition: First try GetAdapterIndex() then fallback to enumerating * adapters via GetAdaptersInfo(). * * On error returns zero, no errors are defined. */ static unsigned /* type matching if_nametoindex() */ _pgm_getadaptersinfo_nametoindex ( const sa_family_t iffamily, const char* ifname ) { pgm_return_val_if_fail (NULL != ifname, 0); pgm_assert (AF_INET6 != iffamily); DWORD dwRet, ifIndex; ULONG ulOutBufLen = DEFAULT_BUFFER_SIZE; PIP_ADAPTER_INFO pAdapterInfo = NULL; PIP_ADAPTER_INFO pAdapter = NULL; /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ for (unsigned i = MAX_TRIES; i; i--) { pgm_debug ("IP_ADAPTER_INFO buffer length %lu bytes.", ulOutBufLen); pAdapterInfo = (IP_ADAPTER_INFO*)_pgm_heap_alloc (ulOutBufLen); dwRet = GetAdaptersInfo (pAdapterInfo, &ulOutBufLen); if (ERROR_BUFFER_OVERFLOW == dwRet) { _pgm_heap_free (pAdapterInfo); pAdapterInfo = NULL; } else { break; } } switch (dwRet) { case ERROR_SUCCESS: /* NO_ERROR */ break; case ERROR_BUFFER_OVERFLOW: pgm_warn (_("GetAdaptersInfo repeatedly failed with ERROR_BUFFER_OVERFLOW.")); if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); return 0; default: pgm_warn (_("GetAdaptersInfo failed")); if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); return 0; } for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { for (IP_ADDR_STRING *pIPAddr = &pAdapter->IpAddressList; pIPAddr; pIPAddr = pIPAddr->Next) { /* skip null adapters */ if (strlen (pIPAddr->IpAddress.String) == 0) continue; if (0 == strncmp (ifname, pAdapter->AdapterName, IF_NAMESIZE)) { ifIndex = pAdapter->Index; _pgm_heap_free (pAdapterInfo); return ifIndex; } } } if (pAdapterInfo) _pgm_heap_free (pAdapterInfo); return 0; } /* Retrieve adapter index via name. * Windows edition: First try GetAdapterIndex() then fallback to enumerating * adapters via GetAdaptersAddresses(). * * On error returns zero, no errors are defined. */ static unsigned /* type matching if_nametoindex() */ _pgm_getadaptersaddresses_nametoindex ( const sa_family_t iffamily, const char* ifname ) { pgm_return_val_if_fail (NULL != ifname, 0); ULONG ifIndex; DWORD dwSize = DEFAULT_BUFFER_SIZE, dwRet; IP_ADAPTER_ADDRESSES *pAdapterAddresses = NULL, *adapter; char szAdapterName[IF_NAMESIZE]; /* first see if GetAdapterIndex is working, */ pgm_strncpy_s (szAdapterName, sizeof (szAdapterName), ifname, _TRUNCATE); dwRet = GetAdapterIndex ((LPWSTR)szAdapterName, &ifIndex); if (NO_ERROR == dwRet) return ifIndex; /* fallback to finding index via iterating adapter list */ /* loop to handle interfaces coming online causing a buffer overflow * between first call to list buffer length and second call to enumerate. */ for (unsigned i = MAX_TRIES; i; i--) { pAdapterAddresses = (IP_ADAPTER_ADDRESSES*)_pgm_heap_alloc (dwSize); dwRet = GetAdaptersAddresses (AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_MULTICAST, NULL, pAdapterAddresses, &dwSize); if (ERROR_BUFFER_OVERFLOW == dwRet) { _pgm_heap_free (pAdapterAddresses); pAdapterAddresses = NULL; } else { break; } } switch (dwRet) { case ERROR_SUCCESS: break; case ERROR_BUFFER_OVERFLOW: pgm_warn (_("GetAdaptersAddresses repeatedly failed with ERROR_BUFFER_OVERFLOW")); if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); return 0; default: pgm_warn (_("GetAdaptersAddresses failed")); if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); return 0; } for (adapter = pAdapterAddresses; adapter; adapter = adapter->Next) { if (0 == strcmp (szAdapterName, adapter->AdapterName)) { ifIndex = AF_INET6 == iffamily ? adapter->Ipv6IfIndex : adapter->IfIndex; _pgm_heap_free (pAdapterAddresses); return ifIndex; } } if (pAdapterAddresses) _pgm_heap_free (pAdapterAddresses); return 0; } #endif /* _WIN32 */ /* Retrieve interface index for a specified adapter name. * On error returns zero, no errors are defined. */ PGM_GNUC_INTERNAL unsigned /* type matching if_nametoindex() */ pgm_if_nametoindex ( #ifndef _WIN32 PGM_GNUC_UNUSED const sa_family_t iffamily, #else const sa_family_t iffamily, #endif const char* ifname ) { pgm_return_val_if_fail (NULL != ifname, 0); #ifndef _WIN32 return if_nametoindex (ifname); #elif defined(CONFIG_TARGET_WINE) return _pgm_getadaptersinfo_nametoindex (iffamily, ifname); #else return _pgm_getadaptersaddresses_nametoindex (iffamily, ifname); #endif } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/rate_control_unittest.c0000644000175000017500000005470411640407354022353 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for rate regulation. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ #define pgm_time_now mock_pgm_time_now #define pgm_time_update_now mock_pgm_time_update_now #define RATE_CONTROL_DEBUG #include "rate_control.c" static pgm_time_t mock_pgm_time_now = 0x1; static pgm_time_t _mock_pgm_time_update_now (void); pgm_time_update_func mock_pgm_time_update_now = _mock_pgm_time_update_now; /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } static pgm_time_t _mock_pgm_time_update_now (void) { g_debug ("mock_pgm_time_now: %" PGM_TIME_FORMAT, mock_pgm_time_now); return mock_pgm_time_now; } /* target: * void * pgm_rate_create ( * pgm_rate_t* bucket_, * const ssize_t rate_per_sec, * const size_t iphdr_len, * const uint16_t max_tpdu * ) */ START_TEST (test_create_pass_001) { pgm_rate_t rate; memset (&rate, 0, sizeof(rate)); pgm_rate_create (&rate, 100*1000, 10, 1500); } END_TEST START_TEST (test_create_fail_001) { pgm_rate_create (NULL, 0, 0, 1500); fail ("reached"); } END_TEST /* target: * void * pgm_rate_destroy ( * pgm_rate_t* bucket * ) */ START_TEST (test_destroy_pass_001) { pgm_rate_t rate; memset (&rate, 0, sizeof(rate)); pgm_rate_create (&rate, 100*1000, 10, 1500); pgm_rate_destroy (&rate); } END_TEST START_TEST (test_destroy_fail_001) { pgm_rate_destroy (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_rate_check ( * pgm_rate_t* bucket, * const size_t data_size, * const bool is_nonblocking * ) * * 001: should use seconds resolution to allow 2 packets through then fault. */ START_TEST (test_check_pass_001) { pgm_rate_t rate; memset (&rate, 0, sizeof(rate)); pgm_rate_create (&rate, 2*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); pgm_rate_destroy (&rate); } END_TEST START_TEST (test_check_fail_001) { pgm_rate_check (NULL, 1000, FALSE); fail ("reached"); } END_TEST /* 002: assert that only one packet should pass through small bucket */ START_TEST (test_check_pass_002) { pgm_rate_t rate; memset (&rate, 0, sizeof(rate)); pgm_rate_create (&rate, 2*900, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); pgm_rate_destroy (&rate); } END_TEST /* 003: millisecond resolution should initiate millisecond fills. */ START_TEST (test_check_pass_003) { pgm_rate_t rate; memset (&rate, 0, sizeof(rate)); pgm_rate_create (&rate, 2*1010*1000, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); /* duplicate check at same time point */ fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); /* advance time causing a millisecond fill to occur */ mock_pgm_time_now += pgm_msecs(1); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); /* advance time to fill bucket enough for only one packet */ mock_pgm_time_now += pgm_usecs(500); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); /* advance time to fill the bucket a little but not enough for one packet */ mock_pgm_time_now += pgm_usecs(100); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); /* advance time a lot, should be limited to millisecond fill rate */ mock_pgm_time_now += pgm_secs(10); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (TRUE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); fail_unless (FALSE == pgm_rate_check (&rate, 1000, TRUE), "rate_check failed"); pgm_rate_destroy (&rate); } END_TEST /* target: * bool * pgm_rate_check2 ( * pgm_rate_t* major_bucket, * pgm_rate_t* minor_bucket, * const size_t data_size, * const bool is_nonblocking * ) * * 001: should use seconds resolution to allow 2 packets through then fault. */ START_TEST (test_check2_pass_001) { pgm_rate_t major, minor; /* major-only */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major#1 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major#2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major#3 failed"); pgm_rate_destroy (&major); /* minor-only */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&minor, 2*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); pgm_rate_destroy (&minor); /* major with large minor */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*1010, 10, 1500); pgm_rate_create (&minor, 999*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); /* minor with large major */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 999*1010, 10, 1500); pgm_rate_create (&minor, 2*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); /* major and minor */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*1010, 10, 1500); pgm_rate_create (&minor, 2*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); } END_TEST START_TEST (test_check2_fail_001) { pgm_rate_check2 (NULL, NULL, 1000, FALSE); fail ("reached"); } END_TEST /* 002: assert that only one packet should pass through small bucket */ START_TEST (test_check2_pass_002) { pgm_rate_t major, minor; /** major-only **/ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*900, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); pgm_rate_destroy (&major); /* minor-only */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&minor, 2*900, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); pgm_rate_destroy (&minor); /* major with large minor */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*900, 10, 1500); pgm_rate_create (&minor, 999*1010, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); /* minor with large major */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 999*1010, 10, 1500); pgm_rate_create (&minor, 2*900, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); /* major and minor */ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*900, 10, 1500); pgm_rate_create (&minor, 2*900, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); } END_TEST /* 003: millisecond resolution should initiate millisecond fills. */ START_TEST (test_check2_pass_003) { pgm_rate_t major, minor; /** major-only **/ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*1010*1000, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); /* duplicate check at same time point */ fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); /* advance time causing a millisecond fill to occur */ mock_pgm_time_now += pgm_msecs(1); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); /* advance time to fill bucket enough for only one packet */ mock_pgm_time_now += pgm_usecs(500); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); /* advance time to fill the bucket a little but not enough for one packet */ mock_pgm_time_now += pgm_usecs(100); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); /* advance time a lot, should be limited to millisecond fill rate */ mock_pgm_time_now += pgm_secs(10); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:major failed"); pgm_rate_destroy (&major); /** minor-only **/ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&minor, 2*1010*1000, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); /* duplicate check at same time point */ fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); /* advance time causing a millisecond fill to occur */ mock_pgm_time_now += pgm_msecs(1); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); /* advance time to fill bucket enough for only one packet */ mock_pgm_time_now += pgm_usecs(500); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); /* advance time to fill the bucket a little but not enough for one packet */ mock_pgm_time_now += pgm_usecs(100); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); /* advance time a lot, should be limited to millisecond fill rate */ mock_pgm_time_now += pgm_secs(10); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:minor failed"); pgm_rate_destroy (&minor); /** major with large minor **/ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*1010*1000, 10, 1500); pgm_rate_create (&minor, 999*1010*1000, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); /* duplicate check at same time point */ fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); /* advance time causing a millisecond fill to occur */ mock_pgm_time_now += pgm_msecs(1); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); /* advance time to fill bucket enough for only one packet */ mock_pgm_time_now += pgm_usecs(500); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); /* advance time to fill the bucket a little but not enough for one packet */ mock_pgm_time_now += pgm_usecs(100); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); /* advance time a lot, should be limited to millisecond fill rate */ mock_pgm_time_now += pgm_secs(10); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1<2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); /** minor with large major **/ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 999*1010*1000, 10, 1500); pgm_rate_create (&minor, 2*1010*1000, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); /* duplicate check at same time point */ fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); /* advance time causing a millisecond fill to occur */ mock_pgm_time_now += pgm_msecs(1); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:>>2 failed"); /* advance time to fill bucket enough for only one packet */ mock_pgm_time_now += pgm_usecs(500); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); /* advance time to fill the bucket a little but not enough for one packet */ mock_pgm_time_now += pgm_usecs(100); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); /* advance time a lot, should be limited to millisecond fill rate */ mock_pgm_time_now += pgm_secs(10); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1>2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); /** major and minor **/ memset (&major, 0, sizeof(major)); memset (&minor, 0, sizeof(minor)); mock_pgm_time_now = 1; pgm_rate_create (&major, 2*1010*1000, 10, 1500); pgm_rate_create (&minor, 2*1010*1000, 10, 1500); mock_pgm_time_now += pgm_secs(2); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); /* duplicate check at same time point */ fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); /* advance time causing a millisecond fill to occur */ mock_pgm_time_now += pgm_msecs(1); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); /* advance time to fill bucket enough for only one packet */ mock_pgm_time_now += pgm_usecs(500); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); /* advance time to fill the bucket a little but not enough for one packet */ mock_pgm_time_now += pgm_usecs(100); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); /* advance time a lot, should be limited to millisecond fill rate */ mock_pgm_time_now += pgm_secs(10); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (TRUE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); fail_unless (FALSE == pgm_rate_check2 (&major, &minor, 1000, TRUE), "rate_check2:1=2 failed"); pgm_rate_destroy (&major); pgm_rate_destroy (&minor); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_create = tcase_create ("create"); suite_add_tcase (s, tc_create); tcase_add_test (tc_create, test_create_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_create, test_create_fail_001, SIGABRT); #endif TCase* tc_destroy = tcase_create ("destroy"); suite_add_tcase (s, tc_destroy); tcase_add_test (tc_destroy, test_destroy_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_destroy, test_destroy_fail_001, SIGABRT); #endif TCase* tc_check = tcase_create ("check"); suite_add_tcase (s, tc_check); tcase_add_test (tc_check, test_check_pass_001); tcase_add_test (tc_check, test_check_pass_002); tcase_add_test (tc_check, test_check_pass_003); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_check, test_check_fail_001, SIGABRT); #endif TCase* tc_check2 = tcase_create ("check2"); suite_add_tcase (s, tc_check2); tcase_add_test (tc_check2, test_check2_pass_001); tcase_add_test (tc_check2, test_check2_pass_002); tcase_add_test (tc_check2, test_check2_pass_003); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_check2, test_check2_fail_001, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/gsi.c.c89.patch0000644000175000017500000000241511640407354020173 0ustar locallocal--- gsi.c 2011-01-31 10:04:55.000000000 +0800 +++ gsi.c89.c 2011-02-08 23:22:43.000000000 +0800 @@ -54,12 +54,14 @@ memcpy (gsi, g_checksum_get_string (checksum) + 10, 6); g_checksum_free (checksum); #else + { struct pgm_md5_t ctx; char resblock[16]; pgm_md5_init_ctx (&ctx); pgm_md5_process_bytes (&ctx, data, length); pgm_md5_finish_ctx (&ctx, resblock); memcpy (gsi, resblock + 10, 6); + } #endif return TRUE; } @@ -94,6 +96,7 @@ { pgm_return_val_if_fail (NULL != gsi, FALSE); + { char hostname[NI_MAXHOST]; int retval = gethostname (hostname, sizeof(hostname)); if (0 != retval) { @@ -109,6 +112,7 @@ } return pgm_gsi_create_from_string (gsi, hostname, -1); + } } /* create a global session ID based on the IP address. @@ -127,6 +131,7 @@ pgm_return_val_if_fail (NULL != gsi, FALSE); + { int retval = gethostname (hostname, sizeof(hostname)); if (0 != retval) { const int save_errno = pgm_get_last_sock_error(); @@ -157,8 +162,11 @@ */ memcpy (gsi, &((struct sockaddr_in*)(res->ai_addr))->sin_addr, sizeof(struct in_addr)); freeaddrinfo (res); + { const uint16_t random_val = pgm_random_int_range (0, UINT16_MAX); memcpy ((uint8_t*)gsi + sizeof(struct in_addr), &random_val, sizeof(random_val)); + } + } return TRUE; } libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.097.mingw640000644000175000017500000002446211640407354021415 0ustar locallocal# -*- coding: utf-8 mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 0, 97 ) SConsignFile('scons.signatures'+ '-Win64-' + platform.machine()); opt = Options(None, ARGUMENTS) opt.AddOptions ( (EnumOption ('BUILD', 'build environment', 'debug', ('release', 'debug', 'profile'))), (EnumOption ('BRANCH', 'branch prediction', 'none', ('none', 'profile', 'seed'))), (EnumOption ('WITH_GETTEXT', 'l10n support via libintl', 'false', ('true', 'false'))), (EnumOption ('WITH_GLIB', 'Build GLib dependent modules', 'false', ('true', 'false'))), (EnumOption ('COVERAGE', 'test coverage', 'none', ('none', 'full'))), (EnumOption ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', ('true', 'false'))), (EnumOption ('WITH_HTTP', 'HTTP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_SNMP', 'SNMP administration', 'false', ('true', 'false'))), (EnumOption ('WITH_CHECK', 'Check test system', 'false', ('true', 'false'))), (EnumOption ('WITH_TEST', 'Network test system', 'false', ('true', 'false'))), # C++ broken scope (EnumOption ('WITH_CC', 'C++ examples', 'false', ('true', 'false'))), (EnumOption ('WITH_EXAMPLES', 'Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_NCURSES', 'NCURSES examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', ('true', 'false'))), ) #----------------------------------------------------------------------------- # Dependencies def force_mingw(env): env.PrependENVPath('PATH', '/opt/mingw/bin'); env.Tool('crossmingw64', toolpath=['.']); env = Environment(); force_mingw(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('PKG_CONFIG_PATH=win64/lib/pkgconfig pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('PKG_CONFIG_PATH=win64/lib/pkgconfig pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment(ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', '-std=gnu99', # ¡C89, not C99! # '-std=gnu89', '-D_BSD_SOURCE', '-D_WIN32_WINNT=0x0501', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks # '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only # '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header # '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing # '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # event handling # '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration # '-DCONFIG_HAVE_GETIFADDRS', # '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg '-DCONFIG_HAVE_WSACMSGHDR', # multicast # '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf # '-DCONFIG_HAVE_SPRINTF_GROUPING', # '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE' # GNU getopt # '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ 'iphlpapi.lib', 'ws2_32.lib', 'winmm.lib' ] ) opt.Update (env) force_mingw(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O0','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!PKG_CONFIG_PATH=win64/lib/pkgconfig pkg-config --cflags --libs glib-2.0 gthread-2.0'); env.MergeFlags('-Iwin/include -Lwin64/lib'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp env['SNMP_FLAGS'] = { 'CCFLAGS' : [], 'LIBS' : [ 'netsnmpagent', 'netsnmpmibs', 'netsnmphelpers', 'netsnmp' ], }; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('PKG_CONFIG_PATH=win64/lib/pkgconfig pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!PKG_CONFIG_PATH=win64/lib/pkgconfig pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-Win64-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm89'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript89'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/thread.c.c89.patch0000644000175000017500000000342511640407354020662 0ustar locallocal--- thread.c 2011-03-12 10:32:35.000000000 +0800 +++ thread.c89.c 2011-03-12 11:12:26.000000000 +0800 @@ -140,11 +140,13 @@ #ifdef PTHREAD_MUTEX_ADAPTIVE_NP /* non-portable but define on Linux & FreeBSD, uses spinlock for 200 spins then waits as mutex */ + { pthread_mutexattr_t attr; posix_check_cmd (pthread_mutexattr_init (&attr)); pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP); posix_check_cmd (pthread_mutex_init (&mutex->pthread_mutex, &attr)); pthread_mutexattr_destroy (&attr); + } #elif !defined( _WIN32 ) posix_check_cmd (pthread_mutex_init (&mutex->pthread_mutex, NULL)); #elif defined(CONFIG_HAVE_CRITICAL_SECTION_EX) @@ -282,8 +284,11 @@ WakeAllConditionVariable (&cond->win32_cond); #else EnterCriticalSection (&cond->win32_crit); - for (unsigned i = 0; i < cond->len; i++) + { + unsigned i; + for (i = 0; i < cond->len; i++) SetEvent (cond->phandle[ i ]); + } cond->len = 0; LeaveCriticalSection (&cond->win32_crit); #endif /* !_WIN32 */ @@ -316,6 +321,7 @@ # if defined(CONFIG_HAVE_WIN_COND) SleepConditionVariableCS (&cond->win32_cond, spinlock, INFINITE); # else + { DWORD status; HANDLE event = TlsGetValue (cond_event_tls); @@ -339,7 +345,9 @@ if (WAIT_TIMEOUT == status) { EnterCriticalSection (&cond->win32_crit); - for (unsigned i = 0; i < cond->len; i++) { + { + unsigned i; + for (i = 0; i < cond->len; i++) { if (cond->phandle[ i ] == event) { if (i != cond->len - 1) memmove (&cond->phandle[ i ], &cond->phandle[ i + 1 ], sizeof(HANDLE) * (cond->len - i - 1)); @@ -347,9 +355,11 @@ break; } } + } win32_check_cmd (WAIT_FAILED != (status = WaitForSingleObject (event, 0))); LeaveCriticalSection (&cond->win32_crit); } + } # endif /* !CONFIG_HAVE_WIN_COND */ } #endif /* !_WIN32 */ libpgm-5.1.118-1~dfsg/openpgm/pgm/gsi_unittest.c0000644000175000017500000002344111640407354020434 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for global session ID helper functions. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #ifdef _WIN32 # include # include #endif #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ static char* mock_localhost = "localhost"; static char* mock_invalid = "invalid.invalid"; /* RFC 2606 */ static char* mock_toolong = "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij12345"; /* 65 */ static char* mock_hostname = NULL; static void mock_setup_invalid (void) { mock_hostname = mock_invalid; } static void mock_setup_toolong (void) { mock_hostname = mock_toolong; } static void mock_setup_localhost (void) { mock_hostname = mock_localhost; } static void mock_teardown (void) { mock_hostname = NULL; } /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } int mock_gethostname ( char* name, size_t len ) { if (mock_hostname == mock_toolong) { #ifndef _WIN32 errno = EINVAL; #else WSASetLastError (WSAEFAULT); #endif return -1; } strncpy (name, mock_hostname, len); if (len > 0) name[len - 1] = '\0'; return 0; } #define gethostname mock_gethostname #define GSI_DEBUG #include "gsi.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * bool * pgm_gsi_create_from_hostname ( * pgm_gsi_t* gsi, * pgm_error_t** err * ) */ START_TEST (test_create_from_hostname_pass_001) { pgm_gsi_t gsi; pgm_error_t* err = NULL; fail_unless (pgm_gsi_create_from_hostname (&gsi, &err), "create_from_hostname failed"); fail_if (err, "error raised"); fail_unless (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); } END_TEST START_TEST (test_create_from_hostname_pass_002) { pgm_error_t* err = NULL; fail_if (pgm_gsi_create_from_hostname (NULL, &err), "create_from_hostname failed"); fail_if (err, "error raised"); fail_if (pgm_gsi_create_from_hostname (NULL, NULL), "create_from_hostname failed"); } END_TEST /* hostname too long */ START_TEST (test_create_from_hostname_pass_003) { pgm_gsi_t gsi; pgm_error_t* err = NULL; fail_if (pgm_gsi_create_from_hostname (&gsi, &err), "create_from_hostname failed"); fail_if (NULL == err, "error not raised"); fail_if (NULL == err->message, "no error message"); g_debug ("pgm_error_t: %s", err->message); fail_if (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); } END_TEST /* target: * bool * pgm_gsi_create_from_addr ( * pgm_gsi_t* gsi, * pgm_error_t** err * ) */ START_TEST (test_create_from_addr_pass_001) { pgm_gsi_t gsi; pgm_error_t* err = NULL; fail_unless (pgm_gsi_create_from_addr (&gsi, &err), "create_from_addr failed"); fail_if (err, "error raised"); fail_unless (pgm_gsi_create_from_addr (&gsi, NULL), "create_from_addr failed"); } END_TEST START_TEST (test_create_from_addr_pass_002) { pgm_error_t* err = NULL; fail_if (pgm_gsi_create_from_addr (NULL, &err), "create_from_addr failed"); fail_if (pgm_gsi_create_from_addr (NULL, NULL), "create_from_addr failed"); } END_TEST /* invalid hostname */ START_TEST (test_create_from_addr_pass_003) { pgm_gsi_t gsi; pgm_error_t* err = NULL; fail_if (pgm_gsi_create_from_addr (&gsi, &err), "create_from_addr failed"); fail_if (NULL == err, "error not raised"); fail_if (NULL == err->message, "no error message"); g_debug ("pgm_error_t: %s", err->message); fail_if (pgm_gsi_create_from_addr (&gsi, NULL), "create_from_addr failed"); } END_TEST /* target: * char* * pgm_gsi_print ( * const pgm_gsi_t* gsi * ) */ START_TEST (test_print_pass_001) { pgm_gsi_t gsi; fail_unless (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); fail_if (NULL == pgm_gsi_print (&gsi), "print failed"); } END_TEST START_TEST (test_print_pass_002) { fail_unless (NULL == pgm_gsi_print (NULL), "print failed"); } END_TEST /* target: * int * pgm_gsi_print_r ( * const pgm_gsi_t* gsi, * char* buf, * size_t bufsize * ) */ START_TEST (test_print_r_pass_001) { pgm_gsi_t gsi; char buf[PGM_GSISTRLEN]; fail_unless (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); fail_unless (pgm_gsi_print_r (&gsi, buf, sizeof(buf)) > 0, "print_r failed"); } END_TEST START_TEST (test_print_r_pass_002) { pgm_gsi_t gsi; char buf[PGM_GSISTRLEN]; fail_unless (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); fail_unless (pgm_gsi_print_r (NULL, buf, sizeof(buf)) == -1, "print_r failed"); fail_unless (pgm_gsi_print_r (&gsi, NULL, sizeof(buf)) == -1, "print_r failed"); fail_unless (pgm_gsi_print_r (&gsi, buf, 0) == -1, "print_r failed"); } END_TEST /* target: * bool * pgm_gsi_equal ( * const void* gsi1, * const void* gsi2 * ) */ START_TEST (test_equal_pass_001) { pgm_gsi_t gsi1, gsi2; fail_unless (pgm_gsi_create_from_hostname (&gsi1, NULL), "create_from_hostname failed"); fail_unless (pgm_gsi_create_from_hostname (&gsi2, NULL), "create_from_hostname failed"); fail_unless (pgm_gsi_equal (&gsi1, &gsi2), "equal failed"); } END_TEST START_TEST (test_equal_pass_002) { pgm_gsi_t gsi1, gsi2; fail_unless (pgm_gsi_create_from_hostname (&gsi1, NULL), "create_from_hostname failed"); fail_unless (pgm_gsi_create_from_addr (&gsi2, NULL), "create_from_addr failed"); fail_if (pgm_gsi_equal (&gsi1, &gsi2), "equal failed"); } END_TEST START_TEST (test_equal_fail_001) { pgm_gsi_t gsi; fail_unless (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); gboolean retval = pgm_gsi_equal (NULL, &gsi); fail ("reached"); } END_TEST START_TEST (test_equal_fail_002) { pgm_gsi_t gsi; fail_unless (pgm_gsi_create_from_hostname (&gsi, NULL), "create_from_hostname failed"); gboolean retval = pgm_gsi_equal (&gsi, NULL); fail ("reached"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_create_from_hostname = tcase_create ("create-from-hostname"); suite_add_tcase (s, tc_create_from_hostname); tcase_add_checked_fixture (tc_create_from_hostname, mock_setup_localhost, mock_teardown); tcase_add_test (tc_create_from_hostname, test_create_from_hostname_pass_001); tcase_add_test (tc_create_from_hostname, test_create_from_hostname_pass_002); TCase* tc_create_from_hostname2 = tcase_create ("create-from-hostname/2"); suite_add_tcase (s, tc_create_from_hostname2); tcase_add_checked_fixture (tc_create_from_hostname2, mock_setup_toolong, mock_teardown); tcase_add_test (tc_create_from_hostname2, test_create_from_hostname_pass_003); TCase* tc_create_from_addr = tcase_create ("create-from-addr"); suite_add_tcase (s, tc_create_from_addr); tcase_add_checked_fixture (tc_create_from_addr, mock_setup_localhost, mock_teardown); tcase_add_test (tc_create_from_addr, test_create_from_addr_pass_001); tcase_add_test (tc_create_from_addr, test_create_from_addr_pass_002); TCase* tc_create_from_addr2 = tcase_create ("create-from-addr/2"); suite_add_tcase (s, tc_create_from_addr2); tcase_add_checked_fixture (tc_create_from_addr2, mock_setup_invalid, mock_teardown); tcase_add_test (tc_create_from_addr2, test_create_from_addr_pass_003); TCase* tc_print = tcase_create ("print"); suite_add_tcase (s, tc_print); tcase_add_checked_fixture (tc_print, mock_setup_localhost, mock_teardown); tcase_add_test (tc_print, test_print_pass_001); tcase_add_test (tc_print, test_print_pass_002); TCase* tc_print_r = tcase_create ("print-r"); suite_add_tcase (s, tc_print_r); tcase_add_checked_fixture (tc_print_r, mock_setup_localhost, mock_teardown); tcase_add_test (tc_print_r, test_print_r_pass_001); tcase_add_test (tc_print_r, test_print_r_pass_002); TCase* tc_equal = tcase_create ("equal"); suite_add_tcase (s, tc_equal); tcase_add_checked_fixture (tc_equal, mock_setup_localhost, mock_teardown); tcase_add_test (tc_equal, test_equal_pass_001); tcase_add_test (tc_equal, test_equal_pass_002); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_equal, test_equal_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_equal, test_equal_fail_002, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif /* GSI depends upond PRNG which depends upon time */ g_assert (pgm_time_init(NULL)); pgm_messages_init(); pgm_rand_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_rand_shutdown(); pgm_messages_shutdown(); g_assert (pgm_time_shutdown()); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/Makefile.am0000644000175000017500000000442211640407354017601 0ustar locallocal# -*- Makefile -*- ACLOCAL_AMFLAGS = -I m4 noinst_LTLIBRARIES = libpgm_noinst.la EXTRA_DIST = galois_generator.pl version_generator.py libpgm_noinst_la_SOURCES = \ thread.c \ mem.c \ string.c \ list.c \ slist.c \ queue.c \ hashtable.c \ messages.c \ error.c \ math.c \ packet_parse.c \ packet_test.c \ sockaddr.c \ time.c \ if.c \ getifaddrs.c \ get_nprocs.c \ getnetbyname.c \ getnodeaddr.c \ getprotobyname.c \ indextoaddr.c \ indextoname.c \ nametoindex.c \ inet_network.c \ md5.c \ rand.c \ gsi.c \ tsi.c \ txw.c \ rxw.c \ skbuff.c \ socket.c \ source.c \ receiver.c \ recv.c \ engine.c \ timer.c \ net.c \ rate_control.c \ checksum.c \ reed_solomon.c \ galois_tables.c \ wsastrerror.c \ histogram.c \ version.c libincludedir = $(includedir)/pgm-@RELEASE_INFO@/pgm libinclude_HEADERS = \ include/pgm/atomic.h \ include/pgm/engine.h \ include/pgm/error.h \ include/pgm/gsi.h \ include/pgm/if.h \ include/pgm/in.h \ include/pgm/list.h \ include/pgm/macros.h \ include/pgm/mem.h \ include/pgm/messages.h \ include/pgm/msgv.h \ include/pgm/packet.h \ include/pgm/pgm.h \ include/pgm/skbuff.h \ include/pgm/socket.h \ include/pgm/time.h \ include/pgm/tsi.h \ include/pgm/types.h \ include/pgm/version.h \ include/pgm/winint.h \ include/pgm/wininttypes.h \ include/pgm/zinttypes.h # nb: Solaris make does not understand $< version.c: version_generator.py $(AM_V_GEN)$(PYTHON) $(srcdir)/version_generator.py > $@ galois_tables.c: galois_generator.pl $(AM_V_GEN)$(PERL) $(srcdir)/galois_generator.pl > $@ libpgm_noinst_la_CFLAGS = \ -I$(top_srcdir)/include \ -DCONFIG_16BIT_CHECKSUM \ -DCONFIG_GALOIS_MUL_LUT \ -DGETTEXT_PACKAGE='"pgm"' lib_LTLIBRARIES = libpgm.la libpgm_la_SOURCES = libpgm_la_CFLAGS = $(libpgm_noinst_la_CFLAGS) libpgm_la_LDFLAGS = -release @RELEASE_INFO@ -version-info @VERSION_INFO@ libpgm_la_LIBADD = libpgm_noinst.la pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = openpgm-@RELEASE_INFO@.pc LIBTOOL_DEPS = @LIBTOOL_DEPS@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status libtool dist-hook: -cp $(top_srcdir)/openpgm.spec $(distdir)/openpgm.spec -rm -rf $(distdir)/include -cp -R $(top_srcdir)/include $(distdir)/include -find $(distdir) -type d -name .svn -exec rm -r {} \; >/dev/null 2>&1 || true # eof libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.clang0000644000175000017500000002443711640407354020672 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine() + '-clang'); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('COVERAGE', 'test coverage', 'none', allowed_values=('none', 'full')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies def force_clang(env): env['CC'] = 'clang'; env = Environment(); force_clang(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', # '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', # '-Wcast-align', '-Wno-cast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', '-Winline', '-Wno-unused-function', # '-pedantic', # C99 '-std=gnu99', '-D_XOPEN_SOURCE=600', '-D_BSD_SOURCE', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system '-DCONFIG_HAVE_PROC', # example: crash handling '-DCONFIG_HAVE_BACKTRACE', # timing '-DCONFIG_HAVE_PSELECT', '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', '-DCONFIG_HAVE_HPET', # event handling '-DCONFIG_HAVE_POLL', '-DCONFIG_HAVE_EPOLL', # interface enumeration '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', # sprintf # NB: raises invalid conversion specifier ''' [-Wformat] in clang # '-DCONFIG_HAVE_SPRINTF_GROUPING', '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt' ] ) force_clang(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --cflags --agent-libs'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '-clang/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/getnodeaddr_unittest.c0000644000175000017500000004046411640407354022136 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for portable function to return the nodes IP address. * * Copyright (c) 2009-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* IFF_UP */ #define _BSD_SOURCE 1 #include #include #include #include #include #ifndef _WIN32 # include # include #else # include # include #endif #include #include #include /* mock state */ struct addrinfo; struct mock_host_t { struct sockaddr_storage address; char* canonical_hostname; char* alias; }; struct mock_interface_t { unsigned int index; char* name; unsigned int flags; struct sockaddr_storage addr; struct sockaddr_storage netmask; }; static GList *mock_hosts = NULL, *mock_interfaces = NULL; #define MOCK_HOSTNAME "kiku" static char* mock_kiku = MOCK_HOSTNAME; static char* mock_localhost = "localhost"; static char* mock_invalid = "invalid.invalid"; /* RFC 2606 */ static char* mock_toolong = "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij12345"; /* 65 */ static char* mock_hostname = NULL; struct pgm_ifaddrs_t; struct pgm_error_t; static int mock_getaddrinfo (const char*, const char*, const struct addrinfo*, struct addrinfo**); static void mock_freeaddrinfo (struct addrinfo*); static int mock_gethostname (char*, size_t); static struct hostent* mock_gethostbyname (const char*); #define pgm_getifaddrs mock_pgm_getifaddrs #define pgm_freeifaddrs mock_pgm_freeifaddrs #define getaddrinfo mock_getaddrinfo #define freeaddrinfo mock_freeaddrinfo #define gethostname mock_gethostname #define gethostbyname mock_gethostbyname #define GETNODEADDR_DEBUG #include "getnodeaddr.c" static gpointer create_host ( const char* address, const char* canonical_hostname, const char* alias ) { struct mock_host_t* new_host; g_assert (address); g_assert (canonical_hostname); new_host = g_slice_alloc0 (sizeof(struct mock_host_t)); g_assert (pgm_sockaddr_pton (address, (struct sockaddr*)&new_host->address)); new_host->canonical_hostname = g_strdup (canonical_hostname); new_host->alias = alias ? g_strdup (alias) : NULL; return new_host; } static gpointer create_interface ( const unsigned index, const char* name, const char* flags ) { struct mock_interface_t* new_interface; g_assert (name); g_assert (flags); new_interface = g_slice_alloc0 (sizeof(struct mock_interface_t)); new_interface->index = index; new_interface->name = g_strdup (name); struct sockaddr_in* sin = (gpointer)&new_interface->addr; struct sockaddr_in6* sin6 = (gpointer)&new_interface->addr; gchar** tokens = g_strsplit (flags, ",", 0); for (guint i = 0; tokens[i]; i++) { if (strcmp (tokens[i], "up") == 0) new_interface->flags |= IFF_UP; else if (strcmp (tokens[i], "down") == 0) new_interface->flags |= 0; else if (strcmp (tokens[i], "loop") == 0) new_interface->flags |= IFF_LOOPBACK; else if (strcmp (tokens[i], "broadcast") == 0) new_interface->flags |= IFF_BROADCAST; else if (strcmp (tokens[i], "multicast") == 0) new_interface->flags |= IFF_MULTICAST; else if (strncmp (tokens[i], "ip=", strlen("ip=")) == 0) { const char* addr = tokens[i] + strlen("ip="); g_assert (pgm_sockaddr_pton (addr, (struct sockaddr*)&new_interface->addr)); } else if (strncmp (tokens[i], "netmask=", strlen("netmask=")) == 0) { const char* addr = tokens[i] + strlen("netmask="); g_assert (pgm_sockaddr_pton (addr, (struct sockaddr*)&new_interface->netmask)); } else if (strncmp (tokens[i], "scope=", strlen("scope=")) == 0) { const char* scope = tokens[i] + strlen("scope="); g_assert (AF_INET6 == ((struct sockaddr*)&new_interface->addr)->sa_family); ((struct sockaddr_in6*)&new_interface->addr)->sin6_scope_id = atoi (scope); } else g_error ("parsing failed for flag %s%s%s", tokens[i] ? "\"" : "", tokens[i] ? tokens[i] : "(null)", tokens[i] ? "\"" : ""); } g_strfreev (tokens); return new_interface; } #define APPEND_HOST2(a,b,c) \ do { \ gpointer data = create_host ((a), (b), (c)); \ g_assert (data); \ mock_hosts = g_list_append (mock_hosts, data); \ g_assert (mock_hosts); g_assert (mock_hosts->data); \ } while (0) #define APPEND_HOST(a,b) APPEND_HOST2((a),(b),NULL) #define APPEND_INTERFACE(a,b,c) \ do { \ gpointer data = create_interface ((a), (b), (c)); \ g_assert (data); \ mock_interfaces = g_list_append (mock_interfaces, data); \ g_assert (mock_interfaces); g_assert (mock_interfaces->data); \ } while (0) static void mock_setup_net (void) { mock_hostname = mock_kiku; APPEND_HOST ( "127.0.0.1", "localhost"); APPEND_HOST2( "10.6.28.33", "kiku.hk.miru.hk", "kiku"); APPEND_HOST2( "2002:dce8:d28e::33", "ip6-kiku", "kiku"); APPEND_HOST2( "::1", "ip6-localhost", "ip6-loopback"); APPEND_INTERFACE( 1, "lo", "up,loop"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast"); APPEND_INTERFACE( 3, "eth1", "down,broadcast,multicast"); APPEND_INTERFACE( 1, "lo", "up,loop,ip=127.0.0.1,netmask=255.0.0.0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=10.6.28.33,netmask=255.255.255.0"); APPEND_INTERFACE( 1, "lo", "up,loop,ip=::1,netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,scope=0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=2002:dce8:d28e::33,netmask=ffff:ffff:ffff:ffff::0,scope=0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=fe80::214:5eff:febd:6dda,netmask=ffff:ffff:ffff:ffff::0,scope=2"); } /* with broken IPv6 hostname setup */ static void mock_setup_net2 (void) { mock_hostname = mock_kiku; APPEND_HOST ( "127.0.0.1", "localhost"); APPEND_HOST2( "10.6.28.33", "kiku.hk.miru.hk", "kiku"); APPEND_HOST( "2002:dce8:d28e::33", "ip6-kiku"); APPEND_HOST2( "::1", "ip6-localhost", "ip6-loopback"); APPEND_INTERFACE( 1, "lo", "up,loop"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast"); APPEND_INTERFACE( 3, "eth1", "down,broadcast,multicast"); APPEND_INTERFACE( 1, "lo", "up,loop,ip=127.0.0.1,netmask=255.0.0.0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=10.6.28.33,netmask=255.255.255.0"); APPEND_INTERFACE( 1, "lo", "up,loop,ip=::1,netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,scope=0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=2002:dce8:d28e::33,netmask=ffff:ffff:ffff:ffff::0,scope=0"); APPEND_INTERFACE( 2, "eth0", "up,broadcast,multicast,ip=fe80::214:5eff:febd:6dda,netmask=ffff:ffff:ffff:ffff::0,scope=2"); } static void mock_teardown_net (void) { GList *list; /* rollback APPEND_HOST */ list = mock_hosts; while (list) { struct mock_host_t* host = list->data; g_free (host->canonical_hostname); host->canonical_hostname = NULL; if (host->alias) { g_free (host->alias); host->alias = NULL; } g_slice_free1 (sizeof(struct mock_host_t), host); list->data = NULL; list = list->next; } g_list_free (mock_hosts); mock_hosts = NULL; /* rollback APPEND_INTERFACE */ list = mock_interfaces; while (list) { struct mock_interface_t* interface_ = list->data; g_free (interface_->name); interface_->name = NULL; g_slice_free1 (sizeof(struct mock_interface_t), interface_); list->data = NULL; list = list->next; } g_list_free (mock_interfaces); mock_interfaces = NULL; mock_hostname = NULL; } /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } bool mock_pgm_getifaddrs ( struct pgm_ifaddrs_t** ifap, pgm_error_t** err ) { if (NULL == ifap) { return FALSE; } g_debug ("mock_getifaddrs (ifap:%p err:%p)", (gpointer)ifap, (gpointer)err); GList* list = mock_interfaces; int n = g_list_length (list); struct pgm_ifaddrs_t* ifa = malloc (n * sizeof(struct pgm_ifaddrs_t)); memset (ifa, 0, n * sizeof(struct pgm_ifaddrs_t)); struct pgm_ifaddrs_t* ift = ifa; while (list) { struct mock_interface_t* interface_ = list->data; ift->ifa_addr = (gpointer)&interface_->addr; ift->ifa_name = interface_->name; ift->ifa_flags = interface_->flags; ift->ifa_netmask = (gpointer)&interface_->netmask; list = list->next; if (list) { ift->ifa_next = ift + 1; ift = ift->ifa_next; } } *ifap = ifa; return TRUE; } void mock_pgm_freeifaddrs ( struct pgm_ifaddrs_t* ifa ) { g_debug ("mock_freeifaddrs (ifa:%p)", (gpointer)ifa); free (ifa); } static struct hostent* mock_gethostbyname ( const char* name ) { static struct hostent he; static char* aliases[2]; static char* addr_list[2]; /* pre-conditions */ g_assert (NULL != name); g_debug ("mock_gethostbyname (name:%s%s%s)", name ? "\"" : "", name ? name : "(null)", name ? "\"" : ""); GList* list = mock_hosts; while (list) { struct mock_host_t* host = list->data; const int host_family = ((struct sockaddr*)&host->address)->sa_family; if (((strcmp (host->canonical_hostname, name) == 0) || (host->alias && strcmp (host->alias, name) == 0))) { he.h_name = host->canonical_hostname; aliases[0] = host->alias; aliases[1] = NULL; he.h_aliases = aliases; he.h_addrtype = host_family; switch (host->address.ss_family){ case AF_INET: he.h_length = sizeof (struct in_addr); addr_list[0] = (char*)&host->address + G_STRUCT_OFFSET(struct sockaddr_in, sin_addr); break; case AF_INET6: he.h_length = sizeof (struct in6_addr); addr_list[0] = (char*)&host->address + G_STRUCT_OFFSET(struct sockaddr_in6, sin6_addr); break; default: g_assert_not_reached(); } addr_list[1] = NULL; he.h_addr_list = addr_list; return &he; } list = list->next; } #ifndef _WIN32 h_errno = HOST_NOT_FOUND; #else WSASetLastError (WSAHOST_NOT_FOUND); #endif return NULL; } static int mock_getaddrinfo ( const char* node, const char* service, const struct addrinfo* hints, struct addrinfo** res ) { #ifdef AI_V4MAPPED const int ai_flags = hints ? hints->ai_flags : (AI_V4MAPPED | AI_ADDRCONFIG); #else const int ai_flags = hints ? hints->ai_flags : (AI_ADDRCONFIG); #endif const int ai_family = hints ? hints->ai_family : AF_UNSPEC; GList* list; struct sockaddr_storage addr; if (NULL == node && NULL == service) return EAI_NONAME; /* pre-conditions */ g_assert (NULL != node); g_assert (NULL == service); g_assert (!(ai_flags & AI_CANONNAME)); #ifdef AI_NUMERICSERV g_assert (!(ai_flags & AI_NUMERICSERV)); #endif #ifdef AI_V4MAPPED g_assert (!(ai_flags & AI_V4MAPPED)); #endif g_debug ("mock_getaddrinfo (node:\"%s\" service:%s hints:%p res:%p)", node ? node : "(null)", service ? service : "(null)", (gpointer)hints, (gpointer)res); gboolean has_ip4_config; gboolean has_ip6_config; if (hints && hints->ai_flags & AI_ADDRCONFIG) { has_ip4_config = has_ip6_config = FALSE; list = mock_interfaces; while (list) { const struct mock_interface_t* interface_ = list->data; if (AF_INET == ((struct sockaddr*)&interface_->addr)->sa_family) has_ip4_config = TRUE; else if (AF_INET6 == ((struct sockaddr*)&interface_->addr)->sa_family) has_ip6_config = TRUE; if (has_ip4_config && has_ip6_config) break; list = list->next; } } else { has_ip4_config = has_ip6_config = TRUE; } if (ai_flags & AI_NUMERICHOST) { pgm_sockaddr_pton (node, (struct sockaddr*)&addr); } list = mock_hosts; while (list) { struct mock_host_t* host = list->data; const int host_family = ((struct sockaddr*)&host->address)->sa_family; if (((strcmp (host->canonical_hostname, node) == 0) || (host->alias && strcmp (host->alias, node) == 0) || (ai_flags & AI_NUMERICHOST && 0 == pgm_sockaddr_cmp ((struct sockaddr*)&addr, (struct sockaddr*)&host->address))) && (host_family == ai_family || AF_UNSPEC == ai_family) && ((AF_INET == host_family && has_ip4_config) || (AF_INET6 == host_family && has_ip6_config))) { struct addrinfo* ai = malloc (sizeof(struct addrinfo)); memset (ai, 0, sizeof(struct addrinfo)); ai->ai_family = host_family; ai->ai_addrlen = AF_INET == host_family ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); ai->ai_addr = (gpointer)&host->address; *res = ai; return 0; } list = list->next; } return EAI_NONAME; } static void mock_freeaddrinfo ( struct addrinfo* res ) { g_assert (NULL != res); g_debug ("mock_freeaddrinfo (res:%p)", (gpointer)res); free (res); } static int mock_gethostname ( char* name, size_t len ) { g_debug ("mock_gethostname (name:%p len:%d)", (gpointer)name, len); if (NULL == name) { errno = EFAULT; return -1; } if (len < 0) { errno = EINVAL; return -1; } if (len < (1 + strlen (mock_hostname))) { errno = ENAMETOOLONG; return -1; } /* force an error */ if (mock_hostname == mock_toolong) { errno = ENAMETOOLONG; return -1; } strncpy (name, mock_hostname, len); if (len > 0) name[len - 1] = '\0'; return 0; } /* target: * bool * pgm_get_multicast_enabled_node_addr ( * const sa_family_t family, * struct sockaddr* addr, * const socklen_t cnt, * pgm_error_t** error * ) */ START_TEST (test_getnodeaddr_pass_001) { struct sockaddr_storage addr; char saddr[INET6_ADDRSTRLEN]; pgm_error_t* err = NULL; gboolean success = pgm_get_multicast_enabled_node_addr (AF_UNSPEC, (struct sockaddr*)&addr, sizeof(addr), &err); if (!success && err) { g_error ("Resolving node address with AF_UNSPEC: %s", (err && err->message) ? err->message : "(null)"); } fail_unless (TRUE == success, "getnodeaddr failed"); fail_unless (NULL == err, "error raised"); pgm_sockaddr_ntop ((struct sockaddr*)&addr, saddr, sizeof(saddr)); g_message ("AF_UNSPEC:%s", saddr ? saddr : "(null)"); fail_unless (TRUE == pgm_get_multicast_enabled_node_addr (AF_INET, (struct sockaddr*)&addr, sizeof(addr), &err), "getnodeaddr failed"); fail_unless (NULL == err, "error raised"); pgm_sockaddr_ntop ((struct sockaddr*)&addr, saddr, sizeof(saddr)); g_message ("AF_INET:%s", saddr ? saddr : "(null)"); fail_unless (TRUE == pgm_get_multicast_enabled_node_addr (AF_INET6, (struct sockaddr*)&addr, sizeof(addr), &err), "getnodeaddr failed"); fail_unless (NULL == err, "error raised"); pgm_sockaddr_ntop ((struct sockaddr*)&addr, saddr, sizeof(saddr)); g_message ("AF_INET6:%s", saddr ? saddr : "(null)"); } END_TEST START_TEST (test_getnodeaddr_fail_001) { pgm_error_t* err = NULL; fail_unless (FALSE == pgm_get_multicast_enabled_node_addr (AF_UNSPEC, NULL, 0, &err), "getnodeaddr failed"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_getnodeaddr = tcase_create ("getnodeaddr"); suite_add_tcase (s, tc_getnodeaddr); tcase_add_checked_fixture (tc_getnodeaddr, mock_setup_net, mock_teardown_net); tcase_add_test (tc_getnodeaddr, test_getnodeaddr_pass_001); tcase_add_test (tc_getnodeaddr, test_getnodeaddr_fail_001); TCase* tc_getnodeaddr2 = tcase_create ("getnodeaddr/2"); suite_add_tcase (s, tc_getnodeaddr2); tcase_add_checked_fixture (tc_getnodeaddr2, mock_setup_net2, mock_teardown_net); tcase_add_test (tc_getnodeaddr2, test_getnodeaddr_pass_001); return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { #ifdef _WIN32 WORD wVersionRequested = MAKEWORD (2, 2); WSADATA wsaData; g_assert (0 == WSAStartup (wVersionRequested, &wsaData)); g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2); #endif pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); #ifdef _WIN32 WSACleanup(); #endif return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/ltmain.sh0000755000175000017500000105051111644640123017366 0ustar locallocal # libtool (GNU libtool) 2.4 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4 Debian-2.4-4 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4 Debian-2.4-4" TIMESTAMP="" package_revision=1.3293 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_apped perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.RHEL40000644000175000017500000002052111640407354020412 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import os import time import sys EnsureSConsVersion( 0, 97 ) SConsignFile('scons.signatures'); opt = Options(None, ARGUMENTS) opt.AddOptions ( (EnumOption ('BUILD', 'build environment', 'debug', ('release', 'debug', 'profile'))), (EnumOption ('BRANCH', 'branch prediction', 'none', ('none', 'profile', 'seed'))), (EnumOption ('COVERAGE', 'test coverage', 'none', ('none', 'full'))), (EnumOption ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', ('true', 'false'))), (EnumOption ('WITH_HTTP', 'HTTP administration', 'true', ('true', 'false'))), (EnumOption ('WITH_SNMP', 'SNMP administration', 'true', ('true', 'false'))), (EnumOption ('WITH_CHECK', 'Check test system', 'false', ('true', 'false'))), (EnumOption ('WITH_TEST', 'Network test system', 'false', ('true', 'false'))), (EnumOption ('WITH_EXAMPLES', 'Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_NCURSES', 'NCURSES examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PLUS', 'libpgmplus GPL library', 'false', ('true', 'false'))), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('PKG_CONFIG_PATH=/usr/evolution28/lib/pkgconfig:/usr/lib/pkconfig pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('PKG_CONFIG_PATH=/usr/evolution28/lib/pkgconfig:/usr/lib/pkconfig pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment(ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', '-Winline', '-pedantic', '-std=gnu99', '--param', 'max-inline-insns-single=600', '-D_REENTRANT', '-D_GNU_SOURCE', '-D__need_IOV_MAX', '-DCONFIG_16BIT_CHECKSUM', '-DCONFIG_HAVE_PROC', '-DCONFIG_HAVE_BACKTRACE', '-DCONFIG_HAVE_PSELECT', '-DCONFIG_HAVE_POLL', '-DCONFIG_HAVE_EPOLL', '-DCONFIG_HAVE_CLOCK_GETTIME', '-DCONFIG_HAVE_CLOCK_NANOSLEEP', '-DCONFIG_HAVE_NANOSLEEP', '-DCONFIG_HAVE_USLEEP', '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_GETHOSTBYNAME2', '-DCONFIG_HAVE_GETPROTOBYNAME_R', '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', '-DCONFIG_HAVE_DSO_VISIBILITY', '-DCONFIG_BIND_INADDR_ANY', '-DCONFIG_GALOIS_MUL_LUT', ], LINKFLAGS = [ '-pipe', '-lm' ] ) opt.Update (env) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = '-ggdb', LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment env.ParseConfig('PKG_CONFIG_PATH=/usr/evolution28/lib/pkgconfig:/usr/lib/pkconfig pkg-config --cflags --libs glib-2.0 gthread-2.0'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp env['SNMP_FLAGS'] = { 'CCFLAGS' : [], 'LIBS' : [ 'netsnmpagent', 'netsnmpmibs', 'netsnmphelpers', 'netsnmp' ], }; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); lastLIBS = context.env['LIBS']; lastCCFLAGS= context.env['CCFLAGS']; context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); context.env.Replace(LIBS = lastLIBS, CCFLAGS=lastCCFLAGS); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Enabling extra Red Hat dependencies for Net-SNMP.'; conf.env['SNMP_FLAGS']['LIBS'].append(['librpm', 'libsensors', 'libdl', 'libwrap']); lastLIBS = conf.env['LIBS']; conf.env.ParseConfig('perl -MExtUtils::Embed -e ldopts'); conf.env['SNMP_FLAGS']['LIBS'].append(conf.env['LIBS']); conf.env.Replace(LIBS = lastLIBS); if not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # DSO visibility flags if '-DCONFIG_HAVE_DSO_VISIBILITY' in env['CCFLAGS']: env.Append(CCFLAGS = '-DPGM_GNUC_INTERNAL=G_GNUC_INTERNAL') else: env.Append(CCFLAGS = '-DPGM_GNUC_INTERNAL=') # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); SConscript(ref_node + 'SConscript.libpgm'); SConscript(ref_node + 'SConscript.libpgmex'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/recv.c.c89.patch0000644000175000017500000002633411640407354020356 0ustar locallocal--- recv.c 2010-11-05 04:58:45.000000000 +0800 +++ recv.c89.c 2010-11-05 08:08:16.000000000 +0800 @@ -47,12 +47,21 @@ #endif #ifndef _WIN32 +# define pgm_msghdr msghdr # define PGM_CMSG_FIRSTHDR(msg) CMSG_FIRSTHDR(msg) # define PGM_CMSG_NXTHDR(msg, cmsg) CMSG_NXTHDR(msg, cmsg) # define PGM_CMSG_DATA(cmsg) CMSG_DATA(cmsg) # define PGM_CMSG_SPACE(len) CMSG_SPACE(len) # define PGM_CMSG_LEN(len) CMSG_LEN(len) #else +# define pgm_msghdr _WSAMSG +# define msg_name name +# define msg_namelen namelen +# define msg_iov lpBuffers +# define msg_iovlen dwBufferCount +# define msg_control Control.buf +# define msg_controllen Control.len +# define msg_flags dwFlags # define PGM_CMSG_FIRSTHDR(msg) WSA_CMSG_FIRSTHDR(msg) # define PGM_CMSG_NXTHDR(msg, cmsg) WSA_CMSG_NXTHDR(msg, cmsg) # define PGM_CMSG_DATA(cmsg) WSA_CMSG_DATA(cmsg) @@ -65,13 +74,13 @@ /* as listed in MSDN */ # define pgm_cmsghdr wsacmsghdr # else +/* as found in Visual C++ 2010 */ # define pgm_cmsghdr _WSACMSGHDR # endif #else # define pgm_cmsghdr cmsghdr #endif - /* read a packet into a PGM skbuff * on success returns packet length, on closed socket returns 0, * on error returns -1. @@ -104,41 +113,41 @@ return 0; #ifdef CONFIG_TARGET_WINE + { socklen_t fromlen = src_addrlen; const ssize_t len = recvfrom (sock->recv_sock, skb->head, sock->max_tpdu, 0, src_addr, &fromlen); if (len <= 0) return len; #else - struct pgm_iovec iov = { - .iov_base = skb->head, - .iov_len = sock->max_tpdu - }; + { + struct pgm_iovec iov; + struct pgm_msghdr msg, *pmsg = &msg; char aux[ 1024 ]; + iov.iov_base = skb->head; + iov.iov_len = sock->max_tpdu; # ifndef _WIN32 - struct msghdr msg = { - .msg_name = src_addr, - .msg_namelen = src_addrlen, - .msg_iov = (void*)&iov, - .msg_iovlen = 1, - .msg_control = aux, - .msg_controllen = sizeof(aux), - .msg_flags = 0 - }; + msg.msg_name = src_addr, + msg.msg_namelen = src_addrlen, + msg.msg_iov = (void*)&iov, + msg.msg_iovlen = 1, + msg.msg_control = aux, + msg.msg_controllen = sizeof(aux), + msg.msg_flags = 0; + { ssize_t len = recvmsg (sock->recv_sock, &msg, flags); if (len <= 0) return len; # else /* !_WIN32 */ - WSAMSG msg = { - .name = (LPSOCKADDR)src_addr, - .namelen = src_addrlen, - .lpBuffers = (LPWSABUF)&iov, - .dwBufferCount = 1, - .dwFlags = 0 - }; - msg.Control.buf = aux; - msg.Control.len = sizeof(aux); + msg.msg_name = (LPSOCKADDR)src_addr; + msg.msg_namelen = src_addrlen; + msg.msg_iov = (LPWSABUF)&iov; + msg.msg_iovlen = 1; + msg.msg_control = aux; + msg.msg_controllen = sizeof(aux); + msg.msg_flags = 0; + { DWORD len; - if (SOCKET_ERROR == pgm_WSARecvMsg (sock->recv_sock, &msg, &len, NULL, NULL)) { + if (SOCKET_ERROR == pgm_WSARecvMsg (sock->recv_sock, pmsg, &len, NULL, NULL)) { return SOCKET_ERROR; } # endif /* !_WIN32 */ @@ -149,8 +158,7 @@ const unsigned percent = pgm_rand_int_range (&sock->rand_, 0, 100); if (percent <= pgm_loss_rate) { pgm_debug ("Simulated packet loss"); - pgm_set_last_sock_error (PGM_SOCK_EAGAIN); - return SOCKET_ERROR; + goto abort_msg; } } #endif @@ -170,9 +178,9 @@ AF_INET6 == pgm_sockaddr_family (src_addr)) { struct pgm_cmsghdr* cmsg; - for (cmsg = PGM_CMSG_FIRSTHDR(&msg); + for (cmsg = PGM_CMSG_FIRSTHDR(pmsg); cmsg != NULL; - cmsg = PGM_CMSG_NXTHDR(&msg, cmsg)) + cmsg = PGM_CMSG_NXTHDR(pmsg, cmsg)) { /* both IP_PKTINFO and IP_RECVDSTADDR exist on OpenSolaris, so capture * each type if defined. @@ -185,8 +193,9 @@ /* discard on invalid address */ if (PGM_UNLIKELY(NULL == pktinfo)) { pgm_debug ("in_pktinfo is NULL"); - return -1; + goto abort_msg; } + { const struct in_pktinfo* in = pktinfo; struct sockaddr_in s4; memset (&s4, 0, sizeof(s4)); @@ -194,6 +203,7 @@ s4.sin_addr.s_addr = in->ipi_addr.s_addr; memcpy (dst_addr, &s4, sizeof(s4)); break; + } } #endif #ifdef IP_RECVDSTADDR @@ -204,8 +214,9 @@ /* discard on invalid address */ if (PGM_UNLIKELY(NULL == recvdstaddr)) { pgm_debug ("in_recvdstaddr is NULL"); - return -1; + goto abort_msg; } + { const struct in_addr* in = recvdstaddr; struct sockaddr_in s4; memset (&s4, 0, sizeof(s4)); @@ -213,6 +224,7 @@ s4.sin_addr.s_addr = in->s_addr; memcpy (dst_addr, &s4, sizeof(s4)); break; + } } #endif #if !defined(IP_PKTINFO) && !defined(IP_RECVDSTADDR) @@ -226,8 +238,9 @@ /* discard on invalid address */ if (PGM_UNLIKELY(NULL == pktinfo)) { pgm_debug ("in6_pktinfo is NULL"); - return -1; + goto abort_msg; } + { const struct in6_pktinfo* in6 = pktinfo; struct sockaddr_in6 s6; memset (&s6, 0, sizeof(s6)); @@ -237,11 +250,26 @@ memcpy (dst_addr, &s6, sizeof(s6)); /* does not set flow id */ break; + } } } } #endif return len; + +#ifdef CONFIG_TARGET_WINE + } +#else + } +# ifndef _WIN32 + } +# else + } +#endif +#endif +abort_msg: + pgm_set_last_sock_error (PGM_SOCK_EAGAIN); + return SOCKET_ERROR; } /* upstream = receiver to source, peer-to-peer = receive to receiver @@ -358,6 +386,7 @@ } /* check to see the source this peer-to-peer message is about is in our peer list */ + { pgm_tsi_t upstream_tsi; memcpy (&upstream_tsi.gsi, &skb->tsi.gsi, sizeof(pgm_gsi_t)); upstream_tsi.sport = skb->pgm_header->pgm_dport; @@ -400,6 +429,7 @@ else if (sock->can_send_data) sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED]++; return FALSE; + } } /* source to receiver message @@ -425,11 +455,13 @@ pgm_assert (NULL != source); #ifdef RECV_DEBUG + { char saddr[INET6_ADDRSTRLEN], daddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop (src_addr, saddr, sizeof(saddr)); pgm_sockaddr_ntop (dst_addr, daddr, sizeof(daddr)); pgm_debug ("on_downstream (sock:%p skb:%p src-addr:%s dst-addr:%s source:%p)", (const void*)sock, (const void*)skb, saddr, daddr, (const void*)source); + } #endif if (PGM_UNLIKELY(!sock->can_recv_data)) { @@ -594,8 +626,10 @@ const int status = pgm_poll_info (sock, fds, &n_fds, POLLIN); pgm_assert (-1 != status); #else + { fd_set readfds; FD_ZERO(&readfds); + { const int status = pgm_select_info (sock, &readfds, NULL, &n_fds); pgm_assert (-1 != status); #endif /* CONFIG_HAVE_POLL */ @@ -606,6 +640,7 @@ sock->is_pending_read = FALSE; } + { int timeout; if (sock->can_send_data && !pgm_txw_retransmit_is_empty (sock->window)) timeout = 0; @@ -615,10 +650,11 @@ #ifdef CONFIG_HAVE_POLL const int ready = poll (fds, n_fds, timeout /* μs */ / 1000 /* to ms */); #else - struct timeval tv_timeout = { - .tv_sec = timeout > 1000000L ? (timeout / 1000000L) : 0, - .tv_usec = timeout > 1000000L ? (timeout % 1000000L) : timeout - }; + { + struct timeval tv_timeout; + tv_timeout.tv_sec = timeout > 1000000L ? (timeout / 1000000L) : 0; + tv_timeout.tv_usec = timeout > 1000000L ? (timeout % 1000000L) : timeout; + { const int ready = select (n_fds, &readfds, NULL, NULL, &tv_timeout); #endif if (PGM_UNLIKELY(SOCKET_ERROR == ready)) { @@ -628,6 +664,11 @@ pgm_debug ("recv again on empty"); return EAGAIN; } + } + } + } + } + } } while (pgm_timer_check (sock)); pgm_debug ("state generated event"); return EINTR; @@ -663,7 +704,7 @@ int status = PGM_IO_STATUS_WOULD_BLOCK; pgm_debug ("pgm_recvmsgv (sock:%p msg-start:%p msg-len:%" PRIzu " flags:%d bytes-read:%p error:%p)", - (void*)sock, (void*)msg_start, msg_len, flags, (void*)_bytes_read, (void*)error); + (void*)sock, (void*)msg_start, (unsigned long)msg_len, flags, (void*)_bytes_read, (void*)error); /* parameters */ pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR); @@ -695,6 +736,7 @@ if (PGM_UNLIKELY(sock->is_reset)) { pgm_assert (NULL != sock->peers_pending); pgm_assert (NULL != sock->peers_pending->data); + { pgm_peer_t* peer = sock->peers_pending->data; if (flags & MSG_ERRQUEUE) pgm_set_reset_error (sock, peer, msg_start); @@ -712,6 +754,7 @@ pgm_mutex_unlock (&sock->receiver_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_RESET; + } } /* timer status */ @@ -733,6 +776,7 @@ pgm_notify_clear (&sock->rdata_notify); } + { size_t bytes_read = 0; unsigned data_read = 0; struct pgm_msgv_t* pmsg = msg_start; @@ -752,6 +796,7 @@ * * We cannot actually block here as packets pushed by the timers need to be addressed too. */ + { struct sockaddr_storage src, dst; ssize_t len; size_t bytes_received = 0; @@ -791,6 +836,7 @@ bytes_received += len; } + { pgm_error_t* err = NULL; const bool is_valid = (sock->udp_encap_ucast_port || AF_INET6 == src.ss_family) ? pgm_parse_udp_encap (sock->rx_buffer, &err) : @@ -810,6 +856,7 @@ goto recv_again; } + { pgm_peer_t* source = NULL; if (PGM_UNLIKELY(!on_pgm (sock, sock->rx_buffer, (struct sockaddr*)&src, (struct sockaddr*)&dst, &source))) goto recv_again; @@ -889,6 +936,7 @@ if (PGM_UNLIKELY(sock->is_reset)) { pgm_assert (NULL != sock->peers_pending); pgm_assert (NULL != sock->peers_pending->data); + { pgm_peer_t* peer = sock->peers_pending->data; if (flags & MSG_ERRQUEUE) pgm_set_reset_error (sock, peer, msg_start); @@ -906,6 +954,7 @@ pgm_mutex_unlock (&sock->receiver_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_RESET; + } } pgm_mutex_unlock (&sock->receiver_mutex); pgm_rwlock_reader_unlock (&sock->lock); @@ -940,6 +989,10 @@ pgm_mutex_unlock (&sock->receiver_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_NORMAL; + } + } + } + } } /* read one contiguous apdu and return as a IO scatter/gather array. msgv is owned by @@ -996,12 +1049,14 @@ } pgm_debug ("pgm_recvfrom (sock:%p buf:%p buflen:%" PRIzu " flags:%d bytes-read:%p from:%p from:%p error:%p)", - (const void*)sock, buf, buflen, flags, (const void*)_bytes_read, (const void*)from, (const void*)fromlen, (const void*)error); + (const void*)sock, buf, (unsigned long)buflen, flags, (const void*)_bytes_read, (const void*)from, (const void*)fromlen, (const void*)error); + { const int status = pgm_recvmsg (sock, &msgv, flags & ~(MSG_ERRQUEUE), &bytes_read, error); if (PGM_IO_STATUS_NORMAL != status) return status; + { size_t bytes_copied = 0; struct pgm_sk_buff_t** skb = msgv.msgv_skb; struct pgm_sk_buff_t* pskb = *skb; @@ -1016,7 +1071,7 @@ size_t copy_len = pskb->len; if (bytes_copied + copy_len > buflen) { pgm_warn (_("APDU truncated, original length %" PRIzu " bytes."), - bytes_read); + (unsigned long)bytes_read); copy_len = buflen - bytes_copied; bytes_read = buflen; } @@ -1027,6 +1082,8 @@ if (_bytes_read) *_bytes_read = bytes_copied; return PGM_IO_STATUS_NORMAL; + } + } } /* Basic recv operation, copying data from window to application. @@ -1048,7 +1105,7 @@ if (PGM_LIKELY(buflen)) pgm_return_val_if_fail (NULL != buf, PGM_IO_STATUS_ERROR); pgm_debug ("pgm_recv (sock:%p buf:%p buflen:%" PRIzu " flags:%d bytes-read:%p error:%p)", - (const void*)sock, buf, buflen, flags, (const void*)bytes_read, (const void*)error); + (const void*)sock, buf, (unsigned long)buflen, flags, (const void*)bytes_read, (const void*)error); return pgm_recvfrom (sock, buf, buflen, flags, bytes_read, NULL, NULL, error); } libpgm-5.1.118-1~dfsg/openpgm/pgm/hashtable.c0000644000175000017500000001672711640407354017657 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable hashtable. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include //#define HASHTABLE_DEBUG #define HASHTABLE_MIN_SIZE 11 #define HASHTABLE_MAX_SIZE 13845163 struct pgm_hashnode_t { const void* key; void* value; struct pgm_hashnode_t* next; uint_fast32_t key_hash; }; typedef struct pgm_hashnode_t pgm_hashnode_t; struct pgm_hashtable_t { unsigned size; unsigned nnodes; pgm_hashnode_t** nodes; pgm_hashfunc_t hash_func; pgm_equalfunc_t key_equal_func; }; #define PGM_HASHTABLE_RESIZE(hash_table) \ do { \ if ( (hash_table->size >= 3 * hash_table->nnodes && hash_table->size > HASHTABLE_MIN_SIZE) || \ (3 * hash_table->size <= hash_table->nnodes && hash_table->size < HASHTABLE_MAX_SIZE) ) \ { \ pgm_hashtable_resize (hash_table); \ } \ } while (0) static void pgm_hashtable_resize (pgm_hashtable_t*); static pgm_hashnode_t** pgm_hashtable_lookup_node (const pgm_hashtable_t*restrict, const void*restrict, pgm_hash_t*restrict) PGM_GNUC_PURE; static pgm_hashnode_t* pgm_hash_node_new (const void*restrict, void*restrict, const pgm_hash_t); static void pgm_hash_node_destroy (pgm_hashnode_t*); static void pgm_hash_nodes_destroy (pgm_hashnode_t*); PGM_GNUC_INTERNAL pgm_hashtable_t* pgm_hashtable_new ( pgm_hashfunc_t hash_func, pgm_equalfunc_t key_equal_func ) { pgm_return_val_if_fail (NULL != hash_func, NULL); pgm_return_val_if_fail (NULL != key_equal_func, NULL); pgm_hashtable_t *hash_table; hash_table = pgm_new (pgm_hashtable_t, 1); hash_table->size = HASHTABLE_MIN_SIZE; hash_table->nnodes = 0; hash_table->hash_func = hash_func; hash_table->key_equal_func = key_equal_func; hash_table->nodes = pgm_new0 (pgm_hashnode_t*, hash_table->size); return hash_table; } PGM_GNUC_INTERNAL void pgm_hashtable_unref ( pgm_hashtable_t* hash_table ) { pgm_return_if_fail (hash_table != NULL); for (unsigned i = 0; i < hash_table->size; i++) pgm_hash_nodes_destroy (hash_table->nodes[i]); pgm_free (hash_table->nodes); pgm_free (hash_table); } PGM_GNUC_INTERNAL void pgm_hashtable_destroy ( pgm_hashtable_t* hash_table ) { pgm_return_if_fail (hash_table != NULL); pgm_hashtable_remove_all (hash_table); pgm_hashtable_unref (hash_table); } static inline pgm_hashnode_t** pgm_hashtable_lookup_node ( const pgm_hashtable_t* restrict hash_table, const void* restrict key, pgm_hash_t* restrict hash_return /* non-NULL to return hash value */ ) { const pgm_hash_t hash_value = (*hash_table->hash_func) (key); pgm_hashnode_t** node = &hash_table->nodes[hash_value % hash_table->size]; if (hash_return) *hash_return = hash_value; while (*node && (((*node)->key_hash != hash_value) || !(*hash_table->key_equal_func) ((*node)->key, key))) { node = &(*node)->next; } return node; } PGM_GNUC_INTERNAL void* pgm_hashtable_lookup ( const pgm_hashtable_t* restrict hash_table, const void* restrict key ) { pgm_return_val_if_fail (hash_table != NULL, NULL); const pgm_hashnode_t* node = *pgm_hashtable_lookup_node (hash_table, key, NULL); return node ? node->value : NULL; } PGM_GNUC_INTERNAL void* pgm_hashtable_lookup_extended ( const pgm_hashtable_t* restrict hash_table, const void* restrict key, void* restrict hash_return ) { pgm_return_val_if_fail (hash_table != NULL, NULL); const pgm_hashnode_t* node = *pgm_hashtable_lookup_node (hash_table, key, hash_return); return node ? node->value : NULL; } PGM_GNUC_INTERNAL void pgm_hashtable_insert ( pgm_hashtable_t* restrict hash_table, const void* restrict key, void* restrict value ) { pgm_hashnode_t **node; pgm_hash_t key_hash; pgm_return_if_fail (hash_table != NULL); node = pgm_hashtable_lookup_node (hash_table, key, &key_hash); pgm_return_if_fail (NULL == *node); *node = pgm_hash_node_new (key, value, key_hash); hash_table->nnodes++; PGM_HASHTABLE_RESIZE (hash_table); } PGM_GNUC_INTERNAL bool pgm_hashtable_remove ( pgm_hashtable_t* restrict hash_table, const void* restrict key ) { pgm_hashnode_t **node, *dest; pgm_return_val_if_fail (hash_table != NULL, FALSE); node = pgm_hashtable_lookup_node (hash_table, key, NULL); if (*node) { dest = *node; (*node) = dest->next; pgm_hash_node_destroy (dest); hash_table->nnodes--; PGM_HASHTABLE_RESIZE (hash_table); return TRUE; } return FALSE; } PGM_GNUC_INTERNAL void pgm_hashtable_remove_all ( pgm_hashtable_t* hash_table ) { pgm_return_if_fail (hash_table != NULL); for (unsigned i = 0; i < hash_table->size; i++) { pgm_hash_nodes_destroy (hash_table->nodes[i]); hash_table->nodes[i] = NULL; } hash_table->nnodes = 0; PGM_HASHTABLE_RESIZE (hash_table); } static void pgm_hashtable_resize ( pgm_hashtable_t* hash_table ) { const unsigned new_size = CLAMP (pgm_spaced_primes_closest (hash_table->nnodes), HASHTABLE_MIN_SIZE, HASHTABLE_MAX_SIZE); pgm_hashnode_t** new_nodes = pgm_new0 (pgm_hashnode_t*, new_size); for (unsigned i = 0; i < hash_table->size; i++) for (pgm_hashnode_t *node = hash_table->nodes[i], *next; node; node = next) { next = node->next; const pgm_hash_t hash_val = node->key_hash % new_size; node->next = new_nodes[hash_val]; new_nodes[hash_val] = node; } pgm_free (hash_table->nodes); hash_table->nodes = new_nodes; hash_table->size = new_size; } static pgm_hashnode_t* pgm_hash_node_new ( const void* restrict key, void* restrict value, const pgm_hash_t key_hash ) { pgm_hashnode_t *hash_node = pgm_new (pgm_hashnode_t, 1); hash_node->key = key; hash_node->value = value; hash_node->key_hash = key_hash; hash_node->next = NULL; return hash_node; } static void pgm_hash_node_destroy ( pgm_hashnode_t* hash_node ) { pgm_free (hash_node); } static void pgm_hash_nodes_destroy ( pgm_hashnode_t* hash_node ) { while (hash_node) { pgm_hashnode_t *next = hash_node->next; pgm_free (hash_node); hash_node = next; } } /* common hash value compare and hash key generation functions */ PGM_GNUC_INTERNAL bool pgm_str_equal ( const void* restrict p1, const void* restrict p2 ) { const char *restrict s1 = p1, *restrict s2 = p2; return (strcmp (s1, s2) == 0); } /* 31 bit hash function */ PGM_GNUC_INTERNAL pgm_hash_t pgm_str_hash ( const void* p ) { const char* s = p; pgm_hash_t hash_val = *s; if (PGM_LIKELY (hash_val)) for (s++; *s; s++) hash_val = (hash_val << 5) - hash_val + *s; return hash_val; } PGM_GNUC_INTERNAL bool pgm_int_equal ( const void* restrict p1, const void* restrict p2 ) { const int i1 = *(const int*restrict)p1, i2 = *(const int*restrict)p2; return (i1 == i2); } PGM_GNUC_INTERNAL pgm_hash_t pgm_int_hash ( const void* p ) { const int i = *(const int*)p; return (pgm_hash_t)i; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/source.c.c89.patch0000644000175000017500000004740611640407354020722 0ustar locallocal--- source.c 2011-04-06 10:21:24.000000000 +0800 +++ source.c89.c 2011-04-06 10:21:34.000000000 +0800 @@ -115,11 +115,13 @@ ) { pgm_return_val_if_fail (NULL != sock, FALSE); + { const bool status = pgm_txw_retransmit_push (sock->window, nak_tg_sqn | sock->rs_proactive_h, TRUE /* is_parity */, sock->tg_sqn_shift); return status; + } } /* a deferred request for RDATA, now processing in the timer thread, we check the transmit @@ -230,6 +232,7 @@ pgm_assert (NULL != skb); pgm_assert (NULL != opt_pgmcc_feedback); + { const uint32_t opt_tstamp = ntohl (opt_pgmcc_feedback->opt_tstamp); const uint16_t opt_loss_rate = ntohs (opt_pgmcc_feedback->opt_loss_rate); @@ -259,6 +262,7 @@ } return FALSE; + } } /* NAK requesting RDATA transmission for a sending sock, only valid if @@ -294,6 +298,7 @@ pgm_debug ("pgm_on_nak (sock:%p skb:%p)", (const void*)sock, (const void*)skb); + { const bool is_parity = skb->pgm_header->pgm_options & PGM_OPT_PARITY; if (is_parity) { sock->cumulative_stats[PGM_PC_SOURCE_PARITY_NAKS_RECEIVED]++; @@ -378,12 +383,15 @@ pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed NAK rejected on sequence list overrun, %d rported NAKs."), nak_list_len); return FALSE; } - - for (uint_fast8_t i = 0; i < nak_list_len; i++) + + { + uint_fast8_t i; + for (i = 0; i < nak_list_len; i++) { sqn_list.sqn[sqn_list.len++] = ntohl (*nak_list); nak_list++; } + } /* send NAK confirm packet immediately, then defer to timer thread for a.s.a.p * delivery of the actual RDATA packets. blocking send for NCF is ignored as RDATA @@ -395,13 +403,17 @@ send_ncf (sock, (struct sockaddr*)&nak_src_nla, (struct sockaddr*)&nak_grp_nla, sqn_list.sqn[0], is_parity); /* queue retransmit requests */ - for (uint_fast8_t i = 0; i < sqn_list.len; i++) { + { + uint_fast8_t i; + for (i = 0; i < sqn_list.len; i++) { const bool push_status = pgm_txw_retransmit_push (sock->window, sqn_list.sqn[i], is_parity, sock->tg_sqn_shift); if (PGM_UNLIKELY(!push_status)) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Failed to push retransmit request for #%" PRIu32), sqn_list.sqn[i]); } } + } return TRUE; + } } /* Null-NAK, or N-NAK propogated by a DLR for hand waving excitement @@ -470,6 +482,7 @@ return FALSE; } /* TODO: check for > 16 options & past packet end */ + { const struct pgm_opt_header* opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); @@ -478,6 +491,7 @@ break; } } while (!(opt_header->opt_type & PGM_OPT_END)); + } } sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED] += 1 + nnak_list_len; @@ -554,6 +568,7 @@ sock->next_crqst = 0; /* count new ACK sequences */ + { const uint32_t ack_rx_max = ntohl (ack->ack_rx_max); const int32_t delta = ack_rx_max - sock->ack_rx_max; /* ignore older ACKs when multiple active ACKers */ @@ -570,6 +585,7 @@ if (0 == new_acks) return TRUE; + { const bool is_congestion_limited = (sock->tokens < pgm_fp8 (1)); /* after loss detection cancel any further manipulation of the window @@ -581,14 +597,17 @@ { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("PGMCC window token manipulation suspended due to congestion (T:%u W:%u)"), pgm_fp8tou (sock->tokens), pgm_fp8tou (sock->cwnd_size)); + { const uint_fast32_t token_inc = pgm_fp8mul (pgm_fp8 (new_acks), pgm_fp8 (1) + pgm_fp8div (pgm_fp8 (1), sock->cwnd_size)); sock->tokens = MIN( sock->tokens + token_inc, sock->cwnd_size ); goto notify_tx; + } } sock->is_congested = FALSE; } /* count outstanding lost sequences */ + { const unsigned total_lost = _pgm_popcount (~sock->ack_bitmap); /* no detected data loss at ACKer, increase congestion window size */ @@ -609,6 +628,7 @@ sock->cwnd_size += d; } + { const uint_fast32_t iw = pgm_fp8div (pgm_fp8 (1), sock->cwnd_size); /* linear window increase */ @@ -617,6 +637,7 @@ sock->tokens = MIN( sock->tokens + token_inc, sock->cwnd_size ); // pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("PGMCC++ (T:%u W:%u)"), // pgm_fp8tou (sock->tokens), pgm_fp8tou (sock->cwnd_size)); + } } else { @@ -651,6 +672,9 @@ pgm_notify_send (&sock->ack_notify); } return TRUE; + } + } + } } /* ambient/heartbeat SPM's @@ -859,6 +883,7 @@ pgm_assert (nak_src_nla->sa_family == nak_grp_nla->sa_family); #ifdef SOURCE_DEBUG + { char saddr[INET6_ADDRSTRLEN], gaddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop (nak_src_nla, saddr, sizeof(saddr)); pgm_sockaddr_ntop (nak_grp_nla, gaddr, sizeof(gaddr)); @@ -869,6 +894,7 @@ sequence, is_parity ? "TRUE": "FALSE" ); + } #endif tpdu_length = sizeof(struct pgm_header); @@ -910,7 +936,7 @@ if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; /* fall through silently on other errors */ - + pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)tpdu_length); return TRUE; } @@ -949,16 +975,20 @@ pgm_assert (nak_src_nla->sa_family == nak_grp_nla->sa_family); #ifdef SOURCE_DEBUG + { char saddr[INET6_ADDRSTRLEN], gaddr[INET6_ADDRSTRLEN]; char list[1024]; pgm_sockaddr_ntop (nak_src_nla, saddr, sizeof(saddr)); pgm_sockaddr_ntop (nak_grp_nla, gaddr, sizeof(gaddr)); sprintf (list, "%" PRIu32, sqn_list->sqn[0]); - for (uint_fast8_t i = 1; i < sqn_list->len; i++) { + { + uint_fast8_t i; + for (i = 1; i < sqn_list->len; i++) { char sequence[ 2 + strlen("4294967295") ]; sprintf (sequence, " %" PRIu32, sqn_list->sqn[i]); strcat (list, sequence); } + } pgm_debug ("send_ncf_list (sock:%p nak-src-nla:%s nak-grp-nla:%s sqn-list:[%s] is-parity:%s)", (void*)sock, saddr, @@ -966,6 +996,7 @@ list, is_parity ? "TRUE": "FALSE" ); + } #endif tpdu_length = sizeof(struct pgm_header) + @@ -1008,8 +1039,11 @@ opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); opt_nak_list->opt_reserved = 0; /* to network-order */ - for (uint_fast8_t i = 1; i < sqn_list->len; i++) + { + uint_fast8_t i; + for (i = 1; i < sqn_list->len; i++) opt_nak_list->opt_sqn[i-1] = htonl (sqn_list->sqn[i]); + } header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); @@ -1041,6 +1075,7 @@ ) { pgm_mutex_lock (&sock->timer_mutex); + { const pgm_time_t next_poll = sock->next_poll; const pgm_time_t spm_heartbeat_interval = sock->spm_heartbeat_interval[ sock->spm_heartbeat_state = 1 ]; sock->next_heartbeat_spm = now + spm_heartbeat_interval; @@ -1052,6 +1087,7 @@ sock->is_pending_read = TRUE; } } + } pgm_mutex_unlock (&sock->timer_mutex); } @@ -1091,6 +1127,7 @@ pgm_debug ("send_odata (sock:%p skb:%p bytes-written:%p)", (void*)sock, (void*)skb, (void*)bytes_written); + { const uint16_t tsdu_length = skb->len; const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; const size_t tpdu_length = tsdu_length + pgm_pkt_offset (FALSE, pgmcc_family); @@ -1152,6 +1189,7 @@ else data = (char*)pgmcc_data + sizeof(struct pgm_opt_pgmcc_data); } + { const size_t pgm_header_len = (char*)data - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); STATE(unfolded_odata) = pgm_csum_partial (data, (uint16_t)tsdu_length, 0); @@ -1245,6 +1283,8 @@ if (bytes_written) *bytes_written = tsdu_length; return PGM_IO_STATUS_NORMAL; + } + } } /* send one PGM original data packet, callee owned memory. @@ -1274,6 +1314,7 @@ pgm_debug ("send_odata_copy (sock:%p tsdu:%p tsdu_length:%u bytes-written:%p)", (void*)sock, tsdu, tsdu_length, (void*)bytes_written); + { const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; const size_t tpdu_length = tsdu_length + pgm_pkt_offset (FALSE, pgmcc_family); @@ -1334,6 +1375,7 @@ pgm_sockaddr_to_nla ((struct sockaddr*)&sock->acker_nla, (char*)&pgmcc_data->opt_nla_afi); data = (char*)opt_header + opt_header->opt_length; } + { const size_t pgm_header_len = (char*)data - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); STATE(unfolded_odata) = pgm_csum_partial_copy (tsdu, data, (uint16_t)tsdu_length, 0); @@ -1425,6 +1467,8 @@ if (bytes_written) *bytes_written = tsdu_length; return PGM_IO_STATUS_NORMAL; + } + } } /* send one PGM original data packet, callee owned scatter/gather io vector @@ -1470,7 +1514,9 @@ } STATE(tsdu_length) = 0; - for (unsigned i = 0; i < count; i++) + { + unsigned i; + for (i = 0; i < count; i++) { #ifdef TRANSPORT_DEBUG if (PGM_LIKELY(vector[i].iov_len)) { @@ -1479,13 +1525,16 @@ #endif STATE(tsdu_length) += vector[i].iov_len; } + } pgm_return_val_if_fail (STATE(tsdu_length) <= sock->max_tsdu, PGM_IO_STATUS_ERROR); STATE(skb) = pgm_alloc_skb (sock->max_tpdu); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); + { const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; pgm_skb_reserve (STATE(skb), (uint16_t)pgm_pkt_offset (FALSE, pgmcc_family)); + } pgm_skb_put (STATE(skb), (uint16_t)STATE(tsdu_length)); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->data; @@ -1502,6 +1551,7 @@ STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); STATE(skb)->pgm_header->pgm_checksum = 0; + { const size_t pgm_header_len = (char*)(STATE(skb)->pgm_data + 1) - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); @@ -1510,13 +1560,19 @@ STATE(unfolded_odata) = pgm_csum_partial_copy ((const char*)vector[0].iov_base, dst, (uint16_t)vector[0].iov_len, 0); /* iterate over one or more vector elements to perform scatter/gather checksum & copy */ - for (unsigned i = 1; i < count; i++) { + { + unsigned i; + for (i = 1; i < count; i++) { dst += vector[i-1].iov_len; + { const uint32_t unfolded_element = pgm_csum_partial_copy ((const char*)vector[i].iov_base, dst, (uint16_t)vector[i].iov_len, 0); STATE(unfolded_odata) = pgm_csum_block_add (STATE(unfolded_odata), unfolded_element, (uint16_t)vector[i-1].iov_len); + } + } } STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); + } /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); @@ -1573,7 +1629,7 @@ reset_heartbeat_spm (sock, STATE(skb)->tstamp); if (PGM_LIKELY((size_t)sent == STATE(skb)->len)) { - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += STATE(tsdu_length); + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)STATE(tsdu_length); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] ++; pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)(tpdu_length + sock->iphdr_len)); } @@ -1617,6 +1673,7 @@ pgm_assert (NULL != sock); pgm_assert (NULL != apdu); + { const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; /* continue if blocked mid-apdu */ @@ -1700,10 +1757,12 @@ /* TODO: the assembly checksum & copy routine is faster than memcpy & pgm_cksum on >= opteron hardware */ STATE(skb)->pgm_header->pgm_checksum = 0; + { const size_t pgm_header_len = (char*)(STATE(skb)->pgm_opt_fragment + 1) - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); STATE(unfolded_odata) = pgm_csum_partial_copy ((const char*)apdu + STATE(data_bytes_offset), STATE(skb)->pgm_opt_fragment + 1, (uint16_t)STATE(tsdu_length), 0); STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); + } /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); @@ -1759,7 +1818,7 @@ pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)data_bytes_sent; if (bytes_written) *bytes_written = apdu_length; return PGM_IO_STATUS_NORMAL; @@ -1769,13 +1828,14 @@ reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)data_bytes_sent; } if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; + } } /* Send one APDU, whether it fits within one TPDU or more. @@ -1794,7 +1854,7 @@ ) { pgm_debug ("pgm_send (sock:%p apdu:%p apdu-length:%" PRIzu " bytes-written:%p)", - (void*)sock, apdu, apdu_length, (void*)bytes_written); + (void*)sock, apdu, (unsigned long)apdu_length, (void*)bytes_written); /* parameters */ pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR); @@ -1897,6 +1957,7 @@ return status; } + { const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; /* continue if blocked mid-apdu */ @@ -1918,7 +1979,9 @@ /* calculate (total) APDU length */ STATE(apdu_length) = 0; - for (unsigned i = 0; i < count; i++) + { + unsigned i; + for (i = 0; i < count; i++) { #ifdef TRANSPORT_DEBUG if (PGM_LIKELY(vector[i].iov_len)) { @@ -1934,6 +1997,7 @@ } STATE(apdu_length) += vector[i].iov_len; } + } /* pass on non-fragment calls */ if (is_one_apdu) { @@ -2072,6 +2136,7 @@ /* checksum & copy */ STATE(skb)->pgm_header->pgm_checksum = 0; + { const size_t pgm_header_len = (char*)(STATE(skb)->pgm_opt_fragment + 1) - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); @@ -2109,11 +2174,14 @@ dst += copy_length; src_length = vector[STATE(vector_index)].iov_len - STATE(vector_offset); copy_length = MIN( STATE(tsdu_length) - dst_length, src_length ); + { const uint32_t unfolded_element = pgm_csum_partial_copy (src, dst, (uint16_t)copy_length, 0); STATE(unfolded_odata) = pgm_csum_block_add (STATE(unfolded_odata), unfolded_element, (uint16_t)dst_length); + } } STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); + } /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); @@ -2161,6 +2229,8 @@ } } while ( STATE(data_bytes_offset) < STATE(apdu_length) ); + } + pgm_assert( STATE(data_bytes_offset) == STATE(apdu_length) ); sock->is_apdu_eagain = FALSE; @@ -2168,7 +2238,7 @@ pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)data_bytes_sent; if (bytes_written) *bytes_written = STATE(apdu_length); pgm_mutex_unlock (&sock->source_mutex); @@ -2180,7 +2250,7 @@ reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)data_bytes_sent; } pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); @@ -2253,6 +2323,7 @@ return status; } + { const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; /* continue if blocked mid-apdu */ @@ -2264,8 +2335,11 @@ { size_t total_tpdu_length = 0; - for (unsigned i = 0; i < count; i++) + { + unsigned i; + for (i = 0; i < count; i++) total_tpdu_length += sock->iphdr_len + pgm_pkt_offset (is_one_apdu, pgmcc_family) + vector[i]->len; + } if (!pgm_rate_check2 (&sock->rate_control, &sock->odata_rate_control, @@ -2279,12 +2353,16 @@ } STATE(is_rate_limited) = TRUE; } + } if (is_one_apdu) { STATE(apdu_length) = 0; STATE(first_sqn) = pgm_txw_next_lead(sock->window); - for (unsigned i = 0; i < count; i++) + + { + unsigned i; + for (i = 0; i < count; i++) { if (PGM_UNLIKELY(vector[i]->len > sock->max_tsdu_fragment)) { pgm_mutex_unlock (&sock->source_mutex); @@ -2293,6 +2371,8 @@ } STATE(apdu_length) += vector[i]->len; } + } + if (PGM_UNLIKELY(STATE(apdu_length) > sock->max_apdu)) { pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); @@ -2357,10 +2437,12 @@ /* TODO: the assembly checksum & copy routine is faster than memcpy & pgm_cksum on >= opteron hardware */ STATE(skb)->pgm_header->pgm_checksum = 0; pgm_assert ((char*)STATE(skb)->data > (char*)STATE(skb)->pgm_header); + { const size_t header_length = (char*)STATE(skb)->data - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)header_length, 0); STATE(unfolded_odata) = pgm_csum_partial ((char*)STATE(skb)->data, (uint16_t)STATE(tsdu_length), 0); STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)header_length)); + } /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); @@ -2421,7 +2503,7 @@ pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)data_bytes_sent; if (bytes_written) *bytes_written = data_bytes_sent; pgm_mutex_unlock (&sock->source_mutex); @@ -2433,7 +2515,7 @@ reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; - sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; + sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += (uint32_t)data_bytes_sent; } pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); @@ -2491,10 +2573,12 @@ rdata->data_trail = htonl (pgm_txw_trail(sock->window)); header->pgm_checksum = 0; + { const size_t header_length = tpdu_length - ntohs(header->pgm_tsdu_length); const uint32_t unfolded_header = pgm_csum_partial (header, (uint16_t)header_length, 0); const uint32_t unfolded_odata = pgm_txw_get_unfolded_checksum (skb); header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, unfolded_odata, (uint16_t)header_length)); + } /* congestion control */ if (sock->use_pgmcc && @@ -2523,6 +2607,7 @@ /* fall through silently on other errors */ } + { const pgm_time_t now = pgm_time_update_now(); if (sock->use_pgmcc) { @@ -2536,6 +2621,7 @@ sock->spm_heartbeat_state = 1; sock->next_heartbeat_spm = now + sock->spm_heartbeat_interval[sock->spm_heartbeat_state++]; pgm_mutex_unlock (&sock->timer_mutex); + } pgm_txw_inc_retransmit_count (skb); sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED] += ntohs(header->pgm_tsdu_length); libpgm-5.1.118-1~dfsg/openpgm/pgm/source.c0000644000175000017500000025513211640407354017217 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM source socket. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include //#define SOURCE_DEBUG #ifndef SOURCE_DEBUG # define PGM_DISABLE_ASSERT #endif /* locals */ static inline bool peer_is_source (const pgm_peer_t*) PGM_GNUC_CONST; static inline bool peer_is_peer (const pgm_peer_t*) PGM_GNUC_CONST; static void reset_heartbeat_spm (pgm_sock_t*const, const pgm_time_t); static bool send_ncf (pgm_sock_t*const restrict, const struct sockaddr*const restrict, const struct sockaddr*const restrict, const uint32_t, const bool); static bool send_ncf_list (pgm_sock_t*const restrict, const struct sockaddr*const restrict, const struct sockaddr*const restrict, struct pgm_sqn_list_t*const restrict, const bool); static int send_odata (pgm_sock_t*const restrict, struct pgm_sk_buff_t*const restrict, size_t*restrict); static int send_odata_copy (pgm_sock_t*const restrict, const void*restrict, const uint16_t, size_t*restrict); static int send_odatav (pgm_sock_t*const restrict, const struct pgm_iovec*const restrict, const unsigned, size_t*restrict); static bool send_rdata (pgm_sock_t*restrict, struct pgm_sk_buff_t*restrict); static inline unsigned _pgm_popcount ( uint32_t n ) { #if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) return __builtin_popcount (n); #else /* MIT HAKMEM 169 */ const uint32_t t = n - ((n >> 1) & 033333333333) - ((n >> 2) & 011111111111); return ((t + (t >> 3) & 030707070707)) % 63; #endif } static inline bool peer_is_source ( const pgm_peer_t* peer ) { return (NULL == peer); } static inline bool peer_is_peer ( const pgm_peer_t* peer ) { return (NULL != peer); } static inline void reset_spmr_timer ( pgm_peer_t* const peer ) { peer->spmr_expiry = 0; } static inline size_t source_max_tsdu ( const pgm_sock_t* sock, const bool can_fragment ) { size_t max_tsdu = can_fragment ? sock->max_tsdu_fragment : sock->max_tsdu; if (sock->use_var_pktlen /* OPT_VAR_PKT_LEN */) max_tsdu -= sizeof (uint16_t); return max_tsdu; } /* prototype of function to send pro-active parity NAKs. */ static bool pgm_schedule_proactive_nak ( pgm_sock_t* sock, uint32_t nak_tg_sqn /* transmission group (shifted) */ ) { pgm_return_val_if_fail (NULL != sock, FALSE); const bool status = pgm_txw_retransmit_push (sock->window, nak_tg_sqn | sock->rs_proactive_h, TRUE /* is_parity */, sock->tg_sqn_shift); return status; } /* a deferred request for RDATA, now processing in the timer thread, we check the transmit * window to see if the packet exists and forward on, maintaining a lock until the queue is * empty. * * returns TRUE on success, returns FALSE if operation would block. */ PGM_GNUC_INTERNAL bool pgm_on_deferred_nak ( pgm_sock_t* const sock ) { struct pgm_sk_buff_t* skb; /* pre-conditions */ pgm_assert (NULL != sock); /* We can flush queue and block all odata, or process one set, or process each * sequence number individually. */ /* parity packets are re-numbered across the transmission group with index h, sharing the space * with the original packets. beyond the transmission group size (k), the PGM option OPT_PARITY_GRP * provides the extra offset value. */ /* peek from the retransmit queue so we can eliminate duplicate NAKs up until the repair packet * has been retransmitted. */ pgm_spinlock_lock (&sock->txw_spinlock); skb = pgm_txw_retransmit_try_peek (sock->window); if (skb) { skb = pgm_skb_get (skb); pgm_spinlock_unlock (&sock->txw_spinlock); if (!send_rdata (sock, skb)) { pgm_free_skb (skb); pgm_notify_send (&sock->rdata_notify); return FALSE; } pgm_free_skb (skb); /* now remove sequence number from retransmit queue, re-enabling NAK processing for this sequence number */ pgm_txw_retransmit_remove_head (sock->window); } else pgm_spinlock_unlock (&sock->txw_spinlock); return TRUE; } /* SPMR indicates if multicast to cancel own SPMR, or unicast to send SPM. * * rate limited to 1/IHB_MIN per TSI (13.4). * * if SPMR was valid, returns TRUE, if invalid returns FALSE. */ PGM_GNUC_INTERNAL bool pgm_on_spmr ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict peer, /* maybe NULL if socket is source */ struct pgm_sk_buff_t* const restrict skb ) { /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_debug ("pgm_on_spmr (sock:%p peer:%p skb:%p)", (void*)sock, (void*)peer, (void*)skb); if (PGM_UNLIKELY(!pgm_verify_spmr (skb))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed SPMR rejected.")); return FALSE; } if (peer_is_source (peer)) { const bool send_status = pgm_send_spm (sock, 0); if (PGM_UNLIKELY(!send_status)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Failed to send SPM on SPM-Request.")); } } else { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Suppressing SPMR due to peer multicast SPMR.")); reset_spmr_timer (peer); } return TRUE; } /* Process opt_pgmcc_feedback PGM option that ships attached to ACK or NAK. * Contents use to elect best ACKer. * * returns TRUE if peer is the elected ACKer. */ static bool on_opt_pgmcc_feedback ( pgm_sock_t* const restrict sock, const struct pgm_sk_buff_t* const restrict skb, const struct pgm_opt_pgmcc_feedback* restrict opt_pgmcc_feedback ) { struct sockaddr_storage peer_nla; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_assert (NULL != opt_pgmcc_feedback); const uint32_t opt_tstamp = ntohl (opt_pgmcc_feedback->opt_tstamp); const uint16_t opt_loss_rate = ntohs (opt_pgmcc_feedback->opt_loss_rate); const uint32_t rtt = (uint32_t)(pgm_to_msecs (skb->tstamp) - opt_tstamp); const uint64_t peer_loss = rtt * rtt * opt_loss_rate; pgm_nla_to_sockaddr (&opt_pgmcc_feedback->opt_nla_afi, (struct sockaddr*)&peer_nla); /* ACKer elections */ if (PGM_UNLIKELY(pgm_sockaddr_is_addr_unspecified ((const struct sockaddr*)&sock->acker_nla))) { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Elected first ACKer")); memcpy (&sock->acker_nla, &peer_nla, pgm_sockaddr_storage_len (&peer_nla)); } else if (peer_loss > sock->acker_loss && 0 != pgm_sockaddr_cmp ((const struct sockaddr*)&peer_nla, (const struct sockaddr*)&sock->acker_nla)) { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Elected new ACKer")); memcpy (&sock->acker_nla, &peer_nla, pgm_sockaddr_storage_len (&peer_nla)); } /* update ACKer state */ if (0 == pgm_sockaddr_cmp ((const struct sockaddr*)&peer_nla, (const struct sockaddr*)&sock->acker_nla)) { sock->acker_loss = peer_loss; return TRUE; } return FALSE; } /* NAK requesting RDATA transmission for a sending sock, only valid if * sequence number(s) still in transmission window. * * we can potentially have different IP versions for the NAK packet to the send group. * * TODO: fix IPv6 AFIs * * take in a NAK and pass off to an asynchronous queue for another thread to process * * if NAK is valid, returns TRUE. on error, FALSE is returned. */ PGM_GNUC_INTERNAL bool pgm_on_nak ( pgm_sock_t* const restrict sock, struct pgm_sk_buff_t* const restrict skb ) { const struct pgm_nak *nak; const struct pgm_nak6 *nak6; struct sockaddr_storage nak_src_nla, nak_grp_nla; const uint32_t *nak_list = NULL; uint_fast8_t nak_list_len = 0; struct pgm_sqn_list_t sqn_list; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_debug ("pgm_on_nak (sock:%p skb:%p)", (const void*)sock, (const void*)skb); const bool is_parity = skb->pgm_header->pgm_options & PGM_OPT_PARITY; if (is_parity) { sock->cumulative_stats[PGM_PC_SOURCE_PARITY_NAKS_RECEIVED]++; if (!sock->use_ondemand_parity) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Parity NAK rejected as on-demand parity is not enabled.")); sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS]++; return FALSE; } } else sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED]++; if (PGM_UNLIKELY(!pgm_verify_nak (skb))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed NAK rejected.")); sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS]++; return FALSE; } nak = (struct pgm_nak *)skb->data; nak6 = (struct pgm_nak6*)skb->data; /* NAK_SRC_NLA contains our sock unicast NLA */ pgm_nla_to_sockaddr (&nak->nak_src_nla_afi, (struct sockaddr*)&nak_src_nla); if (PGM_UNLIKELY(pgm_sockaddr_cmp ((struct sockaddr*)&nak_src_nla, (struct sockaddr*)&sock->send_addr) != 0)) { char saddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&nak_src_nla, saddr, sizeof(saddr)); pgm_trace (PGM_LOG_ROLE_NETWORK,_("NAK rejected for unmatched NLA: %s"), saddr); sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS]++; return FALSE; } /* NAK_GRP_NLA containers our sock multicast group */ pgm_nla_to_sockaddr ((AF_INET6 == nak_src_nla.ss_family) ? &nak6->nak6_grp_nla_afi : &nak->nak_grp_nla_afi, (struct sockaddr*)&nak_grp_nla); if (PGM_UNLIKELY(pgm_sockaddr_cmp ((struct sockaddr*)&nak_grp_nla, (struct sockaddr*)&sock->send_gsr.gsr_group) != 0)) { char sgroup[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&nak_src_nla, sgroup, sizeof(sgroup)); pgm_trace (PGM_LOG_ROLE_NETWORK,_("NAK rejected as targeted for different multicast group: %s"), sgroup); sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS]++; return FALSE; } /* create queue object */ sqn_list.sqn[0] = ntohl (nak->nak_sqn); sqn_list.len = 1; pgm_debug ("nak_sqn %" PRIu32, sqn_list.sqn[0]); /* check NAK list */ if (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { const struct pgm_opt_header *opt_header; const struct pgm_opt_length *opt_len; opt_len = (AF_INET6 == nak_src_nla.ss_family) ? (const struct pgm_opt_length*)(nak6 + 1) : (const struct pgm_opt_length*)(nak + 1); if (PGM_UNLIKELY(opt_len->opt_type != PGM_OPT_LENGTH)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed NAK rejected.")); sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS]++; return FALSE; } if (PGM_UNLIKELY(opt_len->opt_length != sizeof(struct pgm_opt_length))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed NAK rejected.")); sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS]++; return FALSE; } /* TODO: check for > 16 options & past packet end */ opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); if ((opt_header->opt_type & PGM_OPT_MASK) == PGM_OPT_NAK_LIST) { nak_list = ((const struct pgm_opt_nak_list*)(opt_header + 1))->opt_sqn; nak_list_len = ( opt_header->opt_length - sizeof(struct pgm_opt_header) - sizeof(uint8_t) ) / sizeof(uint32_t); break; } } while (!(opt_header->opt_type & PGM_OPT_END)); } /* nak list numbers */ if (PGM_UNLIKELY(nak_list_len > 62)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed NAK rejected on sequence list overrun, %d rported NAKs."), nak_list_len); return FALSE; } for (uint_fast8_t i = 0; i < nak_list_len; i++) { sqn_list.sqn[sqn_list.len++] = ntohl (*nak_list); nak_list++; } /* send NAK confirm packet immediately, then defer to timer thread for a.s.a.p * delivery of the actual RDATA packets. blocking send for NCF is ignored as RDATA * broadcast will be sent later. */ if (nak_list_len) send_ncf_list (sock, (struct sockaddr*)&nak_src_nla, (struct sockaddr*)&nak_grp_nla, &sqn_list, is_parity); else send_ncf (sock, (struct sockaddr*)&nak_src_nla, (struct sockaddr*)&nak_grp_nla, sqn_list.sqn[0], is_parity); /* queue retransmit requests */ for (uint_fast8_t i = 0; i < sqn_list.len; i++) { const bool push_status = pgm_txw_retransmit_push (sock->window, sqn_list.sqn[i], is_parity, sock->tg_sqn_shift); if (PGM_UNLIKELY(!push_status)) { pgm_trace (PGM_LOG_ROLE_TX_WINDOW,_("Failed to push retransmit request for #%" PRIu32), sqn_list.sqn[i]); } } return TRUE; } /* Null-NAK, or N-NAK propogated by a DLR for hand waving excitement * * if NNAK is valid, returns TRUE. on error, FALSE is returned. */ PGM_GNUC_INTERNAL bool pgm_on_nnak ( pgm_sock_t* const restrict sock, struct pgm_sk_buff_t* const restrict skb ) { const struct pgm_nak *nnak; const struct pgm_nak6 *nnak6; struct sockaddr_storage nnak_src_nla, nnak_grp_nla; uint_fast8_t nnak_list_len = 0; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_debug ("pgm_on_nnak (sock:%p skb:%p)", (void*)sock, (void*)skb); sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED]++; if (PGM_UNLIKELY(!pgm_verify_nnak (skb))) { sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS]++; return FALSE; } nnak = (struct pgm_nak *)skb->data; nnak6 = (struct pgm_nak6*)skb->data; /* NAK_SRC_NLA contains our sock unicast NLA */ pgm_nla_to_sockaddr (&nnak->nak_src_nla_afi, (struct sockaddr*)&nnak_src_nla); if (PGM_UNLIKELY(pgm_sockaddr_cmp ((struct sockaddr*)&nnak_src_nla, (struct sockaddr*)&sock->send_addr) != 0)) { sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS]++; return FALSE; } /* NAK_GRP_NLA containers our sock multicast group */ pgm_nla_to_sockaddr ((AF_INET6 == nnak_src_nla.ss_family) ? &nnak6->nak6_grp_nla_afi : &nnak->nak_grp_nla_afi, (struct sockaddr*)&nnak_grp_nla); if (PGM_UNLIKELY(pgm_sockaddr_cmp ((struct sockaddr*)&nnak_grp_nla, (struct sockaddr*)&sock->send_gsr.gsr_group) != 0)) { sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS]++; return FALSE; } /* check NNAK list */ if (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { const struct pgm_opt_length* opt_len = (AF_INET6 == nnak_src_nla.ss_family) ? (const struct pgm_opt_length*)(nnak6 + 1) : (const struct pgm_opt_length*)(nnak + 1); if (PGM_UNLIKELY(opt_len->opt_type != PGM_OPT_LENGTH)) { sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS]++; return FALSE; } if (PGM_UNLIKELY(opt_len->opt_length != sizeof(struct pgm_opt_length))) { sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS]++; return FALSE; } /* TODO: check for > 16 options & past packet end */ const struct pgm_opt_header* opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); if ((opt_header->opt_type & PGM_OPT_MASK) == PGM_OPT_NAK_LIST) { nnak_list_len = ( opt_header->opt_length - sizeof(struct pgm_opt_header) - sizeof(uint8_t) ) / sizeof(uint32_t); break; } } while (!(opt_header->opt_type & PGM_OPT_END)); } sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED] += 1 + nnak_list_len; return TRUE; } /* ACK, sent upstream by one selected ACKER for congestion control feedback. * * if ACK is valid, returns TRUE. on error, FALSE is returned. */ PGM_GNUC_INTERNAL bool pgm_on_ack ( pgm_sock_t* const restrict sock, struct pgm_sk_buff_t* const restrict skb ) { const struct pgm_ack *ack; bool is_acker = FALSE; uint32_t ack_bitmap; unsigned new_acks; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_debug ("pgm_on_ack (sock:%p skb:%p)", (const void*)sock, (const void*)skb); sock->cumulative_stats[PGM_PC_SOURCE_ACK_PACKETS_RECEIVED]++; if (PGM_UNLIKELY(!pgm_verify_ack (skb))) { sock->cumulative_stats[PGM_PC_SOURCE_ACK_ERRORS]++; return FALSE; } if (!sock->use_pgmcc) return FALSE; ack = (struct pgm_ack*)skb->data; /* check PGMCC feedback option for new elections */ if (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { const struct pgm_opt_header *opt_header; const struct pgm_opt_length *opt_len; opt_len = (const struct pgm_opt_length*)(ack + 1); if (PGM_UNLIKELY(opt_len->opt_type != PGM_OPT_LENGTH)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed ACK rejected.")); return FALSE; } if (PGM_UNLIKELY(opt_len->opt_length != sizeof(struct pgm_opt_length))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Malformed ACK rejected.")); return FALSE; } opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); if ((opt_header->opt_type & PGM_OPT_MASK) == PGM_OPT_PGMCC_FEEDBACK) { const struct pgm_opt_pgmcc_feedback* opt_pgmcc_feedback = (const struct pgm_opt_pgmcc_feedback*)(opt_header + 1); is_acker = on_opt_pgmcc_feedback (sock, skb, opt_pgmcc_feedback); break; /* ignore other options */ } } while (!(opt_header->opt_type & PGM_OPT_END)); } /* ignore ACKs from other receivers or sessions */ if (!is_acker) return TRUE; /* reset ACK expiration */ sock->next_crqst = 0; /* count new ACK sequences */ const uint32_t ack_rx_max = ntohl (ack->ack_rx_max); const int32_t delta = ack_rx_max - sock->ack_rx_max; /* ignore older ACKs when multiple active ACKers */ if (pgm_uint32_gt (ack_rx_max, sock->ack_rx_max)) sock->ack_rx_max = ack_rx_max; ack_bitmap = ntohl (ack->ack_bitmap); if (delta > 32) sock->ack_bitmap = 0; /* sequence jump ahead beyond past bitmap */ else if (delta > 0) sock->ack_bitmap <<= delta; /* immediate sequence */ else if (delta > -32) ack_bitmap <<= -delta; /* repair sequence scoped by bitmap */ else ack_bitmap = 0; /* old sequence */ new_acks = _pgm_popcount (ack_bitmap & ~sock->ack_bitmap); sock->ack_bitmap |= ack_bitmap; if (0 == new_acks) return TRUE; const bool is_congestion_limited = (sock->tokens < pgm_fp8 (1)); /* after loss detection cancel any further manipulation of the window * until feedback is received for the next transmitted packet. */ if (sock->is_congested) { if (pgm_uint32_lte (ack_rx_max, sock->suspended_sqn)) { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("PGMCC window token manipulation suspended due to congestion (T:%u W:%u)"), pgm_fp8tou (sock->tokens), pgm_fp8tou (sock->cwnd_size)); const uint_fast32_t token_inc = pgm_fp8mul (pgm_fp8 (new_acks), pgm_fp8 (1) + pgm_fp8div (pgm_fp8 (1), sock->cwnd_size)); sock->tokens = MIN( sock->tokens + token_inc, sock->cwnd_size ); goto notify_tx; } sock->is_congested = FALSE; } /* count outstanding lost sequences */ const unsigned total_lost = _pgm_popcount (~sock->ack_bitmap); /* no detected data loss at ACKer, increase congestion window size */ if (0 == total_lost) { uint_fast32_t n, token_inc; new_acks += sock->acks_after_loss; sock->acks_after_loss = 0; n = pgm_fp8 (new_acks); token_inc = 0; /* slow-start phase, exponential increase to SSTHRESH */ if (sock->cwnd_size < sock->ssthresh) { const uint_fast32_t d = MIN( n, sock->ssthresh - sock->cwnd_size ); n -= d; token_inc = d + d; sock->cwnd_size += d; } const uint_fast32_t iw = pgm_fp8div (pgm_fp8 (1), sock->cwnd_size); /* linear window increase */ token_inc += pgm_fp8mul (n, pgm_fp8 (1) + iw); sock->cwnd_size += pgm_fp8mul (n, iw); sock->tokens = MIN( sock->tokens + token_inc, sock->cwnd_size ); // pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("PGMCC++ (T:%u W:%u)"), // pgm_fp8tou (sock->tokens), pgm_fp8tou (sock->cwnd_size)); } else { /* Look for an unacknowledged data packet which is followed by at least three * acknowledged data packets, then the packet is assumed to be lost and PGMCC * reacts by halving the window. * * Common value will be 0xfffffff7. */ sock->acks_after_loss += new_acks; if (sock->acks_after_loss >= 3) { sock->acks_after_loss = 0; sock->suspended_sqn = ack_rx_max; sock->is_congested = TRUE; sock->cwnd_size = pgm_fp8div (sock->cwnd_size, pgm_fp8 (2)); if (sock->cwnd_size > sock->tokens) sock->tokens = 0; else sock->tokens -= sock->cwnd_size; sock->ack_bitmap = 0xffffffff; pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("PGMCC congestion, half window size (T:%u W:%u)"), pgm_fp8tou (sock->tokens), pgm_fp8tou (sock->cwnd_size)); } } /* token is now available so notify tx thread that transmission time is available */ notify_tx: if (is_congestion_limited && sock->tokens >= pgm_fp8 (1)) { pgm_notify_send (&sock->ack_notify); } return TRUE; } /* ambient/heartbeat SPM's * * heartbeat: ihb_tmr decaying between ihb_min and ihb_max 2x after last packet * * on success, TRUE is returned, if operation would block, FALSE is returned. */ PGM_GNUC_INTERNAL bool pgm_send_spm ( pgm_sock_t* const sock, const int flags ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_spm *spm; struct pgm_spm6 *spm6; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != sock->window); pgm_debug ("pgm_send_spm (sock:%p flags:%d)", (const void*)sock, flags); tpdu_length = sizeof(struct pgm_header); if (AF_INET == sock->send_gsr.gsr_group.ss_family) tpdu_length += sizeof(struct pgm_spm); else tpdu_length += sizeof(struct pgm_spm6); if (sock->use_proactive_parity || sock->use_ondemand_parity || sock->is_pending_crqst || PGM_OPT_FIN == flags) { tpdu_length += sizeof(struct pgm_opt_length); /* forward error correction */ if (sock->use_proactive_parity || sock->use_ondemand_parity) tpdu_length += sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_parity_prm); /* congestion report request */ if (sock->is_pending_crqst) tpdu_length += sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_crqst); /* end of session */ if (PGM_OPT_FIN == flags) tpdu_length += sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fin); } buf = pgm_alloca (tpdu_length); header = (struct pgm_header*)buf; spm = (struct pgm_spm *)(header + 1); spm6 = (struct pgm_spm6*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = PGM_SPM; header->pgm_options = 0; header->pgm_tsdu_length = 0; /* SPM */ spm->spm_sqn = htonl (sock->spm_sqn); spm->spm_trail = htonl (pgm_txw_trail_atomic (sock->window)); spm->spm_lead = htonl (pgm_txw_lead_atomic (sock->window)); spm->spm_reserved = 0; /* our nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&sock->send_addr, (char*)&spm->spm_nla_afi); /* PGM options */ if (sock->use_proactive_parity || sock->use_ondemand_parity || sock->is_pending_crqst || PGM_OPT_FIN == flags) { struct pgm_opt_header *opt_header, *last_opt_header; struct pgm_opt_length* opt_len; uint16_t opt_total_length; if (AF_INET == sock->send_gsr.gsr_group.ss_family) opt_header = (struct pgm_opt_header*)(spm + 1); else opt_header = (struct pgm_opt_header*)(spm6 + 1); header->pgm_options |= PGM_OPT_PRESENT; opt_len = (struct pgm_opt_length*)opt_header; opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_total_length = sizeof(struct pgm_opt_length); last_opt_header = opt_header = (struct pgm_opt_header*)(opt_len + 1); /* OPT_PARITY_PRM */ if (sock->use_proactive_parity || sock->use_ondemand_parity) { struct pgm_opt_parity_prm *opt_parity_prm; header->pgm_options |= PGM_OPT_NETWORK; opt_total_length += sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_parity_prm); opt_header->opt_type = PGM_OPT_PARITY_PRM; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_parity_prm); opt_parity_prm = (struct pgm_opt_parity_prm*)(opt_header + 1); opt_parity_prm->opt_reserved = (sock->use_proactive_parity ? PGM_PARITY_PRM_PRO : 0) | (sock->use_ondemand_parity ? PGM_PARITY_PRM_OND : 0); opt_parity_prm->parity_prm_tgs = htonl (sock->rs_k); last_opt_header = opt_header; opt_header = (struct pgm_opt_header*)(opt_parity_prm + 1); } /* OPT_CRQST */ if (sock->is_pending_crqst) { struct pgm_opt_crqst *opt_crqst; header->pgm_options |= PGM_OPT_NETWORK; opt_total_length += sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_crqst); opt_header->opt_type = PGM_OPT_CRQST; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_crqst); opt_crqst = (struct pgm_opt_crqst*)(opt_header + 1); /* request receiver worst path report, OPT_CR_RX_WP */ opt_crqst->opt_reserved = PGM_OPT_CRQST_RXP; sock->is_pending_crqst = FALSE; last_opt_header = opt_header; opt_header = (struct pgm_opt_header*)(opt_crqst + 1); } /* OPT_FIN */ if (PGM_OPT_FIN == flags) { struct pgm_opt_fin *opt_fin; opt_total_length += sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fin); opt_header->opt_type = PGM_OPT_FIN; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fin); opt_fin = (struct pgm_opt_fin*)(opt_header + 1); opt_fin->opt_reserved = 0; last_opt_header = opt_header; opt_header = (struct pgm_opt_header*)(opt_fin + 1); } last_opt_header->opt_type |= PGM_OPT_END; opt_len->opt_total_length = htons (opt_total_length); } /* checksum optional for SPMs */ header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, flags != PGM_OPT_SYN && sock->is_controlled_spm, /* rate limited */ NULL, TRUE, /* with router alert */ buf, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { const int save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->blocklen = tpdu_length + sock->iphdr_len; return FALSE; } /* fall through silently on other errors */ } /* advance SPM sequence only on successful transmission */ sock->spm_sqn++; pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)tpdu_length); return TRUE; } /* send a NAK confirm (NCF) message with provided sequence number list. * * on success, TRUE is returned, returns FALSE if operation would block. */ static bool send_ncf ( pgm_sock_t* const restrict sock, const struct sockaddr* const restrict nak_src_nla, const struct sockaddr* const restrict nak_grp_nla, const uint32_t sequence, const bool is_parity /* send parity NCF */ ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_nak *ncf; struct pgm_nak6 *ncf6; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != nak_src_nla); pgm_assert (NULL != nak_grp_nla); pgm_assert (nak_src_nla->sa_family == nak_grp_nla->sa_family); #ifdef SOURCE_DEBUG char saddr[INET6_ADDRSTRLEN], gaddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop (nak_src_nla, saddr, sizeof(saddr)); pgm_sockaddr_ntop (nak_grp_nla, gaddr, sizeof(gaddr)); pgm_debug ("send_ncf (sock:%p nak-src-nla:%s nak-grp-nla:%s sequence:%" PRIu32" is-parity:%s)", (void*)sock, saddr, gaddr, sequence, is_parity ? "TRUE": "FALSE" ); #endif tpdu_length = sizeof(struct pgm_header); tpdu_length += (AF_INET == nak_src_nla->sa_family) ? sizeof(struct pgm_nak) : sizeof(struct pgm_nak6); buf = pgm_alloca (tpdu_length); header = (struct pgm_header*)buf; ncf = (struct pgm_nak *)(header + 1); ncf6 = (struct pgm_nak6*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = PGM_NCF; header->pgm_options = is_parity ? PGM_OPT_PARITY : 0; header->pgm_tsdu_length = 0; /* NCF */ ncf->nak_sqn = htonl (sequence); /* source nla */ pgm_sockaddr_to_nla (nak_src_nla, (char*)&ncf->nak_src_nla_afi); /* group nla */ pgm_sockaddr_to_nla (nak_grp_nla, (AF_INET6 == nak_src_nla->sa_family) ? (char*)&ncf6->nak6_grp_nla_afi : (char*)&ncf->nak_grp_nla_afi ); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, FALSE, /* not rate limited */ NULL, TRUE, /* with router alert */ buf, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; /* fall through silently on other errors */ pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)tpdu_length); return TRUE; } /* A NCF packet with a OPT_NAK_LIST option extension * * on success, TRUE is returned. on error, FALSE is returned. */ static bool send_ncf_list ( pgm_sock_t* const restrict sock, const struct sockaddr* const restrict nak_src_nla, const struct sockaddr* const restrict nak_grp_nla, struct pgm_sqn_list_t* const restrict sqn_list, /* will change to network-order */ const bool is_parity /* send parity NCF */ ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_nak *ncf; struct pgm_nak6 *ncf6; struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; struct pgm_opt_nak_list *opt_nak_list; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != nak_src_nla); pgm_assert (NULL != nak_grp_nla); pgm_assert (sqn_list->len > 1); pgm_assert (sqn_list->len <= 63); pgm_assert (nak_src_nla->sa_family == nak_grp_nla->sa_family); #ifdef SOURCE_DEBUG char saddr[INET6_ADDRSTRLEN], gaddr[INET6_ADDRSTRLEN]; char list[1024]; pgm_sockaddr_ntop (nak_src_nla, saddr, sizeof(saddr)); pgm_sockaddr_ntop (nak_grp_nla, gaddr, sizeof(gaddr)); sprintf (list, "%" PRIu32, sqn_list->sqn[0]); for (uint_fast8_t i = 1; i < sqn_list->len; i++) { char sequence[ 2 + strlen("4294967295") ]; sprintf (sequence, " %" PRIu32, sqn_list->sqn[i]); strcat (list, sequence); } pgm_debug ("send_ncf_list (sock:%p nak-src-nla:%s nak-grp-nla:%s sqn-list:[%s] is-parity:%s)", (void*)sock, saddr, gaddr, list, is_parity ? "TRUE": "FALSE" ); #endif tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_opt_length) + /* includes header */ sizeof(struct pgm_opt_header) + sizeof(uint8_t) + ( (sqn_list->len-1) * sizeof(uint32_t) ); tpdu_length += (AF_INET == nak_src_nla->sa_family) ? sizeof(struct pgm_nak) : sizeof(struct pgm_nak6); buf = pgm_alloca (tpdu_length); header = (struct pgm_header*)buf; ncf = (struct pgm_nak *)(header + 1); ncf6 = (struct pgm_nak6*)(header + 1); memcpy (header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); header->pgm_sport = sock->tsi.sport; header->pgm_dport = sock->dport; header->pgm_type = PGM_NCF; header->pgm_options = is_parity ? (PGM_OPT_PRESENT | PGM_OPT_NETWORK | PGM_OPT_PARITY) : (PGM_OPT_PRESENT | PGM_OPT_NETWORK); header->pgm_tsdu_length = 0; /* NCF */ ncf->nak_sqn = htonl (sqn_list->sqn[0]); /* source nla */ pgm_sockaddr_to_nla (nak_src_nla, (char*)&ncf->nak_src_nla_afi); /* group nla */ pgm_sockaddr_to_nla (nak_grp_nla, (AF_INET6 == nak_src_nla->sa_family) ? (char*)&ncf6->nak6_grp_nla_afi : (char*)&ncf->nak_grp_nla_afi ); /* OPT_NAK_LIST */ opt_len = (AF_INET6 == nak_src_nla->sa_family) ? (struct pgm_opt_length*)(ncf6 + 1) : (struct pgm_opt_length*)(ncf + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ((uint16_t)(sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(uint8_t) + ( (sqn_list->len-1) * sizeof(uint32_t) ))); opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_NAK_LIST | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(uint8_t) + ( (sqn_list->len-1) * sizeof(uint32_t) ); opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); opt_nak_list->opt_reserved = 0; /* to network-order */ for (uint_fast8_t i = 1; i < sqn_list->len; i++) opt_nak_list->opt_sqn[i-1] = htonl (sqn_list->sqn[i]); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, FALSE, /* not rate limited */ NULL, TRUE, /* with router alert */ buf, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; /* fall through silently on other errors */ pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)tpdu_length); return TRUE; } /* cancel any pending heartbeat SPM and schedule a new one */ static void reset_heartbeat_spm ( pgm_sock_t*const sock, const pgm_time_t now ) { pgm_mutex_lock (&sock->timer_mutex); const pgm_time_t next_poll = sock->next_poll; const pgm_time_t spm_heartbeat_interval = sock->spm_heartbeat_interval[ sock->spm_heartbeat_state = 1 ]; sock->next_heartbeat_spm = now + spm_heartbeat_interval; if (pgm_time_after( next_poll, sock->next_heartbeat_spm )) { sock->next_poll = sock->next_heartbeat_spm; if (!sock->is_pending_read) { pgm_notify_send (&sock->pending_notify); sock->is_pending_read = TRUE; } } pgm_mutex_unlock (&sock->timer_mutex); } /* state helper for resuming sends */ #define STATE(x) (sock->pkt_dontwait_state.x) /* send one PGM data packet, transmit window owned memory. * * On success, returns PGM_IO_STATUS_NORMAL and the number of data bytes pushed * into the transmit window and attempted to send to the socket layer is saved * into bytes_written. On non-blocking sockets, PGM_IO_STATUS_WOULD_BLOCK is * returned if the send would block. PGM_IO_STATUS_RATE_LIMITED is returned if * the packet sizes would exceed the current rate limit. * * ! always returns successful if data is pushed into the transmit window, even if * sendto() double fails ¡ we don't want the application to try again as that is the * reliable socks role. */ static int send_odata ( pgm_sock_t* const restrict sock, struct pgm_sk_buff_t* const restrict skb, size_t* restrict bytes_written ) { void *data; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_assert (skb->len <= sock->max_tsdu); pgm_debug ("send_odata (sock:%p skb:%p bytes-written:%p)", (void*)sock, (void*)skb, (void*)bytes_written); const uint16_t tsdu_length = skb->len; const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; const size_t tpdu_length = tsdu_length + pgm_pkt_offset (FALSE, pgmcc_family); /* continue if send would block */ if (sock->is_apdu_eagain) { STATE(skb)->tstamp = pgm_time_update_now(); goto retry_send; } /* add PGM header to skbuff */ STATE(skb) = pgm_skb_get(skb); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->head; STATE(skb)->pgm_data = (struct pgm_data*)(STATE(skb)->pgm_header + 1); memcpy (STATE(skb)->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); STATE(skb)->pgm_header->pgm_sport = sock->tsi.sport; STATE(skb)->pgm_header->pgm_dport = sock->dport; STATE(skb)->pgm_header->pgm_type = PGM_ODATA; STATE(skb)->pgm_header->pgm_options = sock->use_pgmcc ? PGM_OPT_PRESENT : 0; STATE(skb)->pgm_header->pgm_tsdu_length = htons (tsdu_length); /* ODATA */ STATE(skb)->pgm_data->data_sqn = htonl (pgm_txw_next_lead(sock->window)); STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); STATE(skb)->pgm_header->pgm_checksum = 0; data = STATE(skb)->pgm_data + 1; if (sock->use_pgmcc) { struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; struct pgm_opt_pgmcc_data *pgmcc_data; struct pgm_opt6_pgmcc_data *pgmcc_data6; opt_len = data; opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ((uint16_t)(sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + ((AF_INET6 == sock->acker_nla.ss_family) ? sizeof(struct pgm_opt6_pgmcc_data) : sizeof(struct pgm_opt_pgmcc_data)) )); opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_PGMCC_DATA | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + ((AF_INET6 == sock->acker_nla.ss_family) ? sizeof(struct pgm_opt6_pgmcc_data) : sizeof(struct pgm_opt_pgmcc_data)); pgmcc_data = (struct pgm_opt_pgmcc_data *)(opt_header + 1); pgmcc_data6 = (struct pgm_opt6_pgmcc_data*)(opt_header + 1); pgmcc_data->opt_tstamp = htonl ((uint32_t)pgm_to_msecs (STATE(skb)->tstamp)); /* acker nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&sock->acker_nla, (char*)&pgmcc_data->opt_nla_afi); if (AF_INET6 == sock->acker_nla.ss_family) data = (char*)pgmcc_data6 + sizeof(struct pgm_opt6_pgmcc_data); else data = (char*)pgmcc_data + sizeof(struct pgm_opt_pgmcc_data); } const size_t pgm_header_len = (char*)data - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); STATE(unfolded_odata) = pgm_csum_partial (data, (uint16_t)tsdu_length, 0); STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, STATE(skb)); pgm_spinlock_unlock (&sock->txw_spinlock); /* check rate limit at last moment */ STATE(is_rate_limited) = FALSE; if (sock->is_nonblocking && sock->is_controlled_odata) { if (!pgm_rate_check2 (&sock->rate_control, /* total rate limit */ &sock->odata_rate_control, /* original data limit */ tpdu_length, /* excludes IP header len */ sock->is_nonblocking)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; return PGM_IO_STATUS_RATE_LIMITED; } STATE(is_rate_limited) = TRUE; } /* the transmit window MUST check the user count to ensure it does not * attempt to send a repair-data packet based on in transit original data. */ retry_send: /* congestion control */ if (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) { // pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Token limit reached.")); sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; return PGM_IO_STATUS_CONGESTION; /* peer expiration to re-elect ACKer */ } sent = pgm_sendto (sock, !STATE(is_rate_limited), /* rate limit on blocking */ &sock->odata_rate_control, FALSE, /* regular socket */ STATE(skb)->head, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { const int save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; } /* fall through silently on other errors */ } /* save unfolded odata for retransmissions */ pgm_txw_set_unfolded_checksum (STATE(skb), STATE(unfolded_odata)); sock->is_apdu_eagain = FALSE; reset_heartbeat_spm (sock, STATE(skb)->tstamp); if (sock->use_pgmcc) { sock->tokens -= pgm_fp8 (1); sock->ack_expiry = STATE(skb)->tstamp + sock->ack_expiry_ivl; } if (PGM_LIKELY((size_t)sent == tpdu_length)) { sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += tsdu_length; sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] ++; pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)(tpdu_length + sock->iphdr_len)); } /* check for end of transmission group */ if (sock->use_proactive_parity) { const uint32_t odata_sqn = ntohl (STATE(skb)->pgm_data->data_sqn); const uint32_t tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; if (!((odata_sqn + 1) & ~tg_sqn_mask)) pgm_schedule_proactive_nak (sock, odata_sqn & tg_sqn_mask); } /* remove applications reference to skbuff */ pgm_free_skb (STATE(skb)); if (bytes_written) *bytes_written = tsdu_length; return PGM_IO_STATUS_NORMAL; } /* send one PGM original data packet, callee owned memory. * * on success, returns PGM_IO_STATUS_NORMAL, on block for non-blocking sockets * returns PGM_IO_STATUS_WOULD_BLOCK, returns PGM_IO_STATUS_RATE_LIMITED if * packet size exceeds the current rate limit. */ static int send_odata_copy ( pgm_sock_t* const restrict sock, const void* restrict tsdu, const uint16_t tsdu_length, size_t* restrict bytes_written ) { void *data; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (tsdu_length <= sock->max_tsdu); if (PGM_LIKELY(tsdu_length)) pgm_assert (NULL != tsdu); pgm_debug ("send_odata_copy (sock:%p tsdu:%p tsdu_length:%u bytes-written:%p)", (void*)sock, tsdu, tsdu_length, (void*)bytes_written); const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; const size_t tpdu_length = tsdu_length + pgm_pkt_offset (FALSE, pgmcc_family); /* continue if blocked mid-apdu, updating timestamp */ if (sock->is_apdu_eagain) { STATE(skb)->tstamp = pgm_time_update_now(); goto retry_send; } STATE(skb) = pgm_alloc_skb (sock->max_tpdu); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); pgm_skb_reserve (STATE(skb), (uint16_t)pgm_pkt_offset (FALSE, pgmcc_family)); pgm_skb_put (STATE(skb), (uint16_t)tsdu_length); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->head; STATE(skb)->pgm_data = (struct pgm_data*)(STATE(skb)->pgm_header + 1); memcpy (STATE(skb)->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); STATE(skb)->pgm_header->pgm_sport = sock->tsi.sport; STATE(skb)->pgm_header->pgm_dport = sock->dport; STATE(skb)->pgm_header->pgm_type = PGM_ODATA; STATE(skb)->pgm_header->pgm_options = sock->use_pgmcc ? PGM_OPT_PRESENT : 0; STATE(skb)->pgm_header->pgm_tsdu_length = htons (tsdu_length); /* ODATA */ STATE(skb)->pgm_data->data_sqn = htonl (pgm_txw_next_lead(sock->window)); STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); STATE(skb)->pgm_header->pgm_checksum = 0; data = STATE(skb)->pgm_data + 1; if (sock->use_pgmcc) { struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; struct pgm_opt_pgmcc_data *pgmcc_data; /* unused */ // struct pgm_opt6_pgmcc_data *pgmcc_data6; opt_len = data; opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ((uint16_t)(sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + ((AF_INET6 == sock->acker_nla.ss_family) ? sizeof(struct pgm_opt6_pgmcc_data) : sizeof(struct pgm_opt_pgmcc_data)) )); opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_PGMCC_DATA | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + ((AF_INET6 == sock->acker_nla.ss_family) ? sizeof(struct pgm_opt6_pgmcc_data) : sizeof(struct pgm_opt_pgmcc_data)); pgmcc_data = (struct pgm_opt_pgmcc_data *)(opt_header + 1); // pgmcc_data6 = (struct pgm_opt6_pgmcc_data*)(opt_header + 1); pgmcc_data->opt_reserved = 0; pgmcc_data->opt_tstamp = htonl ((uint32_t)pgm_to_msecs (STATE(skb)->tstamp)); /* acker nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&sock->acker_nla, (char*)&pgmcc_data->opt_nla_afi); data = (char*)opt_header + opt_header->opt_length; } const size_t pgm_header_len = (char*)data - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); STATE(unfolded_odata) = pgm_csum_partial_copy (tsdu, data, (uint16_t)tsdu_length, 0); STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, STATE(skb)); pgm_spinlock_unlock (&sock->txw_spinlock); /* check rate limit at last moment */ STATE(is_rate_limited) = FALSE; if (sock->is_nonblocking && sock->is_controlled_odata) { if (!pgm_rate_check2 (&sock->rate_control, /* total rate limit */ &sock->odata_rate_control, /* original data limit */ tpdu_length, /* excludes IP header len */ sock->is_nonblocking)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; return PGM_IO_STATUS_RATE_LIMITED; } STATE(is_rate_limited) = TRUE; } retry_send: /* congestion control */ if (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) { // pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Token limit reached.")); sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; return PGM_IO_STATUS_CONGESTION; } sent = pgm_sendto (sock, !STATE(is_rate_limited), /* rate limit on blocking */ &sock->odata_rate_control, FALSE, /* regular socket */ STATE(skb)->head, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { const int save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; } /* fall through silently on other errors */ } if (sock->use_pgmcc) { sock->tokens -= pgm_fp8 (1); pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("PGMCC tokens-- (T:%u W:%u)"), pgm_fp8tou (sock->tokens), pgm_fp8tou (sock->cwnd_size)); sock->ack_expiry = STATE(skb)->tstamp + sock->ack_expiry_ivl; } /* save unfolded odata for retransmissions */ pgm_txw_set_unfolded_checksum (STATE(skb), STATE(unfolded_odata)); sock->is_apdu_eagain = FALSE; reset_heartbeat_spm (sock, STATE(skb)->tstamp); if (PGM_LIKELY((size_t)sent == tpdu_length)) { sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += tsdu_length; sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] ++; pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)(tpdu_length + sock->iphdr_len)); } /* check for end of transmission group */ if (sock->use_proactive_parity) { const uint32_t odata_sqn = ntohl (STATE(skb)->pgm_data->data_sqn); const uint32_t tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; if (!((odata_sqn + 1) & ~tg_sqn_mask)) pgm_schedule_proactive_nak (sock, odata_sqn & tg_sqn_mask); } /* return data payload length sent */ if (bytes_written) *bytes_written = tsdu_length; return PGM_IO_STATUS_NORMAL; } /* send one PGM original data packet, callee owned scatter/gather io vector * * ⎢ DATA₀ ⎢ * ⎢ DATA₁ ⎢ → send_odatav() → ⎢ TSDU₀ ⎢ → libc * ⎢ ⋮ ⎢ * * on success, returns PGM_IO_STATUS_NORMAL, on block for non-blocking sockets * returns PGM_IO_STATUS_WOULD_BLOCK, returns PGM_IO_STATUS_RATE_LIMITED if * packet size exceeds the current rate limit. */ static int send_odatav ( pgm_sock_t* const restrict sock, const struct pgm_iovec* const restrict vector, const unsigned count, /* number of items in vector */ size_t* restrict bytes_written ) { char *dst; size_t tpdu_length; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (count <= PGM_MAX_FRAGMENTS); if (PGM_LIKELY(count)) pgm_assert (NULL != vector); pgm_debug ("send_odatav (sock:%p vector:%p count:%u bytes-written:%p)", (const void*)sock, (const void*)vector, count, (const void*)bytes_written); if (PGM_UNLIKELY(0 == count)) return send_odata_copy (sock, NULL, 0, bytes_written); /* continue if blocked on send */ if (sock->is_apdu_eagain) { pgm_assert ((char*)STATE(skb)->tail > (char*)STATE(skb)->head); tpdu_length = (char*)STATE(skb)->tail - (char*)STATE(skb)->head; goto retry_send; } STATE(tsdu_length) = 0; for (unsigned i = 0; i < count; i++) { #ifdef TRANSPORT_DEBUG if (PGM_LIKELY(vector[i].iov_len)) { pgm_assert( vector[i].iov_base ); } #endif STATE(tsdu_length) += vector[i].iov_len; } pgm_return_val_if_fail (STATE(tsdu_length) <= sock->max_tsdu, PGM_IO_STATUS_ERROR); STATE(skb) = pgm_alloc_skb (sock->max_tpdu); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; pgm_skb_reserve (STATE(skb), (uint16_t)pgm_pkt_offset (FALSE, pgmcc_family)); pgm_skb_put (STATE(skb), (uint16_t)STATE(tsdu_length)); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->data; STATE(skb)->pgm_data = (struct pgm_data*)(STATE(skb)->pgm_header + 1); memcpy (STATE(skb)->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); STATE(skb)->pgm_header->pgm_sport = sock->tsi.sport; STATE(skb)->pgm_header->pgm_dport = sock->dport; STATE(skb)->pgm_header->pgm_type = PGM_ODATA; STATE(skb)->pgm_header->pgm_options = 0; STATE(skb)->pgm_header->pgm_tsdu_length = htons ((uint16_t)STATE(tsdu_length)); /* ODATA */ STATE(skb)->pgm_data->data_sqn = htonl (pgm_txw_next_lead(sock->window)); STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); STATE(skb)->pgm_header->pgm_checksum = 0; const size_t pgm_header_len = (char*)(STATE(skb)->pgm_data + 1) - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); /* unroll first iteration to make friendly branch prediction */ dst = (char*)(STATE(skb)->pgm_data + 1); STATE(unfolded_odata) = pgm_csum_partial_copy ((const char*)vector[0].iov_base, dst, (uint16_t)vector[0].iov_len, 0); /* iterate over one or more vector elements to perform scatter/gather checksum & copy */ for (unsigned i = 1; i < count; i++) { dst += vector[i-1].iov_len; const uint32_t unfolded_element = pgm_csum_partial_copy ((const char*)vector[i].iov_base, dst, (uint16_t)vector[i].iov_len, 0); STATE(unfolded_odata) = pgm_csum_block_add (STATE(unfolded_odata), unfolded_element, (uint16_t)vector[i-1].iov_len); } STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, STATE(skb)); pgm_spinlock_unlock (&sock->txw_spinlock); pgm_assert ((char*)STATE(skb)->tail > (char*)STATE(skb)->head); tpdu_length = (char*)STATE(skb)->tail - (char*)STATE(skb)->head; /* check rate limit at last moment */ STATE(is_rate_limited) = FALSE; if (sock->is_nonblocking && sock->is_controlled_odata) { if (!pgm_rate_check2 (&sock->rate_control, /* total rate limit */ &sock->odata_rate_control, /* original data limit */ tpdu_length, /* excludes IP header len */ sock->is_nonblocking)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; return PGM_IO_STATUS_RATE_LIMITED; } STATE(is_rate_limited) = TRUE; } retry_send: sent = pgm_sendto (sock, !STATE(is_rate_limited), /* rate limit on blocking */ &sock->odata_rate_control, FALSE, /* regular socket */ STATE(skb)->head, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { const int save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; } /* fall through silently on other errors */ } /* save unfolded odata for retransmissions */ pgm_txw_set_unfolded_checksum (STATE(skb), STATE(unfolded_odata)); sock->is_apdu_eagain = FALSE; reset_heartbeat_spm (sock, STATE(skb)->tstamp); if (PGM_LIKELY((size_t)sent == STATE(skb)->len)) { sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += STATE(tsdu_length); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] ++; pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)(tpdu_length + sock->iphdr_len)); } /* check for end of transmission group */ if (sock->use_proactive_parity) { const uint32_t odata_sqn = ntohl (STATE(skb)->pgm_data->data_sqn); const uint32_t tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; if (!((odata_sqn + 1) & ~tg_sqn_mask)) pgm_schedule_proactive_nak (sock, odata_sqn & tg_sqn_mask); } /* return data payload length sent */ if (bytes_written) *bytes_written = STATE(tsdu_length); return PGM_IO_STATUS_NORMAL; } /* send PGM original data, callee owned memory. if larger than maximum TPDU * size will be fragmented. * * on success, returns PGM_IO_STATUS_NORMAL, on block for non-blocking sockets * returns PGM_IO_STATUS_WOULD_BLOCK, returns PGM_IO_STATUS_RATE_LIMITED if * packet size exceeds the current rate limit. */ static int send_apdu ( pgm_sock_t* const restrict sock, const void* restrict apdu, const size_t apdu_length, size_t* restrict bytes_written ) { size_t bytes_sent = 0; /* counted at IP layer */ unsigned packets_sent = 0; /* IP packets */ size_t data_bytes_sent = 0; int save_errno; pgm_assert (NULL != sock); pgm_assert (NULL != apdu); const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; /* continue if blocked mid-apdu */ if (sock->is_apdu_eagain) goto retry_send; /* if non-blocking calculate total wire size and check rate limit */ STATE(is_rate_limited) = FALSE; if (sock->is_nonblocking && sock->is_controlled_odata) { const size_t header_length = pgm_pkt_offset (TRUE, pgmcc_family); size_t tpdu_length = 0; size_t offset_ = 0; do { const uint_fast16_t tsdu_length = (uint_fast16_t)MIN( source_max_tsdu (sock, TRUE), apdu_length - offset_ ); tpdu_length += sock->iphdr_len + header_length + tsdu_length; offset_ += tsdu_length; } while (offset_ < apdu_length); if (!pgm_rate_check2 (&sock->rate_control, &sock->odata_rate_control, tpdu_length - sock->iphdr_len, /* includes 1 × IP header len */ sock->is_nonblocking)) { sock->blocklen = tpdu_length; return PGM_IO_STATUS_RATE_LIMITED; } STATE(is_rate_limited) = TRUE; } STATE(data_bytes_offset) = 0; STATE(first_sqn) = pgm_txw_next_lead(sock->window); do { size_t tpdu_length, header_length; struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; ssize_t sent; /* retrieve packet storage from transmit window */ header_length = pgm_pkt_offset (TRUE, pgmcc_family); STATE(tsdu_length) = MIN( source_max_tsdu (sock, TRUE), apdu_length - STATE(data_bytes_offset) ); STATE(skb) = pgm_alloc_skb (sock->max_tpdu); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); pgm_skb_reserve (STATE(skb), (uint16_t)header_length); pgm_skb_put (STATE(skb), (uint16_t)STATE(tsdu_length)); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->head; STATE(skb)->pgm_data = (struct pgm_data*)(STATE(skb)->pgm_header + 1); memcpy (STATE(skb)->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); STATE(skb)->pgm_header->pgm_sport = sock->tsi.sport; STATE(skb)->pgm_header->pgm_dport = sock->dport; STATE(skb)->pgm_header->pgm_type = PGM_ODATA; STATE(skb)->pgm_header->pgm_options = PGM_OPT_PRESENT; STATE(skb)->pgm_header->pgm_tsdu_length = htons ((uint16_t)STATE(tsdu_length)); /* ODATA */ STATE(skb)->pgm_data->data_sqn = htonl (pgm_txw_next_lead(sock->window)); STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); /* OPT_LENGTH */ opt_len = (struct pgm_opt_length*)(STATE(skb)->pgm_data + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ((uint16_t)(sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment))); /* OPT_FRAGMENT */ opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_FRAGMENT | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); STATE(skb)->pgm_opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); STATE(skb)->pgm_opt_fragment->opt_reserved = 0; STATE(skb)->pgm_opt_fragment->opt_sqn = htonl (STATE(first_sqn)); STATE(skb)->pgm_opt_fragment->opt_frag_off = htonl ((uint32_t)STATE(data_bytes_offset)); STATE(skb)->pgm_opt_fragment->opt_frag_len = htonl ((uint32_t)apdu_length); /* TODO: the assembly checksum & copy routine is faster than memcpy & pgm_cksum on >= opteron hardware */ STATE(skb)->pgm_header->pgm_checksum = 0; const size_t pgm_header_len = (char*)(STATE(skb)->pgm_opt_fragment + 1) - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); STATE(unfolded_odata) = pgm_csum_partial_copy ((const char*)apdu + STATE(data_bytes_offset), STATE(skb)->pgm_opt_fragment + 1, (uint16_t)STATE(tsdu_length), 0); STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, STATE(skb)); pgm_spinlock_unlock (&sock->txw_spinlock); retry_send: pgm_assert ((char*)STATE(skb)->tail > (char*)STATE(skb)->head); tpdu_length = (char*)STATE(skb)->tail - (char*)STATE(skb)->head; sent = pgm_sendto (sock, !STATE(is_rate_limited), /* rate limit on blocking */ &sock->odata_rate_control, FALSE, /* regular socket */ STATE(skb)->head, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; goto blocked; } /* fall through silently on other errors */ } /* save unfolded odata for retransmissions */ pgm_txw_set_unfolded_checksum (STATE(skb), STATE(unfolded_odata)); if (PGM_LIKELY((size_t)sent == tpdu_length)) { bytes_sent += tpdu_length + sock->iphdr_len; /* as counted at IP layer */ packets_sent++; /* IP packets */ data_bytes_sent += STATE(tsdu_length); } STATE(data_bytes_offset) += STATE(tsdu_length); /* check for end of transmission group */ if (sock->use_proactive_parity) { const uint32_t odata_sqn = ntohl (STATE(skb)->pgm_data->data_sqn); const uint32_t tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; if (!((odata_sqn + 1) & ~tg_sqn_mask)) pgm_schedule_proactive_nak (sock, odata_sqn & tg_sqn_mask); } } while ( STATE(data_bytes_offset) < apdu_length); pgm_assert( STATE(data_bytes_offset) == apdu_length ); sock->is_apdu_eagain = FALSE; reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; if (bytes_written) *bytes_written = apdu_length; return PGM_IO_STATUS_NORMAL; blocked: if (bytes_sent) { reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; } if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; } /* Send one APDU, whether it fits within one TPDU or more. * * on success, returns PGM_IO_STATUS_NORMAL, on block for non-blocking sockets * returns PGM_IO_STATUS_WOULD_BLOCK, returns PGM_IO_STATUS_RATE_LIMITED if * packet size exceeds the current rate limit. */ int pgm_send ( pgm_sock_t* const restrict sock, const void* restrict apdu, const size_t apdu_length, size_t* restrict bytes_written ) { pgm_debug ("pgm_send (sock:%p apdu:%p apdu-length:%" PRIzu " bytes-written:%p)", (void*)sock, apdu, apdu_length, (void*)bytes_written); /* parameters */ pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR); if (PGM_LIKELY(apdu_length)) pgm_return_val_if_fail (NULL != apdu, PGM_IO_STATUS_ERROR); /* shutdown */ if (PGM_UNLIKELY(!pgm_rwlock_reader_trylock (&sock->lock))) pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); /* state */ if (PGM_UNLIKELY(!sock->is_bound || sock->is_destroyed || apdu_length > sock->max_apdu)) { pgm_rwlock_reader_unlock (&sock->lock); pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); } /* source */ pgm_mutex_lock (&sock->source_mutex); /* pass on non-fragment calls */ if (apdu_length <= sock->max_tsdu) { const int status = send_odata_copy (sock, apdu, (uint16_t)apdu_length, bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } else { const int status = send_apdu (sock, apdu, (uint16_t)apdu_length, bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } } /* send PGM original data, callee owned scatter/gather IO vector. if larger than maximum TPDU * size will be fragmented. * * is_one_apdu = true: * * ⎢ DATA₀ ⎢ * ⎢ DATA₁ ⎢ → pgm_sendv() → ⎢ ⋯ TSDU₁ TSDU₀ ⎢ → libc * ⎢ ⋮ ⎢ * * is_one_apdu = false: * * ⎢ APDU₀ ⎢ ⎢ ⋯ TSDU₁,₀ TSDU₀,₀ ⎢ * ⎢ APDU₁ ⎢ → pgm_sendv() → ⎢ ⋯ TSDU₁,₁ TSDU₀,₁ ⎢ → libc * ⎢ ⋮ ⎢ ⎢ ⋮ ⋮ ⎢ * * on success, returns PGM_IO_STATUS_NORMAL, on block for non-blocking sockets * returns PGM_IO_STATUS_WOULD_BLOCK, returns PGM_IO_STATUS_RATE_LIMITED if * packet size exceeds the current rate limit. */ int pgm_sendv ( pgm_sock_t* const restrict sock, const struct pgm_iovec* const restrict vector, const unsigned count, /* number of items in vector */ const bool is_one_apdu, /* true = vector = apdu, false = vector::iov_base = apdu */ size_t* restrict bytes_written ) { unsigned packets_sent = 0; size_t bytes_sent = 0; size_t data_bytes_sent = 0; int save_errno; pgm_debug ("pgm_sendv (sock:%p vector:%p count:%u is-one-apdu:%s bytes-written:%p)", (const void*)sock, (const void*)vector, count, is_one_apdu ? "TRUE" : "FALSE", (const void*)bytes_written); pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR); pgm_return_val_if_fail (count <= PGM_MAX_FRAGMENTS, PGM_IO_STATUS_ERROR); if (PGM_LIKELY(count)) pgm_return_val_if_fail (NULL != vector, PGM_IO_STATUS_ERROR); if (PGM_UNLIKELY(!pgm_rwlock_reader_trylock (&sock->lock))) pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); if (PGM_UNLIKELY(!sock->is_bound || sock->is_destroyed)) { pgm_rwlock_reader_unlock (&sock->lock); pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); } pgm_mutex_lock (&sock->source_mutex); /* pass on zero length as cannot count vector lengths */ if (PGM_UNLIKELY(0 == count)) { const int status = send_odata_copy (sock, NULL, 0, bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; /* continue if blocked mid-apdu */ if (sock->is_apdu_eagain) { if (is_one_apdu) { if (STATE(apdu_length) <= sock->max_tsdu) { const int status = send_odatav (sock, vector, count, bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } else goto retry_one_apdu_send; } else { goto retry_send; } } /* calculate (total) APDU length */ STATE(apdu_length) = 0; for (unsigned i = 0; i < count; i++) { #ifdef TRANSPORT_DEBUG if (PGM_LIKELY(vector[i].iov_len)) { pgm_assert( vector[i].iov_base ); } #endif if (!is_one_apdu && vector[i].iov_len > sock->max_apdu) { pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); } STATE(apdu_length) += vector[i].iov_len; } /* pass on non-fragment calls */ if (is_one_apdu) { if (STATE(apdu_length) <= sock->max_tsdu) { const int status = send_odatav (sock, vector, count, bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } else if (STATE(apdu_length) > sock->max_apdu) { pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); } } /* non-fragmented packets can be forwarded onto basic send() */ if (!is_one_apdu) { for (STATE(data_pkt_offset) = 0; STATE(data_pkt_offset) < count; STATE(data_pkt_offset)++) { int status; size_t wrote_bytes; retry_send: status = send_apdu (sock, vector[STATE(data_pkt_offset)].iov_base, vector[STATE(data_pkt_offset)].iov_len, &wrote_bytes); switch (status) { case PGM_IO_STATUS_NORMAL: break; case PGM_IO_STATUS_WOULD_BLOCK: case PGM_IO_STATUS_RATE_LIMITED: sock->is_apdu_eagain = TRUE; pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; case PGM_IO_STATUS_ERROR: pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; default: pgm_assert_not_reached(); } data_bytes_sent += wrote_bytes; } sock->is_apdu_eagain = FALSE; if (bytes_written) *bytes_written = data_bytes_sent; pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_NORMAL; } /* if non-blocking calculate total wire size and check rate limit */ STATE(is_rate_limited) = FALSE; if (sock->is_nonblocking && sock->is_controlled_odata) { const size_t header_length = pgm_pkt_offset (TRUE, pgmcc_family); size_t tpdu_length = 0; size_t offset_ = 0; do { const uint_fast16_t tsdu_length = (uint_fast16_t)MIN( source_max_tsdu (sock, TRUE), STATE(apdu_length) - offset_ ); tpdu_length += sock->iphdr_len + header_length + tsdu_length; offset_ += tsdu_length; } while (offset_ < STATE(apdu_length)); if (!pgm_rate_check2 (&sock->rate_control, &sock->odata_rate_control, tpdu_length - sock->iphdr_len, /* includes 1 × IP header len */ sock->is_nonblocking)) { sock->blocklen = tpdu_length; pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_RATE_LIMITED; } STATE(is_rate_limited) = TRUE; } STATE(data_bytes_offset) = 0; STATE(vector_index) = 0; STATE(vector_offset) = 0; STATE(first_sqn) = pgm_txw_next_lead(sock->window); do { size_t tpdu_length, header_length; struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; const char *src; char *dst; size_t src_length, dst_length, copy_length; ssize_t sent; /* retrieve packet storage from transmit window */ header_length = pgm_pkt_offset (TRUE, pgmcc_family); STATE(tsdu_length) = MIN( source_max_tsdu (sock, TRUE), STATE(apdu_length) - STATE(data_bytes_offset) ); STATE(skb) = pgm_alloc_skb (sock->max_tpdu); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); pgm_skb_reserve (STATE(skb), (uint16_t)header_length); pgm_skb_put (STATE(skb), (uint16_t)STATE(tsdu_length)); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->head; STATE(skb)->pgm_data = (struct pgm_data*)(STATE(skb)->pgm_header + 1); memcpy (STATE(skb)->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); STATE(skb)->pgm_header->pgm_sport = sock->tsi.sport; STATE(skb)->pgm_header->pgm_dport = sock->dport; STATE(skb)->pgm_header->pgm_type = PGM_ODATA; STATE(skb)->pgm_header->pgm_options = PGM_OPT_PRESENT; STATE(skb)->pgm_header->pgm_tsdu_length = htons ((uint16_t)STATE(tsdu_length)); /* ODATA */ STATE(skb)->pgm_data->data_sqn = htonl (pgm_txw_next_lead(sock->window)); STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); /* OPT_LENGTH */ opt_len = (struct pgm_opt_length*)(STATE(skb)->pgm_data + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ((uint16_t)(sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment))); /* OPT_FRAGMENT */ opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_FRAGMENT | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); STATE(skb)->pgm_opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); STATE(skb)->pgm_opt_fragment->opt_reserved = 0; STATE(skb)->pgm_opt_fragment->opt_sqn = htonl (STATE(first_sqn)); STATE(skb)->pgm_opt_fragment->opt_frag_off = htonl ((uint32_t)STATE(data_bytes_offset)); STATE(skb)->pgm_opt_fragment->opt_frag_len = htonl ((uint32_t)STATE(apdu_length)); /* checksum & copy */ STATE(skb)->pgm_header->pgm_checksum = 0; const size_t pgm_header_len = (char*)(STATE(skb)->pgm_opt_fragment + 1) - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)pgm_header_len, 0); /* iterate over one or more vector elements to perform scatter/gather checksum & copy * * STATE(vector_index) - index into application scatter/gather vector * STATE(vector_offset) - current offset into current vector element * STATE(unfolded_odata)- checksum accumulator */ src = (const char*)vector[STATE(vector_index)].iov_base + STATE(vector_offset); dst = (char*)(STATE(skb)->pgm_opt_fragment + 1); src_length = vector[STATE(vector_index)].iov_len - STATE(vector_offset); dst_length = 0; copy_length = MIN( STATE(tsdu_length), src_length ); STATE(unfolded_odata) = pgm_csum_partial_copy (src, dst, (uint16_t)copy_length, 0); for(;;) { if (copy_length == src_length) { /* application packet complete */ STATE(vector_index)++; STATE(vector_offset) = 0; } else { /* data still remaining */ STATE(vector_offset) += copy_length; } dst_length += copy_length; /* sock packet complete */ if (dst_length == STATE(tsdu_length)) break; src = (const char*)vector[STATE(vector_index)].iov_base + STATE(vector_offset); dst += copy_length; src_length = vector[STATE(vector_index)].iov_len - STATE(vector_offset); copy_length = MIN( STATE(tsdu_length) - dst_length, src_length ); const uint32_t unfolded_element = pgm_csum_partial_copy (src, dst, (uint16_t)copy_length, 0); STATE(unfolded_odata) = pgm_csum_block_add (STATE(unfolded_odata), unfolded_element, (uint16_t)dst_length); } STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)pgm_header_len)); /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, STATE(skb)); pgm_spinlock_unlock (&sock->txw_spinlock); retry_one_apdu_send: tpdu_length = (char*)STATE(skb)->tail - (char*)STATE(skb)->head; sent = pgm_sendto (sock, !STATE(is_rate_limited), /* rate limited on blocking */ &sock->odata_rate_control, FALSE, /* regular socket */ STATE(skb)->head, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; goto blocked; } /* fall through silently on other errors */ } /* save unfolded odata for retransmissions */ pgm_txw_set_unfolded_checksum (STATE(skb), STATE(unfolded_odata)); if (PGM_LIKELY((size_t)sent == tpdu_length)) { bytes_sent += tpdu_length + sock->iphdr_len; /* as counted at IP layer */ packets_sent++; /* IP packets */ data_bytes_sent += STATE(tsdu_length); } STATE(data_bytes_offset) += STATE(tsdu_length); /* check for end of transmission group */ if (sock->use_proactive_parity) { const uint32_t odata_sqn = ntohl (STATE(skb)->pgm_data->data_sqn); const uint32_t tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; if (!((odata_sqn + 1) & ~tg_sqn_mask)) pgm_schedule_proactive_nak (sock, odata_sqn & tg_sqn_mask); } } while ( STATE(data_bytes_offset) < STATE(apdu_length) ); pgm_assert( STATE(data_bytes_offset) == STATE(apdu_length) ); sock->is_apdu_eagain = FALSE; reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; if (bytes_written) *bytes_written = STATE(apdu_length); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_NORMAL; blocked: if (bytes_sent) { reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; } pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; } /* send PGM original data, transmit window owned scatter/gather IO vector. * * ⎢ TSDU₀ ⎢ * ⎢ TSDU₁ ⎢ → pgm_send_skbv() → ⎢ ⋯ TSDU₁ TSDU₀ ⎢ → libc * ⎢ ⋮ ⎢ * * on success, returns PGM_IO_STATUS_NORMAL, on block for non-blocking sockets * returns PGM_IO_STATUS_WOULD_BLOCK, returns PGM_IO_STATUS_RATE_LIMITED if * packet size exceeds the current rate limit. */ int pgm_send_skbv ( pgm_sock_t* const restrict sock, struct pgm_sk_buff_t** const restrict vector, /* array of skb pointers vs. array of skbs */ const unsigned count, const bool is_one_apdu, /* true: vector = apdu, false: vector::iov_base = apdu */ size_t* restrict bytes_written ) { unsigned packets_sent = 0; size_t bytes_sent = 0; size_t data_bytes_sent = 0; int save_errno; pgm_debug ("pgm_send_skbv (sock:%p vector:%p count:%u is-one-apdu:%s bytes-written:%p)", (const void*)sock, (const void*)vector, count, is_one_apdu ? "TRUE" : "FALSE", (const void*)bytes_written); pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR); pgm_return_val_if_fail (count <= PGM_MAX_FRAGMENTS, PGM_IO_STATUS_ERROR); if (PGM_LIKELY(count)) pgm_return_val_if_fail (NULL != vector, PGM_IO_STATUS_ERROR); if (PGM_UNLIKELY(!pgm_rwlock_reader_trylock (&sock->lock))) pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); if (PGM_UNLIKELY(!sock->is_bound || sock->is_destroyed)) { pgm_rwlock_reader_unlock (&sock->lock); pgm_return_val_if_reached (PGM_IO_STATUS_ERROR); } pgm_mutex_lock (&sock->source_mutex); /* pass on zero length as cannot count vector lengths */ if (PGM_UNLIKELY(0 == count)) { const int status = send_odata_copy (sock, NULL, 0, bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } else if (1 == count) { const int status = send_odata (sock, vector[0], bytes_written); pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return status; } const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; /* continue if blocked mid-apdu */ if (sock->is_apdu_eagain) goto retry_send; STATE(is_rate_limited) = FALSE; if (sock->is_nonblocking && sock->is_controlled_odata) { size_t total_tpdu_length = 0; for (unsigned i = 0; i < count; i++) total_tpdu_length += sock->iphdr_len + pgm_pkt_offset (is_one_apdu, pgmcc_family) + vector[i]->len; if (!pgm_rate_check2 (&sock->rate_control, &sock->odata_rate_control, total_tpdu_length - sock->iphdr_len, /* includes 1 × IP header len */ sock->is_nonblocking)) { sock->blocklen = total_tpdu_length; pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_RATE_LIMITED; } STATE(is_rate_limited) = TRUE; } if (is_one_apdu) { STATE(apdu_length) = 0; STATE(first_sqn) = pgm_txw_next_lead(sock->window); for (unsigned i = 0; i < count; i++) { if (PGM_UNLIKELY(vector[i]->len > sock->max_tsdu_fragment)) { pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_ERROR; } STATE(apdu_length) += vector[i]->len; } if (PGM_UNLIKELY(STATE(apdu_length) > sock->max_apdu)) { pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_ERROR; } } for (STATE(vector_index) = 0; STATE(vector_index) < count; STATE(vector_index)++) { size_t tpdu_length; ssize_t sent; STATE(tsdu_length) = vector[STATE(vector_index)]->len; STATE(skb) = pgm_skb_get(vector[STATE(vector_index)]); STATE(skb)->sock = sock; STATE(skb)->tstamp = pgm_time_update_now(); STATE(skb)->pgm_header = (struct pgm_header*)STATE(skb)->head; STATE(skb)->pgm_data = (struct pgm_data*)(STATE(skb)->pgm_header + 1); memcpy (STATE(skb)->pgm_header->pgm_gsi, &sock->tsi.gsi, sizeof(pgm_gsi_t)); STATE(skb)->pgm_header->pgm_sport = sock->tsi.sport; STATE(skb)->pgm_header->pgm_dport = sock->dport; STATE(skb)->pgm_header->pgm_type = PGM_ODATA; STATE(skb)->pgm_header->pgm_options = is_one_apdu ? PGM_OPT_PRESENT : 0; STATE(skb)->pgm_header->pgm_tsdu_length = htons ((uint16_t)STATE(tsdu_length)); /* ODATA */ STATE(skb)->pgm_data->data_sqn = htonl (pgm_txw_next_lead(sock->window)); STATE(skb)->pgm_data->data_trail = htonl (pgm_txw_trail(sock->window)); if (is_one_apdu) { struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; /* OPT_LENGTH */ opt_len = (struct pgm_opt_length*)(STATE(skb)->pgm_data + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ((uint16_t)(sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment))); /* OPT_FRAGMENT */ opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_FRAGMENT | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_fragment); STATE(skb)->pgm_opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); STATE(skb)->pgm_opt_fragment->opt_reserved = 0; STATE(skb)->pgm_opt_fragment->opt_sqn = htonl (STATE(first_sqn)); STATE(skb)->pgm_opt_fragment->opt_frag_off = htonl ((uint32_t)STATE(data_bytes_offset)); STATE(skb)->pgm_opt_fragment->opt_frag_len = htonl ((uint32_t)STATE(apdu_length)); pgm_assert (STATE(skb)->data == (STATE(skb)->pgm_opt_fragment + 1)); } else { pgm_assert (STATE(skb)->data == (STATE(skb)->pgm_data + 1)); } /* TODO: the assembly checksum & copy routine is faster than memcpy & pgm_cksum on >= opteron hardware */ STATE(skb)->pgm_header->pgm_checksum = 0; pgm_assert ((char*)STATE(skb)->data > (char*)STATE(skb)->pgm_header); const size_t header_length = (char*)STATE(skb)->data - (char*)STATE(skb)->pgm_header; const uint32_t unfolded_header = pgm_csum_partial (STATE(skb)->pgm_header, (uint16_t)header_length, 0); STATE(unfolded_odata) = pgm_csum_partial ((char*)STATE(skb)->data, (uint16_t)STATE(tsdu_length), 0); STATE(skb)->pgm_header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, STATE(unfolded_odata), (uint16_t)header_length)); /* add to transmit window, skb::data set to payload */ pgm_spinlock_lock (&sock->txw_spinlock); pgm_txw_add (sock->window, STATE(skb)); pgm_spinlock_unlock (&sock->txw_spinlock); retry_send: pgm_assert ((char*)STATE(skb)->tail > (char*)STATE(skb)->head); tpdu_length = (char*)STATE(skb)->tail - (char*)STATE(skb)->head; sent = pgm_sendto (sock, !STATE(is_rate_limited), /* rate limited on blocking */ &sock->odata_rate_control, FALSE, /* regular socket */ STATE(skb)->head, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->is_apdu_eagain = TRUE; sock->blocklen = tpdu_length + sock->iphdr_len; goto blocked; } /* fall through silently on other errors */ } /* save unfolded odata for retransmissions */ pgm_txw_set_unfolded_checksum (STATE(skb), STATE(unfolded_odata)); if (PGM_LIKELY((size_t)sent == tpdu_length)) { bytes_sent += tpdu_length + sock->iphdr_len; /* as counted at IP layer */ packets_sent++; /* IP packets */ data_bytes_sent += STATE(tsdu_length); } pgm_free_skb (STATE(skb)); STATE(data_bytes_offset) += STATE(tsdu_length); /* check for end of transmission group */ if (sock->use_proactive_parity) { const uint32_t odata_sqn = ntohl (STATE(skb)->pgm_data->data_sqn); const uint32_t tg_sqn_mask = 0xffffffff << sock->tg_sqn_shift; if (!((odata_sqn + 1) & ~tg_sqn_mask)) pgm_schedule_proactive_nak (sock, odata_sqn & tg_sqn_mask); } } #ifdef TRANSPORT_DEBUG if (is_one_apdu) { pgm_assert( STATE(data_bytes_offset) == STATE(apdu_length) ); } #endif sock->is_apdu_eagain = FALSE; reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; if (bytes_written) *bytes_written = data_bytes_sent; pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); return PGM_IO_STATUS_NORMAL; blocked: if (bytes_sent) { reset_heartbeat_spm (sock, STATE(skb)->tstamp); pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)bytes_sent); sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT] += packets_sent; sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT] += data_bytes_sent; } pgm_mutex_unlock (&sock->source_mutex); pgm_rwlock_reader_unlock (&sock->lock); if (PGM_SOCK_ENOBUFS == save_errno) return PGM_IO_STATUS_RATE_LIMITED; if (sock->use_pgmcc) pgm_notify_clear (&sock->ack_notify); return PGM_IO_STATUS_WOULD_BLOCK; } /* cleanup resuming send state helper */ #undef STATE /* send repair packet. * * on success, TRUE is returned. on error, FALSE is returned. */ static bool send_rdata ( pgm_sock_t* restrict sock, struct pgm_sk_buff_t* restrict skb ) { size_t tpdu_length; struct pgm_header *header; struct pgm_data *rdata; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != skb); pgm_assert ((char*)skb->tail > (char*)skb->head); tpdu_length = (char*)skb->tail - (char*)skb->head; /* rate check including rdata specific limits */ if (sock->is_controlled_rdata && !pgm_rate_check2 (&sock->rate_control, /* total rate limit */ &sock->rdata_rate_control, /* repair data limit */ tpdu_length, /* excludes IP header len */ sock->is_nonblocking)) { sock->blocklen = tpdu_length + sock->iphdr_len; return FALSE; } /* update previous odata/rdata contents */ header = skb->pgm_header; rdata = skb->pgm_data; header->pgm_type = PGM_RDATA; /* RDATA */ rdata->data_trail = htonl (pgm_txw_trail(sock->window)); header->pgm_checksum = 0; const size_t header_length = tpdu_length - ntohs(header->pgm_tsdu_length); const uint32_t unfolded_header = pgm_csum_partial (header, (uint16_t)header_length, 0); const uint32_t unfolded_odata = pgm_txw_get_unfolded_checksum (skb); header->pgm_checksum = pgm_csum_fold (pgm_csum_block_add (unfolded_header, unfolded_odata, (uint16_t)header_length)); /* congestion control */ if (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) { // pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Token limit reached.")); sock->blocklen = tpdu_length + sock->iphdr_len; return FALSE; } sent = pgm_sendto (sock, FALSE, /* already rate limited */ &sock->rdata_rate_control, TRUE, /* with router alert */ header, tpdu_length, (struct sockaddr*)&sock->send_gsr.gsr_group, pgm_sockaddr_len((struct sockaddr*)&sock->send_gsr.gsr_group)); if (sent < 0) { const int save_errno = pgm_get_last_sock_error(); if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno || PGM_SOCK_ENOBUFS == save_errno)) { sock->blocklen = tpdu_length + sock->iphdr_len; return FALSE; } /* fall through silently on other errors */ } const pgm_time_t now = pgm_time_update_now(); if (sock->use_pgmcc) { sock->tokens -= pgm_fp8 (1); sock->ack_expiry = now + sock->ack_expiry_ivl; } /* re-set spm timer: we are already in the timer thread, no need to prod timers */ pgm_mutex_lock (&sock->timer_mutex); sock->spm_heartbeat_state = 1; sock->next_heartbeat_spm = now + sock->spm_heartbeat_interval[sock->spm_heartbeat_state++]; pgm_mutex_unlock (&sock->timer_mutex); pgm_txw_inc_retransmit_count (skb); sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED] += ntohs(header->pgm_tsdu_length); sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED]++; /* impossible to determine APDU count */ pgm_atomic_add32 (&sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT], (uint32_t)(tpdu_length + sock->iphdr_len)); return TRUE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/packet_parse.c0000644000175000017500000004636311640407354020364 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM packet formats, RFC 3208. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include //#define PACKET_DEBUG #ifndef PACKET_DEBUG # define PGM_DISABLE_ASSERT #endif /* locals */ static bool pgm_parse (struct pgm_sk_buff_t*const restrict, pgm_error_t**restrict); /* Parse a raw-IP packet for IP and PGM header and any payload. */ #define PGM_MIN_SIZE ( \ sizeof(struct pgm_ip) + /* IPv4 header */ \ sizeof(struct pgm_header) /* PGM header */ \ ) PGM_GNUC_INTERNAL bool pgm_parse_raw ( struct pgm_sk_buff_t* const restrict skb, /* data will be modified */ struct sockaddr* const restrict dst, pgm_error_t** restrict error ) { /* pre-conditions */ pgm_assert (NULL != skb); pgm_assert (NULL != dst); pgm_debug ("pgm_parse_raw (skb:%p dst:%p error:%p)", (const void*)skb, (const void*)dst, (const void*)error); /* minimum size should be IPv4 header plus PGM header, check IP version later */ if (PGM_UNLIKELY(skb->len < PGM_MIN_SIZE)) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("IP packet too small at %" PRIu16 " bytes, expecting at least %" PRIu16 " bytes."), skb->len, (uint16_t)PGM_MIN_SIZE); return FALSE; } /* IP packet header: IPv4 * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |Version| HL | ToS | Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Fragment ID |R|D|M| Fragment Offset | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | TTL | Protocol | Checksum | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source IP Address | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Destination IP Address | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | IP Options when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+ ... * | Data ... * +-+-+- ... * * IPv6 * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |Version| Traffic Class | Flow Label | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Payload Length | Next Header | Hop Limit | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | * | Source IP Address | * | | * | | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | * | Destination IP Address | * | | * | | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | IP Options when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+ ... * | Data ... * +-+-+- ... * */ /* decode IP header */ const struct pgm_ip* ip = (struct pgm_ip*)skb->data; switch (ip->ip_v) { case 4: { struct sockaddr_in* sin = (struct sockaddr_in*)dst; sin->sin_family = AF_INET; sin->sin_addr.s_addr = ip->ip_dst.s_addr; break; } case 6: pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_AFNOSUPPORT, _("IPv6 is not supported for raw IP header parsing.")); return FALSE; default: pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_AFNOSUPPORT, _("IP header reports an invalid version %d."), ip->ip_v); return FALSE; } const size_t ip_header_length = ip->ip_hl * 4; /* IP header length in 32bit octets */ if (PGM_UNLIKELY(ip_header_length < sizeof(struct pgm_ip))) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("IP header reports an invalid header length %" PRIzu " bytes."), ip_header_length); return FALSE; } #ifndef CONFIG_HOST_ORDER_IP_LEN size_t packet_length = ntohs (ip->ip_len); /* total packet length */ #else size_t packet_length = ip->ip_len; /* total packet length */ #endif /* ip_len can equal packet_length - ip_header_length in FreeBSD/NetBSD * Stevens/Fenner/Rudolph, Unix Network Programming Vol.1, p.739 * * RFC3828 allows partial packets such that len < packet_length with UDP lite */ if (skb->len == packet_length + ip_header_length) { packet_length += ip_header_length; } if (PGM_UNLIKELY(skb->len < packet_length)) { /* redundant: often handled in kernel */ pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("IP packet received at %" PRIu16 " bytes whilst IP header reports %" PRIzu " bytes."), skb->len, packet_length); return FALSE; } /* packets that fail checksum will generally not be passed upstream except with rfc3828 */ #ifdef PGM_CHECK_IN_CKSUM const uint16_t sum = in_cksum (data, packet_length, 0); if (PGM_UNLIKELY(0 != sum)) { const uint16_t ip_sum = ntohs (ip->ip_sum); pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_CKSUM, _("IP packet checksum mismatch, reported 0x%x whilst calculated 0x%x."), ip_sum, sum); return FALSE; } #endif /* fragmentation offset, bit 0: 0, bit 1: do-not-fragment, bit 2: more-fragments */ #ifndef CONFIG_HOST_ORDER_IP_OFF const uint16_t offset = ntohs (ip->ip_off); #else const uint16_t offset = ip->ip_off; #endif if (PGM_UNLIKELY((offset & 0x1fff) != 0)) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_PROTO, _("IP header reports packet fragmentation, offset %u."), offset & 0x1fff); return FALSE; } /* PGM payload, header looks as follows: * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source Port | Destination Port | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Type | Options | Checksum | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Global Source ID ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | ... Global Source ID | TSDU Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Type specific data ... * +-+-+-+-+-+-+-+-+-+- ... */ skb->pgm_header = (void*)( (char*)skb->data + ip_header_length ); /* advance DATA pointer to PGM packet */ skb->data = skb->pgm_header; skb->len -= ip_header_length; return pgm_parse (skb, error); } PGM_GNUC_INTERNAL bool pgm_parse_udp_encap ( struct pgm_sk_buff_t*const restrict skb, /* will be modified */ pgm_error_t** restrict error ) { pgm_assert (NULL != skb); if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_header))) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_BOUNDS, _("UDP payload too small for PGM packet at %" PRIu16 " bytes, expecting at least %" PRIzu " bytes."), skb->len, sizeof(struct pgm_header)); return FALSE; } /* DATA payload is PGM packet, no headers */ skb->pgm_header = skb->data; return pgm_parse (skb, error); } /* will modify packet contents to calculate and check PGM checksum */ static bool pgm_parse ( struct pgm_sk_buff_t*const restrict skb, /* will be modified to calculate checksum */ pgm_error_t** restrict error ) { /* pre-conditions */ pgm_assert (NULL != skb); /* pgm_checksum == 0 means no transmitted checksum */ if (skb->pgm_header->pgm_checksum) { const uint16_t sum = skb->pgm_header->pgm_checksum; skb->pgm_header->pgm_checksum = 0; const uint16_t pgm_sum = pgm_csum_fold (pgm_csum_partial ((const char*)skb->pgm_header, skb->len, 0)); skb->pgm_header->pgm_checksum = sum; if (PGM_UNLIKELY(pgm_sum != sum)) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_CKSUM, _("PGM packet checksum mismatch, reported 0x%x whilst calculated 0x%x."), pgm_sum, sum); return FALSE; } } else { if (PGM_ODATA == skb->pgm_header->pgm_type || PGM_RDATA == skb->pgm_header->pgm_type) { pgm_set_error (error, PGM_ERROR_DOMAIN_PACKET, PGM_ERROR_PROTO, _("PGM checksum missing whilst mandatory for %cDATA packets."), PGM_ODATA == skb->pgm_header->pgm_type ? 'O' : 'R'); return FALSE; } pgm_debug ("No PGM checksum :O"); } /* copy packets source transport identifier */ memcpy (&skb->tsi.gsi, skb->pgm_header->pgm_gsi, sizeof(pgm_gsi_t)); skb->tsi.sport = skb->pgm_header->pgm_sport; return TRUE; } /* 8.1. Source Path Messages (SPM) * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | SPM's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Trailing Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Leading Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Path NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * NLA = Network Layer Address * NLA AFI = NLA Address Family Indicator: rfc 1700 (ADDRESS FAMILY NUMBERS) * => Path NLA = IP address of last network element */ #define PGM_MIN_SPM_SIZE ( sizeof(struct pgm_spm) ) PGM_GNUC_INTERNAL bool pgm_verify_spm ( const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); const struct pgm_spm* spm = (const struct pgm_spm*)skb->data; switch (ntohs (spm->spm_nla_afi)) { /* truncated packet */ case AFI_IP6: if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_spm6))) return FALSE; break; case AFI_IP: if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_spm))) return FALSE; break; default: return FALSE; } return TRUE; } /* 14.7.1. Poll Request * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLL's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLL's Round | POLL's Sub-type | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Path NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | POLL's Back-off Interval | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Random String | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Matching Bit-Mask | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Sent to ODATA multicast group with IP Router Alert option. */ #define PGM_MIN_POLL_SIZE ( sizeof(struct pgm_poll) ) PGM_GNUC_INTERNAL bool pgm_verify_poll ( const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); const struct pgm_poll* poll4 = (const struct pgm_poll*)skb->data; switch (ntohs (poll4->poll_nla_afi)) { /* truncated packet */ case AFI_IP6: if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_poll6))) return FALSE; break; case AFI_IP: if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_poll))) return FALSE; break; default: return FALSE; } return TRUE; } /* 14.7.2. Poll Response * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLR's Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | POLR's Round | reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ PGM_GNUC_INTERNAL bool pgm_verify_polr ( const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); /* truncated packet */ if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_polr))) return FALSE; return TRUE; } /* 8.2. Data Packet * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Data Packet Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Trailing Edge Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... -+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Data ... * +-+-+- ... */ /* no verification api */ /* 8.3. NAK * * Technically the AFI of the source and multicast group can be different * but that would be very wibbly wobbly. One example is using a local DLR * with a IPv4 address to reduce NAK cost for recovery on wide IPv6 * distribution. * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Requested Sequence Number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Source NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | NLA AFI | Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Multicast Group NLA ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ #define PGM_MIN_NAK_SIZE ( sizeof(struct pgm_nak) ) PGM_GNUC_INTERNAL bool pgm_verify_nak ( const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); pgm_debug ("pgm_verify_nak (skb:%p)", (const void*)skb); /* truncated packet */ if (PGM_UNLIKELY(skb->len < PGM_MIN_NAK_SIZE)) return FALSE; const struct pgm_nak* nak = (struct pgm_nak*)skb->data; const uint16_t nak_src_nla_afi = ntohs (nak->nak_src_nla_afi); uint16_t nak_grp_nla_afi = 0; /* check source NLA: unicast address of the ODATA sender */ switch (nak_src_nla_afi) { case AFI_IP: nak_grp_nla_afi = ntohs (nak->nak_grp_nla_afi); break; case AFI_IP6: nak_grp_nla_afi = ntohs (((const struct pgm_nak6*)nak)->nak6_grp_nla_afi); break; default: return FALSE; } /* check multicast group NLA */ switch (nak_grp_nla_afi) { case AFI_IP6: switch (nak_src_nla_afi) { /* IPv4 + IPv6 NLA */ case AFI_IP: if (PGM_UNLIKELY(skb->len < ( sizeof(struct pgm_nak) + sizeof(struct in6_addr) - sizeof(struct in_addr) ))) return FALSE; break; /* IPv6 + IPv6 NLA */ case AFI_IP6: if (PGM_UNLIKELY(skb->len < sizeof(struct pgm_nak6))) return FALSE; break; } case AFI_IP: break; default: return FALSE; } return TRUE; } /* 8.3. N-NAK */ PGM_GNUC_INTERNAL bool pgm_verify_nnak ( const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); return pgm_verify_nak (skb); } /* 8.3. NCF */ PGM_GNUC_INTERNAL bool pgm_verify_ncf ( const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); return pgm_verify_nak (skb); } /* 13.6. SPM Request * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ PGM_GNUC_INTERNAL bool pgm_verify_spmr ( PGM_GNUC_UNUSED const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); return TRUE; } /* PGMCC: ACK * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | RX_MAX | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Received Packet Bitmap | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Option Extensions when present ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ... */ #define PGM_MIN_ACK_SIZE ( sizeof(struct pgm_ack) ) PGM_GNUC_INTERNAL bool pgm_verify_ack ( PGM_GNUC_UNUSED const struct pgm_sk_buff_t*const skb ) { /* pre-conditions */ pgm_assert (NULL != skb); return TRUE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/rxw.c.c89.patch0000644000175000017500000002535111640407354020235 0ustar locallocal--- rxw.c 2011-03-12 10:59:30.000000000 +0800 +++ rxw.c89.c 2011-03-12 10:59:08.000000000 +0800 @@ -194,10 +194,11 @@ } pgm_debug ("create (tsi:%s max-tpdu:%" PRIu16 " sqns:%" PRIu32 " secs %u max-rte %" PRIzd " ack-c_p %" PRIu32 ")", - pgm_tsi_print (tsi), tpdu_size, sqns, secs, max_rte, ack_c_p); + pgm_tsi_print (tsi), tpdu_size, sqns, secs, (long)max_rte, ack_c_p); /* calculate receive window parameters */ pgm_assert (sqns || (secs && max_rte)); + { const unsigned alloc_sqns = sqns ? sqns : (unsigned)( (secs * max_rte) / tpdu_size ); window = pgm_malloc0 (sizeof(pgm_rxw_t) + ( alloc_sqns * sizeof(struct pgm_sk_buff_t*) )); @@ -233,6 +234,7 @@ pgm_assert (!pgm_rxw_is_full (window)); return window; + } } /* destructor for receive window. must not be called more than once for same window. @@ -368,6 +370,7 @@ return _pgm_rxw_insert (window, skb); } + { const struct pgm_sk_buff_t* const first_skb = _pgm_rxw_peek (window, _pgm_rxw_tg_sqn (window, skb->sequence)); const pgm_rxw_state_t* const first_state = (pgm_rxw_state_t*)&first_skb->cb; @@ -382,6 +385,7 @@ pgm_assert (NULL != first_state); status = _pgm_rxw_add_placeholder_range (window, _pgm_rxw_tg_sqn (window, skb->sequence), now, nak_rb_expiry); + } } else { @@ -547,7 +551,9 @@ } /* remove all buffers between commit lead and advertised rxw_trail */ - for (uint32_t sequence = window->commit_lead; + { + uint32_t sequence; + for (sequence = window->commit_lead; pgm_uint32_gt (window->rxw_trail, sequence) && pgm_uint32_gte (window->lead, sequence); sequence++) { @@ -572,6 +578,7 @@ break; } } + } /* post-conditions: only after flush */ // pgm_assert (!pgm_rxw_is_full (window)); @@ -651,8 +658,10 @@ } /* add skb to window */ + { const uint_fast32_t index_ = skb->sequence % pgm_rxw_max_length (window); window->pdata[index_] = skb; + } pgm_rxw_state (window, skb, PGM_PKT_STATE_BACK_OFF); @@ -679,6 +688,7 @@ pgm_assert (pgm_uint32_gt (sequence, pgm_rxw_lead (window))); /* check bounds of commit window */ + { const uint32_t new_commit_sqns = ( 1 + sequence ) - window->trail; if ( !_pgm_rxw_commit_is_empty (window) && (new_commit_sqns >= pgm_rxw_max_length (window)) ) @@ -710,6 +720,7 @@ pgm_assert (!pgm_rxw_is_full (window)); return PGM_RXW_APPENDED; + } } /* update leading edge of receive window. @@ -787,22 +798,28 @@ if (!skb->pgm_opt_fragment) return FALSE; + { const uint32_t apdu_first_sqn = ntohl (skb->of_apdu_first_sqn); /* by definition, first fragment indicates APDU is available */ if (apdu_first_sqn == skb->sequence) return FALSE; + { const struct pgm_sk_buff_t* const first_skb = _pgm_rxw_peek (window, apdu_first_sqn); /* first fragment out-of-bounds */ if (NULL == first_skb) return TRUE; + { const pgm_rxw_state_t* first_state = (pgm_rxw_state_t*)&first_skb->cb; if (PGM_PKT_STATE_LOST_DATA == first_state->pkt_state) return TRUE; return FALSE; + } + } + } } /* return the first missing packet sequence in the specified transmission @@ -822,7 +839,9 @@ /* pre-conditions */ pgm_assert (NULL != window); - for (uint32_t i = tg_sqn, j = 0; j < window->tg_size; i++, j++) + { + uint32_t i, j; + for (i = tg_sqn, j = 0; j < window->tg_size; i++, j++) { skb = _pgm_rxw_peek (window, i); pgm_assert (NULL != skb); @@ -841,6 +860,7 @@ default: pgm_assert_not_reached(); break; } } + } return NULL; } @@ -868,6 +888,7 @@ if (skb->pgm_header->pgm_options & PGM_OPT_VAR_PKTLEN) return FALSE; + { const uint32_t tg_sqn = _pgm_rxw_tg_sqn (window, skb->sequence); if (tg_sqn == skb->sequence) return FALSE; @@ -880,6 +901,7 @@ return FALSE; return TRUE; + } } static inline @@ -914,6 +936,7 @@ if (!window->is_fec_available) return FALSE; + { const uint32_t tg_sqn = _pgm_rxw_tg_sqn (window, skb->sequence); if (tg_sqn == skb->sequence) return FALSE; @@ -926,6 +949,7 @@ return FALSE; return TRUE; + } } /* insert skb into window range, discard if duplicate. window will have placeholder, @@ -998,6 +1022,7 @@ } /* statistics */ + { const uint32_t fill_time = (uint32_t)(new_skb->tstamp - skb->tstamp); PGM_HISTOGRAM_TIMES("Rx.RepairTime", fill_time); PGM_HISTOGRAM_COUNTS("Rx.NakTransmits", state->nak_transmit_count); @@ -1022,8 +1047,10 @@ window->min_nak_transmit_count = state->nak_transmit_count; } } + } /* add packet to bitmap */ + { const uint_fast32_t pos = window->lead - new_skb->sequence; if (pos < 32) { window->bitmap |= 1 << pos; @@ -1034,9 +1061,12 @@ * x_{t-1} = 0 * ∴ s_t = (1 - α) × s_{t-1} */ + { const uint_fast32_t s = pgm_fp16pow (pgm_fp16 (1) - window->ack_c_p, pos); if (s > window->data_loss) window->data_loss = 0; else window->data_loss -= s; + } + } /* replace place holder skb with incoming skb */ memcpy (new_skb->cb, skb->cb, sizeof(skb->cb)); @@ -1044,8 +1074,10 @@ state->pkt_state = PGM_PKT_STATE_ERROR; _pgm_rxw_unlink (window, skb); pgm_free_skb (skb); + { const uint_fast32_t index_ = new_skb->sequence % pgm_rxw_max_length (window); window->pdata[index_] = new_skb; + } if (new_skb->pgm_header->pgm_options & PGM_OPT_PARITY) _pgm_rxw_state (window, new_skb, PGM_PKT_STATE_HAVE_PARITY); else @@ -1081,10 +1113,14 @@ memcpy (cb, skb->cb, sizeof(skb->cb)); memcpy (skb->cb, missing->cb, sizeof(skb->cb)); memcpy (missing->cb, cb, sizeof(skb->cb)); + { const uint32_t parity_index = skb->sequence % pgm_rxw_max_length (window); window->pdata[parity_index] = skb; + } + { const uint32_t missing_index = missing->sequence % pgm_rxw_max_length (window); window->pdata[missing_index] = missing; + } } /* skb advances the window lead. @@ -1147,11 +1183,13 @@ lost_skb->sequence = skb->sequence; /* add lost-placeholder skb to window */ + { const uint_fast32_t index_ = lost_skb->sequence % pgm_rxw_max_length (window); window->pdata[index_] = lost_skb; _pgm_rxw_state (window, lost_skb, PGM_PKT_STATE_LOST_DATA); return PGM_RXW_BOUNDS; + } } /* add skb to window */ @@ -1187,6 +1225,7 @@ /* pre-conditions */ pgm_assert (NULL != window); + { const uint32_t tg_sqn_of_commit_lead = _pgm_rxw_tg_sqn (window, window->commit_lead); while (!_pgm_rxw_commit_is_empty (window) && @@ -1194,6 +1233,7 @@ { _pgm_rxw_remove_trail (window); } + } } /* flush packets but instead of calling on_data append the contiguous data packets @@ -1366,8 +1406,8 @@ } } while (*pmsg <= msg_end && !_pgm_rxw_incoming_is_empty (window)); - window->bytes_delivered += bytes_read; - window->msgs_delivered += data_read; + window->bytes_delivered += (uint32_t)bytes_read; + window->msgs_delivered += (uint32_t)data_read; return data_read > 0 ? bytes_read : -1; } @@ -1406,7 +1446,7 @@ const uint32_t tg_sqn /* transmission group sequence */ ) { - struct pgm_sk_buff_t *skb; + struct pgm_sk_buff_t* skb; pgm_rxw_state_t *state; struct pgm_sk_buff_t **tg_skbs; pgm_gf8_t **tg_data, **tg_opts; @@ -1427,11 +1467,14 @@ skb = _pgm_rxw_peek (window, tg_sqn); pgm_assert (NULL != skb); + { const bool is_var_pktlen = skb->pgm_header->pgm_options & PGM_OPT_VAR_PKTLEN; const bool is_op_encoded = skb->pgm_header->pgm_options & PGM_OPT_PRESENT; const uint16_t parity_length = ntohs (skb->pgm_header->pgm_tsdu_length); - for (uint32_t i = tg_sqn, j = 0; i != (tg_sqn + window->rs.k); i++, j++) + { + uint32_t i, j; + for (i = tg_sqn, j = 0; i != (tg_sqn + window->rs.k); i++, j++) { skb = _pgm_rxw_peek (window, i); pgm_assert (NULL != skb); @@ -1485,6 +1528,7 @@ } } + } /* reconstruct payload */ pgm_rs_decode_parity_appended (&window->rs, @@ -1500,7 +1544,9 @@ sizeof(struct pgm_opt_fragment)); /* swap parity skbs with reconstructed skbs */ - for (uint_fast8_t i = 0; i < window->rs.k; i++) + { + uint_fast8_t i; + for (i = 0; i < window->rs.k; i++) { struct pgm_sk_buff_t* repair_skb; @@ -1515,17 +1561,22 @@ if (pktlen > parity_length) { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Invalid encoded variable packet length in reconstructed packet, dropping entire transmission group.")); pgm_free_skb (repair_skb); - for (uint_fast8_t j = i; j < window->rs.k; j++) + { + uint_fast8_t j; + for (j = i; j < window->rs.k; j++) { if (offsets[j] < window->rs.k) continue; pgm_rxw_lost (window, tg_skbs[offsets[j]]->sequence); } + } break; } + { const uint16_t padding = parity_length - pktlen; repair_skb->len -= padding; repair_skb->tail = (char*)repair_skb->tail - padding; + } } #ifdef PGM_DISABLE_ASSERT @@ -1534,6 +1585,8 @@ pgm_assert_cmpint (_pgm_rxw_insert (window, repair_skb), ==, PGM_RXW_INSERTED); #endif } + } + } } /* check every TPDU in an APDU and verify that the data has arrived @@ -1574,6 +1627,7 @@ return FALSE; } + { const size_t apdu_size = skb->pgm_opt_fragment ? ntohl (skb->of_apdu_len) : skb->len; const uint32_t tg_sqn = _pgm_rxw_tg_sqn (window, first_sequence); @@ -1585,7 +1639,9 @@ return FALSE; } - for (uint32_t sequence = first_sequence; + { + uint32_t sequence = first_sequence; + for (sequence = first_sequence; skb; skb = _pgm_rxw_peek (window, ++sequence)) { @@ -1657,6 +1713,8 @@ /* pending */ return FALSE; + } + } } /* read one APDU consisting of one or more TPDUs. target array is guaranteed @@ -1684,6 +1742,7 @@ skb = _pgm_rxw_peek (window, window->commit_lead); pgm_assert (NULL != skb); + { const size_t apdu_len = skb->pgm_opt_fragment ? ntohl (skb->of_apdu_len) : skb->len; pgm_assert_cmpuint (apdu_len, >=, skb->len); @@ -1704,6 +1763,7 @@ pgm_assert (!_pgm_rxw_commit_is_empty (window)); return contiguous_len; + } } /* returns transmission group sequence (TG_SQN) from sequence (SQN). @@ -1719,8 +1779,10 @@ /* pre-conditions */ pgm_assert (NULL != window); + { const uint32_t tg_sqn_mask = 0xffffffff << window->tg_sqn_shift; return sequence & tg_sqn_mask; + } } /* returns packet number (PKT_SQN) from sequence (SQN). @@ -1736,8 +1798,10 @@ /* pre-conditions */ pgm_assert (NULL != window); + { const uint32_t tg_sqn_mask = 0xffffffff << window->tg_sqn_shift; return sequence & ~tg_sqn_mask; + } } /* returns TRUE when the sequence is the first of a transmission group. @@ -2117,8 +2181,10 @@ skb->sequence = window->lead; state->timer_expiry = nak_rdata_expiry; + { const uint_fast32_t index_ = pgm_rxw_lead (window) % pgm_rxw_max_length (window); window->pdata[index_] = skb; + } _pgm_rxw_state (window, skb, PGM_PKT_STATE_WAIT_DATA); return PGM_RXW_APPENDED; @@ -2204,7 +2270,7 @@ window->cumulative_losses, window->bytes_delivered, window->msgs_delivered, - window->size, + (unsigned long)window->size, window->alloc ); } libpgm-5.1.118-1~dfsg/openpgm/pgm/receiver.c0000644000175000017500000020736111640407354017524 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM receiver socket. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include //#define RECEIVER_DEBUG //#define SPM_DEBUG #ifndef RECEIVER_DEBUG # define PGM_DISABLE_ASSERT #endif static bool send_spmr (pgm_sock_t*const restrict, pgm_peer_t*const restrict); static bool send_nak (pgm_sock_t*const restrict, pgm_peer_t*const restrict, const uint32_t); static bool send_parity_nak (pgm_sock_t*const restrict, pgm_peer_t*const restrict, const unsigned, const unsigned); static bool send_nak_list (pgm_sock_t*const restrict, pgm_peer_t*const restrict, const struct pgm_sqn_list_t*const restrict); static bool nak_rb_state (pgm_sock_t*restrict, pgm_peer_t*restrict, const pgm_time_t); static void nak_rpt_state (pgm_sock_t*restrict, pgm_peer_t*restrict, const pgm_time_t); static void nak_rdata_state (pgm_sock_t*restrict, pgm_peer_t*restrict, const pgm_time_t); static inline pgm_peer_t* _pgm_peer_ref (pgm_peer_t*); static bool on_general_poll (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict); static bool on_dlr_poll (pgm_sock_t*const restrict, pgm_peer_t*const restrict, struct pgm_sk_buff_t*const restrict); /* helpers for pgm_peer_t */ static inline pgm_time_t next_ack_rb_expiry ( const pgm_rxw_t* window ) { const struct pgm_peer_t* peer; pgm_assert (NULL != window); pgm_assert (NULL != window->ack_backoff_queue.tail); peer = (const struct pgm_peer_t*)window->ack_backoff_queue.tail; return peer->ack_rb_expiry; } static inline pgm_time_t next_nak_rb_expiry ( const pgm_rxw_t* window ) { const struct pgm_sk_buff_t* skb; const pgm_rxw_state_t* state; pgm_assert (NULL != window); pgm_assert (NULL != window->nak_backoff_queue.tail); skb = (const struct pgm_sk_buff_t*)window->nak_backoff_queue.tail; state = (const pgm_rxw_state_t*)&skb->cb; return state->timer_expiry; } static inline pgm_time_t next_nak_rpt_expiry ( const pgm_rxw_t* window ) { const struct pgm_sk_buff_t* skb; const pgm_rxw_state_t* state; pgm_assert (NULL != window); pgm_assert (NULL != window->wait_ncf_queue.tail); skb = (const struct pgm_sk_buff_t*)window->wait_ncf_queue.tail; state = (const pgm_rxw_state_t*)&skb->cb; return state->timer_expiry; } static inline pgm_time_t next_nak_rdata_expiry ( const pgm_rxw_t* window ) { const struct pgm_sk_buff_t* skb; const pgm_rxw_state_t* state; pgm_assert (NULL != window); pgm_assert (NULL != window->wait_data_queue.tail); skb = (const struct pgm_sk_buff_t*)window->wait_data_queue.tail; state = (const pgm_rxw_state_t*)&skb->cb; return state->timer_expiry; } /* calculate ACK_RB_IVL. */ static inline uint32_t ack_rb_ivl ( pgm_sock_t* sock ) /* not const as rand() updates the seed */ { /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (sock->use_pgmcc); pgm_assert_cmpuint (sock->ack_bo_ivl, >, 1); return pgm_rand_int_range (&sock->rand_, 1 /* us */, (int32_t)sock->ack_bo_ivl); } /* calculate NAK_RB_IVL as random time interval 1 - NAK_BO_IVL. */ static inline uint32_t nak_rb_ivl ( pgm_sock_t* sock ) /* not const as rand() updates the seed */ { /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert_cmpuint (sock->nak_bo_ivl, >, 1); return pgm_rand_int_range (&sock->rand_, 1 /* us */, (int32_t)sock->nak_bo_ivl); } /* mark sequence as recovery failed. */ static void cancel_skb ( pgm_sock_t* restrict sock, pgm_peer_t* restrict peer, const struct pgm_sk_buff_t* restrict skb, const pgm_time_t now ) { pgm_assert (NULL != sock); pgm_assert (NULL != peer); pgm_assert (NULL != skb); pgm_assert_cmpuint (now, >=, skb->tstamp); pgm_trace (PGM_LOG_ROLE_RX_WINDOW, _("Lost data #%u due to cancellation."), skb->sequence); const uint32_t fail_time = (uint32_t)(now - skb->tstamp); if (!peer->max_fail_time) peer->max_fail_time = peer->min_fail_time = fail_time; else if (fail_time > peer->max_fail_time) peer->max_fail_time = fail_time; else if (fail_time < peer->min_fail_time) peer->min_fail_time = fail_time; pgm_rxw_lost (peer->window, skb->sequence); PGM_HISTOGRAM_TIMES("Rx.FailTime", fail_time); /* mark receiver window for flushing on next recv() */ pgm_peer_set_pending (sock, peer); } /* check whether this receiver is the designated acker for the source */ static inline bool _pgm_is_acker ( const pgm_sock_t* restrict sock, const pgm_peer_t* restrict peer, const struct pgm_sk_buff_t* restrict skb ) { struct sockaddr_storage acker_nla; /* pre-conditions */ pgm_assert (NULL != peer); pgm_assert (NULL != skb); pgm_assert (NULL != skb->pgm_opt_pgmcc_data); pgm_nla_to_sockaddr (&skb->pgm_opt_pgmcc_data->opt_nla_afi, (struct sockaddr*)&acker_nla); return (0 == pgm_sockaddr_cmp ((struct sockaddr*)&acker_nla, (const struct sockaddr*)&sock->send_addr)); } /* is the source holding an acker election */ static inline bool _pgm_is_acker_election ( const struct pgm_sk_buff_t* restrict skb ) { pgm_assert (NULL != skb); pgm_assert (NULL != skb->pgm_opt_pgmcc_data); const unsigned acker_afi = ntohs (skb->pgm_opt_pgmcc_data->opt_nla_afi); switch (acker_afi) { case AFI_IP: if (INADDR_ANY == skb->pgm_opt_pgmcc_data->opt_nla.s_addr) return TRUE; break; case AFI_IP6: if (0 == memcmp (&skb->pgm_opt_pgmcc_data->opt_nla, &in6addr_any, sizeof(in6addr_any))) return TRUE; break; default: break; } return FALSE; } /* add state for an ACK on a data packet. */ static inline void _pgm_add_ack ( pgm_peer_t* const restrict peer, const pgm_time_t ack_rb_expiry ) { pgm_assert (NULL != peer); peer->ack_rb_expiry = ack_rb_expiry; pgm_queue_push_head_link (&peer->window->ack_backoff_queue, &peer->ack_link); } /* remove outstanding ACK */ static inline void _pgm_remove_ack ( pgm_peer_t* const restrict peer ) { pgm_assert (NULL != peer); pgm_assert (!pgm_queue_is_empty (&peer->window->ack_backoff_queue)); pgm_queue_unlink (&peer->window->ack_backoff_queue, &peer->ack_link); peer->ack_rb_expiry = 0; } /* increase reference count for peer object * * on success, returns peer object. */ static inline pgm_peer_t* _pgm_peer_ref ( pgm_peer_t* peer ) { /* pre-conditions */ pgm_assert (NULL != peer); pgm_atomic_inc32 (&peer->ref_count); return peer; } /* decrease reference count of peer object, destroying on last reference. */ PGM_GNUC_INTERNAL void pgm_peer_unref ( pgm_peer_t* peer ) { /* pre-conditions */ pgm_assert (NULL != peer); if (pgm_atomic_exchange_and_add32 (&peer->ref_count, (uint32_t)-1) != 1) return; /* receive window */ pgm_rxw_destroy (peer->window); peer->window = NULL; /* object */ pgm_free (peer); peer = NULL; } /* find PGM options in received SKB. * * returns TRUE if opt_fragment is found, otherwise FALSE is returned. */ static bool get_pgm_options ( struct pgm_sk_buff_t* const skb ) { struct pgm_opt_header* opt_header; bool found_opt = FALSE; /* pre-conditions */ pgm_assert (NULL != skb); pgm_assert (NULL != skb->pgm_data); opt_header = (struct pgm_opt_header*)(skb->pgm_data + 1); pgm_assert (opt_header->opt_type == PGM_OPT_LENGTH); pgm_assert (opt_header->opt_length == sizeof(struct pgm_opt_length)); pgm_debug ("get_pgm_options (skb:%p)", (const void*)skb); skb->pgm_opt_fragment = NULL; skb->pgm_opt_pgmcc_data = NULL; /* always at least two options, first is always opt_length */ do { opt_header = (struct pgm_opt_header*)((char*)opt_header + opt_header->opt_length); /* option overflow */ if (PGM_UNLIKELY((char*)opt_header > (char*)skb->data)) break; switch (opt_header->opt_type & PGM_OPT_MASK) { case PGM_OPT_FRAGMENT: skb->pgm_opt_fragment = (struct pgm_opt_fragment*)(opt_header + 1); found_opt = TRUE; break; case PGM_OPT_PGMCC_DATA: skb->pgm_opt_pgmcc_data = (struct pgm_opt_pgmcc_data*)(opt_header + 1); found_opt = TRUE; break; default: break; } } while (!(opt_header->opt_type & PGM_OPT_END)); return found_opt; } /* a peer in the context of the sock is another party on the network sending PGM * packets. for each peer we need a receive window and network layer address (nla) to * which nak requests can be forwarded to. * * on success, returns new peer object. */ PGM_GNUC_INTERNAL pgm_peer_t* pgm_new_peer ( pgm_sock_t* const restrict sock, const pgm_tsi_t* const restrict tsi, const struct sockaddr* const restrict src_addr, const socklen_t src_addrlen, const struct sockaddr* const restrict dst_addr, const socklen_t dst_addrlen, const pgm_time_t now ) { pgm_peer_t* peer; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != src_addr); pgm_assert (src_addrlen > 0); pgm_assert (NULL != dst_addr); pgm_assert (dst_addrlen > 0); #ifdef PGM_DEBUG char saddr[INET6_ADDRSTRLEN], daddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop (src_addr, saddr, sizeof(saddr)); pgm_sockaddr_ntop (dst_addr, daddr, sizeof(daddr)); pgm_debug ("pgm_new_peer (sock:%p tsi:%s src-addr:%s src-addrlen:%u dst-addr:%s dst-addrlen:%u)", (void*)sock, pgm_tsi_print (tsi), saddr, (unsigned)src_addrlen, daddr, (unsigned)dst_addrlen); #endif peer = pgm_new0 (pgm_peer_t, 1); peer->expiry = now + sock->peer_expiry; memcpy (&peer->tsi, tsi, sizeof(pgm_tsi_t)); memcpy (&peer->group_nla, dst_addr, dst_addrlen); memcpy (&peer->local_nla, src_addr, src_addrlen); /* port at same location for sin/sin6 */ ((struct sockaddr_in*)&peer->local_nla)->sin_port = htons (sock->udp_encap_ucast_port); ((struct sockaddr_in*)&peer->nla)->sin_port = htons (sock->udp_encap_ucast_port); /* lock on rx window */ peer->window = pgm_rxw_create (&peer->tsi, sock->max_tpdu, sock->rxw_sqns, sock->rxw_secs, sock->rxw_max_rte, sock->ack_c_p); peer->spmr_expiry = now + sock->spmr_expiry; /* add peer to hash table and linked list */ pgm_rwlock_writer_lock (&sock->peers_lock); pgm_hashtable_insert (sock->peers_hashtable, &peer->tsi, _pgm_peer_ref (peer)); peer->peers_link.data = peer; sock->peers_list = pgm_list_prepend_link (sock->peers_list, &peer->peers_link); pgm_rwlock_writer_unlock (&sock->peers_lock); pgm_timer_lock (sock); if (pgm_time_after( sock->next_poll, peer->spmr_expiry )) sock->next_poll = peer->spmr_expiry; pgm_timer_unlock (sock); return peer; } /* copy any contiguous buffers in the peer list to the provided * message vector. * returns -PGM_SOCK_ENOBUFS if the vector is full, returns -PGM_SOCK_ECONNRESET if * data loss is detected, returns 0 when all peers flushed. */ PGM_GNUC_INTERNAL int pgm_flush_peers_pending ( pgm_sock_t* const restrict sock, struct pgm_msgv_t** restrict pmsg, const struct pgm_msgv_t* const msg_end, /* at least pmsg + 1, same object */ size_t* const restrict bytes_read, /* added to, not set */ unsigned* const restrict data_read ) { int retval = 0; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != pmsg); pgm_assert (NULL != *pmsg); pgm_assert (NULL != msg_end); pgm_assert (NULL != bytes_read); pgm_assert (NULL != data_read); pgm_debug ("pgm_flush_peers_pending (sock:%p pmsg:%p msg-end:%p bytes-read:%p data-read:%p)", (const void*)sock, (const void*)pmsg, (const void*)msg_end, (const void*)bytes_read, (const void*)data_read); while (sock->peers_pending) { pgm_peer_t* peer = sock->peers_pending->data; if (peer->last_commit && peer->last_commit < sock->last_commit) pgm_rxw_remove_commit (peer->window); const ssize_t peer_bytes = pgm_rxw_readv (peer->window, pmsg, (unsigned)(msg_end - *pmsg + 1)); if (peer->last_cumulative_losses != ((pgm_rxw_t*)peer->window)->cumulative_losses) { sock->is_reset = TRUE; peer->lost_count = ((pgm_rxw_t*)peer->window)->cumulative_losses - peer->last_cumulative_losses; peer->last_cumulative_losses = ((pgm_rxw_t*)peer->window)->cumulative_losses; } if (peer_bytes >= 0) { (*bytes_read) += peer_bytes; (*data_read) ++; peer->last_commit = sock->last_commit; if (*pmsg > msg_end) { /* commit full */ retval = -PGM_SOCK_ENOBUFS; break; } } else peer->last_commit = 0; if (PGM_UNLIKELY(sock->is_reset)) { retval = -PGM_SOCK_ECONNRESET; break; } /* clear this reference and move to next */ sock->peers_pending = pgm_slist_remove_first (sock->peers_pending); } return retval; } /* edge trigerred has receiver pending events */ PGM_GNUC_INTERNAL bool pgm_peer_has_pending ( pgm_peer_t* const peer ) { /* pre-conditions */ pgm_assert (NULL != peer); if (NULL == peer->pending_link.data && ((pgm_rxw_t*)peer->window)->has_event) { ((pgm_rxw_t*)peer->window)->has_event = 0; return TRUE; } return FALSE; } /* set receiver in pending event queue */ PGM_GNUC_INTERNAL void pgm_peer_set_pending ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict peer ) { /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != peer); if (peer->pending_link.data) return; peer->pending_link.data = peer; sock->peers_pending = pgm_slist_prepend_link (sock->peers_pending, &peer->pending_link); } /* Create a new error SKB detailing data loss. */ PGM_GNUC_INTERNAL void pgm_set_reset_error ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, struct pgm_msgv_t* const restrict msgv ) { struct pgm_sk_buff_t* error_skb; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (NULL != msgv); error_skb = pgm_alloc_skb (0); error_skb->sock = sock; error_skb->tstamp = pgm_time_update_now (); memcpy (&error_skb->tsi, &source->tsi, sizeof(pgm_tsi_t)); error_skb->sequence = source->lost_count; msgv->msgv_skb[0] = error_skb; msgv->msgv_len = 1; } /* SPM indicate start of a session, continued presence of a session, or flushing final packets * of a session. * * returns TRUE on valid packet, FALSE on invalid packet or duplicate SPM sequence number. */ PGM_GNUC_INTERNAL bool pgm_on_spm ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, struct pgm_sk_buff_t* const restrict skb ) { const struct pgm_spm *spm; const struct pgm_spm6 *spm6; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (NULL != skb); pgm_debug("pgm_on_spm (sock:%p source:%p skb:%p)", (const void*)sock, (const void*)source, (const void*)skb); if (PGM_UNLIKELY(!pgm_verify_spm (skb))) { pgm_trace(PGM_LOG_ROLE_NETWORK,_("Discarded invalid SPM.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS]++; return FALSE; } spm = (struct pgm_spm *)skb->data; spm6 = (struct pgm_spm6*)skb->data; const uint32_t spm_sqn = ntohl (spm->spm_sqn); /* check for advancing sequence number, or first SPM */ if (PGM_LIKELY(pgm_uint32_gte (spm_sqn, source->spm_sqn))) { /* copy NLA for replies */ pgm_nla_to_sockaddr (&spm->spm_nla_afi, (struct sockaddr*)&source->nla); /* save sequence number */ source->spm_sqn = spm_sqn; /* update receive window */ const pgm_time_t nak_rb_expiry = skb->tstamp + nak_rb_ivl (sock); const unsigned naks = pgm_rxw_update (source->window, ntohl (spm->spm_lead), ntohl (spm->spm_trail), skb->tstamp, nak_rb_expiry); if (naks) { pgm_timer_lock (sock); if (pgm_time_after (sock->next_poll, nak_rb_expiry)) sock->next_poll = nak_rb_expiry; pgm_timer_unlock (sock); } /* mark receiver window for flushing on next recv() */ if (source->window->cumulative_losses != source->last_cumulative_losses && !source->pending_link.data) { sock->is_reset = TRUE; source->lost_count = source->window->cumulative_losses - source->last_cumulative_losses; source->last_cumulative_losses = source->window->cumulative_losses; pgm_peer_set_pending (sock, source); } } else { /* does not advance SPM sequence number */ pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded duplicate SPM.")); source->cumulative_stats[PGM_PC_RECEIVER_DUP_SPMS]++; return FALSE; } /* check whether peer can generate parity packets */ if (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { const struct pgm_opt_header* opt_header; const struct pgm_opt_length* opt_len; opt_len = (AF_INET6 == source->nla.ss_family) ? (const struct pgm_opt_length*)(spm6 + 1) : (const struct pgm_opt_length*)(spm + 1); if (PGM_UNLIKELY(opt_len->opt_type != PGM_OPT_LENGTH)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed SPM.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS]++; return FALSE; } if (PGM_UNLIKELY(opt_len->opt_length != sizeof(struct pgm_opt_length))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed SPM.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS]++; return FALSE; } /* TODO: check for > 16 options & past packet end */ opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); if ((opt_header->opt_type & PGM_OPT_MASK) == PGM_OPT_PARITY_PRM) { const struct pgm_opt_parity_prm* opt_parity_prm; opt_parity_prm = (const struct pgm_opt_parity_prm*)(opt_header + 1); if (PGM_UNLIKELY((opt_parity_prm->opt_reserved & PGM_PARITY_PRM_MASK) == 0)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed SPM.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS]++; return FALSE; } const uint32_t parity_prm_tgs = ntohl (opt_parity_prm->parity_prm_tgs); if (PGM_UNLIKELY(parity_prm_tgs < 2 || parity_prm_tgs > 128)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed SPM.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS]++; return FALSE; } source->has_proactive_parity = opt_parity_prm->opt_reserved & PGM_PARITY_PRM_PRO; source->has_ondemand_parity = opt_parity_prm->opt_reserved & PGM_PARITY_PRM_OND; if (source->has_proactive_parity || source->has_ondemand_parity) { source->is_fec_enabled = 1; pgm_rxw_update_fec (source->window, parity_prm_tgs); } } } while (!(opt_header->opt_type & PGM_OPT_END)); } /* either way bump expiration timer */ source->expiry = skb->tstamp + sock->peer_expiry; source->spmr_expiry = 0; if (source->spmr_tstamp > 0) { PGM_HISTOGRAM_TIMES("Rx.SpmRequestResponseTime", skb->tstamp - source->spmr_tstamp); source->spmr_tstamp = 0; } return TRUE; } /* Multicast peer-to-peer NAK handling, pretty much the same as a NCF but different direction * * if NAK is valid, returns TRUE. on error, FALSE is returned. */ PGM_GNUC_INTERNAL bool pgm_on_peer_nak ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict peer, struct pgm_sk_buff_t* const restrict skb ) { const struct pgm_nak *nak; const struct pgm_nak6 *nak6; struct sockaddr_storage nak_src_nla, nak_grp_nla; bool found_nak_grp = FALSE; int ncf_status; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != peer); pgm_assert (NULL != skb); pgm_debug ("pgm_on_peer_nak (sock:%p peer:%p skb:%p)", (const void*)sock, (const void*)peer, (const void*)skb); if (PGM_UNLIKELY(!pgm_verify_nak (skb))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded invalid multicast NAK.")); peer->cumulative_stats[PGM_PC_RECEIVER_NAK_ERRORS]++; return FALSE; } nak = (struct pgm_nak *)skb->data; nak6 = (struct pgm_nak6*)skb->data; /* NAK_SRC_NLA must not contain our sock unicast NLA */ pgm_nla_to_sockaddr (&nak->nak_src_nla_afi, (struct sockaddr*)&nak_src_nla); if (PGM_UNLIKELY(pgm_sockaddr_cmp ((struct sockaddr*)&nak_src_nla, (struct sockaddr*)&sock->send_addr) == 0)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded multicast NAK on NLA mismatch.")); return FALSE; } /* NAK_GRP_NLA contains one of our sock receive multicast groups: the sources send multicast group */ pgm_nla_to_sockaddr ((AF_INET6 == nak_src_nla.ss_family) ? &nak6->nak6_grp_nla_afi : &nak->nak_grp_nla_afi, (struct sockaddr*)&nak_grp_nla); for (unsigned i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((struct sockaddr*)&nak_grp_nla, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0) { found_nak_grp = TRUE; break; } } if (PGM_UNLIKELY(!found_nak_grp)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded multicast NAK on multicast group mismatch.")); return FALSE; } /* handle as NCF */ ncf_status = pgm_rxw_confirm (peer->window, ntohl (nak->nak_sqn), skb->tstamp, skb->tstamp + sock->nak_rdata_ivl, skb->tstamp + nak_rb_ivl(sock)); if (PGM_RXW_UPDATED == ncf_status || PGM_RXW_APPENDED == ncf_status) peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED]++; /* check NAK list */ if (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { const struct pgm_opt_header* opt_header; const struct pgm_opt_length* opt_len; const uint32_t* nak_list = NULL; unsigned nak_list_len = 0; opt_len = (AF_INET6 == nak_src_nla.ss_family) ? (const struct pgm_opt_length*)(nak6 + 1) : (const struct pgm_opt_length*)(nak + 1); if (PGM_UNLIKELY(opt_len->opt_type != PGM_OPT_LENGTH)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed multicast NAK.")); peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS]++; return FALSE; } if (PGM_UNLIKELY(opt_len->opt_length != sizeof(struct pgm_opt_length))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed multicast NAK.")); peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS]++; return FALSE; } /* TODO: check for > 16 options & past packet end */ opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); if ((opt_header->opt_type & PGM_OPT_MASK) == PGM_OPT_NAK_LIST) { nak_list = ((const struct pgm_opt_nak_list*)(opt_header + 1))->opt_sqn; nak_list_len = ( opt_header->opt_length - sizeof(struct pgm_opt_header) - sizeof(uint8_t) ) / sizeof(uint32_t); break; } } while (!(opt_header->opt_type & PGM_OPT_END)); while (nak_list_len) { ncf_status = pgm_rxw_confirm (peer->window, ntohl (*nak_list), skb->tstamp, skb->tstamp + sock->nak_rdata_ivl, skb->tstamp + nak_rb_ivl(sock)); if (PGM_RXW_UPDATED == ncf_status || PGM_RXW_APPENDED == ncf_status) peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED]++; nak_list++; nak_list_len--; } } /* mark receiver window for flushing on next recv() */ if (peer->window->cumulative_losses != peer->last_cumulative_losses && !peer->pending_link.data) { sock->is_reset = TRUE; peer->lost_count = peer->window->cumulative_losses - peer->last_cumulative_losses; peer->last_cumulative_losses = peer->window->cumulative_losses; pgm_peer_set_pending (sock, peer); } return TRUE; } /* NCF confirming receipt of a NAK from this sock or another on the LAN segment. * * Packet contents will match exactly the sent NAK, although not really that helpful. * * if NCF is valid, returns TRUE. on error, FALSE is returned. */ PGM_GNUC_INTERNAL bool pgm_on_ncf ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, struct pgm_sk_buff_t* const restrict skb ) { const struct pgm_nak *ncf; const struct pgm_nak6 *ncf6; struct sockaddr_storage ncf_src_nla, ncf_grp_nla; int ncf_status; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (NULL != skb); pgm_debug ("pgm_on_ncf (sock:%p source:%p skb:%p)", (const void*)sock, (const void*)source, (const void*)skb); if (PGM_UNLIKELY(!pgm_verify_ncf (skb))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded invalid NCF.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS]++; return FALSE; } ncf = (struct pgm_nak *)skb->data; ncf6 = (struct pgm_nak6*)skb->data; /* NCF_SRC_NLA may contain our sock unicast NLA, we don't really care */ pgm_nla_to_sockaddr (&ncf->nak_src_nla_afi, (struct sockaddr*)&ncf_src_nla); #if 0 if (PGM(pgm_sockaddr_cmp ((struct sockaddr*)&ncf_src_nla, (struct sockaddr*)&sock->send_addr) != 0)) { g_trace ("INFO", "Discarded NCF on NLA mismatch."); peer->cumulative_stats[PGM_PC_RECEIVER_PACKETS_DISCARDED]++; return FALSE; } #endif /* NCF_GRP_NLA contains our sock multicast group */ pgm_nla_to_sockaddr ((AF_INET6 == ncf_src_nla.ss_family) ? &ncf6->nak6_grp_nla_afi : &ncf->nak_grp_nla_afi, (struct sockaddr*)&ncf_grp_nla); if (PGM_UNLIKELY(pgm_sockaddr_cmp ((struct sockaddr*)&ncf_grp_nla, (struct sockaddr*)&sock->send_gsr.gsr_group) != 0)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded NCF on multicast group mismatch.")); return FALSE; } const pgm_time_t ncf_rdata_ivl = skb->tstamp + sock->nak_rdata_ivl; const pgm_time_t ncf_rb_ivl = skb->tstamp + nak_rb_ivl(sock); ncf_status = pgm_rxw_confirm (source->window, ntohl (ncf->nak_sqn), skb->tstamp, ncf_rdata_ivl, ncf_rb_ivl); if (PGM_RXW_UPDATED == ncf_status || PGM_RXW_APPENDED == ncf_status) { const pgm_time_t ncf_ivl = (PGM_RXW_APPENDED == ncf_status) ? ncf_rb_ivl : ncf_rdata_ivl; pgm_timer_lock (sock); if (pgm_time_after (sock->next_poll, ncf_ivl)) { sock->next_poll = ncf_ivl; } pgm_timer_unlock (sock); source->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED]++; } /* check NCF list */ if (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) { const struct pgm_opt_header* opt_header; const struct pgm_opt_length* opt_len; const uint32_t* ncf_list = NULL; unsigned ncf_list_len = 0; opt_len = (AF_INET6 == ncf_src_nla.ss_family) ? (const struct pgm_opt_length*)(ncf6 + 1) : (const struct pgm_opt_length*)(ncf + 1); if (PGM_UNLIKELY(opt_len->opt_type != PGM_OPT_LENGTH)) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed NCF.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS]++; return FALSE; } if (PGM_UNLIKELY(opt_len->opt_length != sizeof(struct pgm_opt_length))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded malformed NCF.")); source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS]++; return FALSE; } /* TODO: check for > 16 options & past packet end */ opt_header = (const struct pgm_opt_header*)opt_len; do { opt_header = (const struct pgm_opt_header*)((const char*)opt_header + opt_header->opt_length); if ((opt_header->opt_type & PGM_OPT_MASK) == PGM_OPT_NAK_LIST) { ncf_list = ((const struct pgm_opt_nak_list*)(opt_header + 1))->opt_sqn; ncf_list_len = ( opt_header->opt_length - sizeof(struct pgm_opt_header) - sizeof(uint8_t) ) / sizeof(uint32_t); break; } } while (!(opt_header->opt_type & PGM_OPT_END)); pgm_debug ("NCF contains 1+%d sequence numbers.", ncf_list_len); while (ncf_list_len) { ncf_status = pgm_rxw_confirm (source->window, ntohl (*ncf_list), skb->tstamp, ncf_rdata_ivl, ncf_rb_ivl); if (PGM_RXW_UPDATED == ncf_status || PGM_RXW_APPENDED == ncf_status) source->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED]++; ncf_list++; ncf_list_len--; } } /* mark receiver window for flushing on next recv() */ if (source->window->cumulative_losses != source->last_cumulative_losses && !source->pending_link.data) { sock->is_reset = TRUE; source->lost_count = source->window->cumulative_losses - source->last_cumulative_losses; source->last_cumulative_losses = source->window->cumulative_losses; pgm_peer_set_pending (sock, source); } return TRUE; } /* send SPM-request to a new peer, this packet type has no contents * * on success, TRUE is returned, if operation would block FALSE is * returned. */ static bool send_spmr ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source ) { char *buf; struct pgm_header *header; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_debug ("send_spmr (sock:%p source:%p)", (const void*)sock, (const void*)source); const size_t tpdu_length = sizeof(struct pgm_header); buf = pgm_alloca (tpdu_length); header = (struct pgm_header*)buf; memcpy (header->pgm_gsi, &source->tsi.gsi, sizeof(pgm_gsi_t)); /* dport & sport reversed communicating upstream */ header->pgm_sport = sock->dport; header->pgm_dport = source->tsi.sport; header->pgm_type = PGM_SPMR; header->pgm_options = 0; header->pgm_tsdu_length = 0; header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); /* send multicast SPMR TTL 1 to our peers listening on the same groups */ for (unsigned i = 0; i < sock->recv_gsr_len; i++) sent = pgm_sendto_hops (sock, FALSE, /* not rate limited */ NULL, FALSE, /* regular socket */ 1, header, tpdu_length, (struct sockaddr*)&sock->recv_gsr[i].gsr_group, pgm_sockaddr_len ((struct sockaddr*)&sock->recv_gsr[i].gsr_group)); /* ignore errors on peer multicast */ /* send unicast SPMR with regular TTL */ sent = pgm_sendto (sock, FALSE, NULL, FALSE, header, tpdu_length, (struct sockaddr*)&source->local_nla, pgm_sockaddr_len ((struct sockaddr*)&source->local_nla)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT] += tpdu_length * 2; return TRUE; } /* send selective NAK for one sequence number. * * on success, TRUE is returned, returns FALSE if would block on operation. */ static bool send_nak ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, const uint32_t sequence ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_nak *nak; struct pgm_nak6 *nak6; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_debug ("send_nak (sock:%p peer:%p sequence:%" PRIu32 ")", (void*)sock, (void*)source, sequence); tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak); if (AF_INET6 == source->nla.ss_family) tpdu_length += sizeof(struct pgm_nak6) - sizeof(struct pgm_nak); buf = pgm_alloca (tpdu_length); header = (struct pgm_header*)buf; nak = (struct pgm_nak *)(header + 1); nak6 = (struct pgm_nak6*)(header + 1); memcpy (header->pgm_gsi, &source->tsi.gsi, sizeof(pgm_gsi_t)); /* dport & sport swap over for a nak */ header->pgm_sport = sock->dport; header->pgm_dport = source->tsi.sport; header->pgm_type = PGM_NAK; header->pgm_options = 0; header->pgm_tsdu_length = 0; /* NAK */ nak->nak_sqn = htonl (sequence); /* source nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&source->nla, (char*)&nak->nak_src_nla_afi); /* group nla: we match the NAK NLA to the same as advertised by the source, we might * be listening to multiple multicast groups */ pgm_sockaddr_to_nla ((struct sockaddr*)&source->group_nla, (AF_INET6 == source->nla.ss_family) ? (char*)&nak6->nak6_grp_nla_afi : (char*)&nak->nak_grp_nla_afi); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, FALSE, /* not rate limited */ NULL, TRUE, /* with router alert */ header, tpdu_length, (struct sockaddr*)&source->nla, pgm_sockaddr_len((struct sockaddr*)&source->nla)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; source->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT]++; source->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT]++; return TRUE; } /* Send a parity NAK requesting on-demand parity packet generation. * * on success, TRUE is returned, returns FALSE if operation would block. */ static bool send_parity_nak ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, const uint32_t nak_tg_sqn, /* transmission group (shifted) */ const uint32_t nak_pkt_cnt /* count of parity packets to request */ ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_nak *nak; struct pgm_nak6 *nak6; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (nak_pkt_cnt > 0); pgm_debug ("send_parity_nak (sock:%p source:%p nak-tg-sqn:%" PRIu32 " nak-pkt-cnt:%" PRIu32 ")", (void*)sock, (void*)source, nak_tg_sqn, nak_pkt_cnt); tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak); if (AF_INET6 == source->nla.ss_family) tpdu_length += sizeof(struct pgm_nak6) - sizeof(struct pgm_nak); buf = pgm_alloca (tpdu_length); header = (struct pgm_header*)buf; nak = (struct pgm_nak *)(header + 1); nak6 = (struct pgm_nak6*)(header + 1); memcpy (header->pgm_gsi, &source->tsi.gsi, sizeof(pgm_gsi_t)); /* dport & sport swap over for a nak */ header->pgm_sport = sock->dport; header->pgm_dport = source->tsi.sport; header->pgm_type = PGM_NAK; header->pgm_options = PGM_OPT_PARITY; /* this is a parity packet */ header->pgm_tsdu_length = 0; /* NAK */ nak->nak_sqn = htonl (nak_tg_sqn | (nak_pkt_cnt - 1) ); /* source nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&source->nla, (char*)&nak->nak_src_nla_afi); /* group nla: we match the NAK NLA to the same as advertised by the source, we might * be listening to multiple multicast groups */ pgm_sockaddr_to_nla ((struct sockaddr*)&source->group_nla, (AF_INET6 == source->nla.ss_family) ? (char*)&nak6->nak6_grp_nla_afi : (char*)&nak->nak_grp_nla_afi ); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, FALSE, /* not rate limited */ NULL, TRUE, /* with router alert */ header, tpdu_length, (struct sockaddr*)&source->nla, pgm_sockaddr_len((struct sockaddr*)&source->nla)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; source->cumulative_stats[PGM_PC_RECEIVER_PARITY_NAK_PACKETS_SENT]++; source->cumulative_stats[PGM_PC_RECEIVER_PARITY_NAKS_SENT]++; return TRUE; } /* A NAK packet with a OPT_NAK_LIST option extension * * on success, TRUE is returned. on error, FALSE is returned. */ static bool send_nak_list ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, const struct pgm_sqn_list_t* const restrict sqn_list ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_nak *nak; struct pgm_nak6 *nak6; struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; struct pgm_opt_nak_list *opt_nak_list; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (NULL != sqn_list); pgm_assert_cmpuint (sqn_list->len, >, 1); pgm_assert_cmpuint (sqn_list->len, <=, 63); #ifdef RECEIVER_DEBUG char list[1024]; sprintf (list, "%" PRIu32, sqn_list->sqn[0]); for (unsigned i = 1; i < sqn_list->len; i++) { char sequence[2 + strlen("4294967295")]; sprintf (sequence, " %" PRIu32, sqn_list->sqn[i]); strcat (list, sequence); } pgm_debug("send_nak_list (sock:%p source:%p sqn-list:[%s])", (const void*)sock, (const void*)source, list); #endif tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_nak) + sizeof(struct pgm_opt_length) + /* includes header */ sizeof(struct pgm_opt_header) + sizeof(uint8_t) + ( (sqn_list->len-1) * sizeof(uint32_t) ); if (AF_INET6 == source->nla.ss_family) tpdu_length += sizeof(struct pgm_nak6) - sizeof(struct pgm_nak); buf = pgm_alloca (tpdu_length); if (PGM_UNLIKELY(pgm_mem_gc_friendly)) memset (buf, 0, tpdu_length); header = (struct pgm_header*)buf; nak = (struct pgm_nak *)(header + 1); nak6 = (struct pgm_nak6*)(header + 1); memcpy (header->pgm_gsi, &source->tsi.gsi, sizeof(pgm_gsi_t)); /* dport & sport swap over for a nak */ header->pgm_sport = sock->dport; header->pgm_dport = source->tsi.sport; header->pgm_type = PGM_NAK; header->pgm_options = PGM_OPT_PRESENT | PGM_OPT_NETWORK; header->pgm_tsdu_length = 0; /* NAK */ nak->nak_sqn = htonl (sqn_list->sqn[0]); /* source nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&source->nla, (char*)&nak->nak_src_nla_afi); /* group nla */ pgm_sockaddr_to_nla ((struct sockaddr*)&source->group_nla, (AF_INET6 == source->nla.ss_family) ? (char*)&nak6->nak6_grp_nla_afi : (char*)&nak->nak_grp_nla_afi); /* OPT_NAK_LIST */ opt_len = (AF_INET6 == source->nla.ss_family) ? (struct pgm_opt_length*)(nak6 + 1) : (struct pgm_opt_length*)(nak + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + sizeof(uint8_t) + ( (sqn_list->len-1) * sizeof(uint32_t) ) ); opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_NAK_LIST | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + sizeof(uint8_t) + ( (sqn_list->len-1) * sizeof(uint32_t) ); opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1); opt_nak_list->opt_reserved = 0; for (unsigned i = 1; i < sqn_list->len; i++) opt_nak_list->opt_sqn[i-1] = htonl (sqn_list->sqn[i]); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, FALSE, /* not rate limited */ NULL, FALSE, /* regular socket */ header, tpdu_length, (struct sockaddr*)&source->nla, pgm_sockaddr_len((struct sockaddr*)&source->nla)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; source->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT]++; source->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT] += 1 + sqn_list->len; return TRUE; } /* send ACK upstream to source * * on success, TRUE is returned. on error, FALSE is returned. */ static bool send_ack ( pgm_sock_t*const restrict sock, pgm_peer_t*const restrict source, const pgm_time_t now ) { size_t tpdu_length; char *buf; struct pgm_header *header; struct pgm_ack *ack; struct pgm_opt_header *opt_header; struct pgm_opt_length *opt_len; struct pgm_opt_pgmcc_feedback *opt_pgmcc_feedback; ssize_t sent; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (sock->use_pgmcc); pgm_debug ("send_ack (sock:%p source:%p now:%" PGM_TIME_FORMAT ")", (void*)sock, (void*)source, now); tpdu_length = sizeof(struct pgm_header) + sizeof(struct pgm_ack) + sizeof(struct pgm_opt_length) + /* includes header */ sizeof(struct pgm_opt_header) + sizeof(struct pgm_opt_pgmcc_feedback); if (AF_INET6 == sock->send_addr.ss_family) tpdu_length += sizeof(struct pgm_opt6_pgmcc_feedback) - sizeof(struct pgm_opt_pgmcc_feedback); buf = pgm_alloca (tpdu_length); if (PGM_UNLIKELY(pgm_mem_gc_friendly)) memset (buf, 0, tpdu_length); header = (struct pgm_header*)buf; ack = (struct pgm_ack*)(header + 1); memcpy (header->pgm_gsi, &source->tsi.gsi, sizeof(pgm_gsi_t)); /* dport & sport swap over for an ack */ header->pgm_sport = sock->dport; header->pgm_dport = source->tsi.sport; header->pgm_type = PGM_ACK; header->pgm_options = PGM_OPT_PRESENT; header->pgm_tsdu_length = 0; /* ACK */ ack->ack_rx_max = htonl (pgm_rxw_lead (source->window)); ack->ack_bitmap = htonl (source->window->bitmap); /* OPT_PGMCC_FEEDBACK */ opt_len = (struct pgm_opt_length*)(ack + 1); opt_len->opt_type = PGM_OPT_LENGTH; opt_len->opt_length = sizeof(struct pgm_opt_length); opt_len->opt_total_length = htons ( sizeof(struct pgm_opt_length) + sizeof(struct pgm_opt_header) + (AF_INET6 == sock->send_addr.ss_family) ? sizeof(struct pgm_opt6_pgmcc_feedback) : sizeof(struct pgm_opt_pgmcc_feedback) ); opt_header = (struct pgm_opt_header*)(opt_len + 1); opt_header->opt_type = PGM_OPT_PGMCC_FEEDBACK | PGM_OPT_END; opt_header->opt_length = sizeof(struct pgm_opt_header) + ( (AF_INET6 == sock->send_addr.ss_family) ? sizeof(struct pgm_opt6_pgmcc_feedback) : sizeof(struct pgm_opt_pgmcc_feedback) ); opt_pgmcc_feedback = (struct pgm_opt_pgmcc_feedback*)(opt_header + 1); opt_pgmcc_feedback->opt_reserved = 0; const uint32_t t = (uint32_t)(source->ack_last_tstamp + pgm_to_msecs( now - source->last_data_tstamp )); opt_pgmcc_feedback->opt_tstamp = htonl (t); pgm_sockaddr_to_nla ((struct sockaddr*)&sock->send_addr, (char*)&opt_pgmcc_feedback->opt_nla_afi); opt_pgmcc_feedback->opt_loss_rate = htons ((uint16_t)source->window->data_loss); header->pgm_checksum = 0; header->pgm_checksum = pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0)); sent = pgm_sendto (sock, FALSE, /* not rate limited */ NULL, FALSE, /* regular socket */ header, tpdu_length, (struct sockaddr*)&source->nla, pgm_sockaddr_len((struct sockaddr*)&source->nla)); if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error())) return FALSE; source->cumulative_stats[PGM_PC_RECEIVER_ACKS_SENT]++; return TRUE; } /* check all receiver windows for ACKer elections, on expiration send an ACK. * * returns TRUE on success, returns FALSE if operation would block. */ static bool ack_rb_state ( pgm_sock_t*restrict sock, pgm_peer_t*restrict peer, const pgm_time_t now ) { pgm_queue_t* ack_backoff_queue; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != peer); pgm_assert (NULL != peer->window); pgm_assert (sock->use_pgmcc); pgm_debug ("ack_rb_state (sock:%p peer:%p now:%" PGM_TIME_FORMAT ")", (void*)sock, (void*)peer, now); ack_backoff_queue = &peer->window->ack_backoff_queue; if (NULL == ack_backoff_queue->tail) { pgm_assert (NULL == ack_backoff_queue->head); pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Backoff queue is empty in ack_rb_state.")); return TRUE; } else { pgm_assert (NULL != ack_backoff_queue->head); } /* have not learned this peers NLA */ const bool is_valid_nla = (0 != peer->nla.ss_family); for (pgm_list_t *it = ack_backoff_queue->tail, *prev = it->prev; NULL != it; it = prev) { prev = it->prev; /* check for ACK backoff expiration */ if (pgm_time_after_eq(now, peer->ack_rb_expiry)) { /* unreliable delivery */ _pgm_remove_ack (peer); if (PGM_UNLIKELY(!is_valid_nla)) { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Unable to send ACK due to unknown NLA.")); continue; } pgm_assert (!pgm_sockaddr_is_addr_unspecified ((struct sockaddr*)&peer->nla)); if (!send_ack (sock, peer, now)) return FALSE; } else { /* packet expires some time later */ break; } } if (ack_backoff_queue->length == 0) { pgm_assert ((struct rxw_packet*)ack_backoff_queue->head == NULL); pgm_assert ((struct rxw_packet*)ack_backoff_queue->tail == NULL); } else { pgm_assert ((struct rxw_packet*)ack_backoff_queue->head != NULL); pgm_assert ((struct rxw_packet*)ack_backoff_queue->tail != NULL); } if (ack_backoff_queue->tail) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Next expiry set in %f seconds."), pgm_to_secsf(next_ack_rb_expiry(peer->window) - now)); } else { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("ACK backoff queue empty.")); } return TRUE; } /* check all receiver windows for packets in BACK-OFF_STATE, on expiration send a NAK. * update sock::next_nak_rb_timestamp for next expiration time. * * peer object is locked before entry. * * returns TRUE on success, returns FALSE if operation would block. */ static bool nak_rb_state ( pgm_sock_t*restrict sock, pgm_peer_t*restrict peer, const pgm_time_t now ) { pgm_queue_t* nak_backoff_queue; unsigned dropped_invalid = 0; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != peer); pgm_assert (NULL != peer->window); pgm_debug ("nak_rb_state (sock:%p peer:%p now:%" PGM_TIME_FORMAT ")", (void*)sock, (void*)peer, now); /* send all NAKs first, lack of data is blocking contiguous processing and its * better to get the notification out a.s.a.p. even though it might be waiting * in a kernel queue. * * alternative: after each packet check for incoming data and return to the * event loop. bias for shorter loops as retry count increases. */ nak_backoff_queue = &peer->window->nak_backoff_queue; if (NULL == nak_backoff_queue->tail) { pgm_assert (NULL == nak_backoff_queue->head); pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Backoff queue is empty in nak_rb_state.")); return TRUE; } else { pgm_assert (NULL != nak_backoff_queue->head); } /* have not learned this peers NLA */ const bool is_valid_nla = 0 != peer->nla.ss_family; /* TODO: process BOTH selective and parity NAKs? */ /* calculate current transmission group for parity enabled peers */ if (peer->has_ondemand_parity) { const uint32_t tg_sqn_mask = 0xffffffff << peer->window->tg_sqn_shift; /* NAKs only generated previous to current transmission group */ const uint32_t current_tg_sqn = peer->window->lead & tg_sqn_mask; uint32_t nak_tg_sqn = 0; uint32_t nak_pkt_cnt = 0; /* parity NAK generation */ for (pgm_list_t *it = nak_backoff_queue->tail, *prev = it->prev; NULL != it; it = prev) { struct pgm_sk_buff_t* skb = (struct pgm_sk_buff_t*)it; pgm_rxw_state_t* state = (pgm_rxw_state_t*)&skb->cb; prev = it->prev; /* check this packet for state expiration */ if (pgm_time_after_eq (now, state->timer_expiry)) { if (PGM_UNLIKELY(!is_valid_nla)) { dropped_invalid++; pgm_rxw_lost (peer->window, skb->sequence); /* mark receiver window for flushing on next recv() */ pgm_peer_set_pending (sock, peer); continue; } /* TODO: parity nak lists */ const uint32_t tg_sqn = skb->sequence & tg_sqn_mask; if ( ( nak_pkt_cnt && tg_sqn == nak_tg_sqn ) || ( !nak_pkt_cnt && tg_sqn != current_tg_sqn ) ) { pgm_rxw_state (peer->window, skb, PGM_PKT_STATE_WAIT_NCF); if (!nak_pkt_cnt++) nak_tg_sqn = tg_sqn; state->nak_transmit_count++; #ifdef PGM_ABSOLUTE_EXPIRY state->timer_expiry += sock->nak_rpt_ivl; while (pgm_time_after_eq (now, state->timer_expiry)) { state->timer_expiry += sock->nak_rpt_ivl; state->ncf_retry_count++; } #else state->timer_expiry = now + sock->nak_rpt_ivl; #endif pgm_timer_lock (sock); if (pgm_time_after (sock->next_poll, state->timer_expiry)) sock->next_poll = state->timer_expiry; pgm_timer_unlock (sock); } else { /* different transmission group */ break; } } else { /* packet expires some time later */ break; } } if (nak_pkt_cnt && !send_parity_nak (sock, peer, nak_tg_sqn, nak_pkt_cnt)) return FALSE; } else { struct pgm_sqn_list_t nak_list = { .len = 0 }; /* select NAK generation */ for (pgm_list_t *it = nak_backoff_queue->tail, *prev = it->prev; NULL != it; it = prev) { struct pgm_sk_buff_t* skb = (struct pgm_sk_buff_t*)it; pgm_rxw_state_t* state = (pgm_rxw_state_t*)&skb->cb; prev = it->prev; /* check this packet for state expiration */ if (pgm_time_after_eq(now, state->timer_expiry)) { if (PGM_UNLIKELY(!is_valid_nla)) { dropped_invalid++; pgm_rxw_lost (peer->window, skb->sequence); /* mark receiver window for flushing on next recv() */ pgm_peer_set_pending (sock, peer); continue; } pgm_rxw_state (peer->window, skb, PGM_PKT_STATE_WAIT_NCF); nak_list.sqn[nak_list.len++] = skb->sequence; state->nak_transmit_count++; /* we have two options here, calculate the expiry time in the new state relative to the current * state execution time, skipping missed expirations due to delay in state processing, or base * from the actual current time. */ #ifdef PGM_ABSOLUTE_EXPIRY state->timer_expiry += sock->nak_rpt_ivl; while (pgm_time_after_eq(now, state->timer_expiry)){ state->timer_expiry += sock->nak_rpt_ivl; state->ncf_retry_count++; } #else state->timer_expiry = now + sock->nak_rpt_ivl; pgm_trace(PGM_LOG_ROLE_NETWORK,_("nak_rpt_expiry in %f seconds."), pgm_to_secsf( state->timer_expiry - now ) ); #endif pgm_timer_lock (sock); if (pgm_time_after (sock->next_poll, state->timer_expiry)) sock->next_poll = state->timer_expiry; pgm_timer_unlock (sock); if (nak_list.len == PGM_N_ELEMENTS(nak_list.sqn)) { if (sock->can_send_nak && !send_nak_list (sock, peer, &nak_list)) return FALSE; nak_list.len = 0; } } else { /* packet expires some time later */ break; } } if (sock->can_send_nak && nak_list.len) { if (nak_list.len > 1 && !send_nak_list (sock, peer, &nak_list)) return FALSE; else if (!send_nak (sock, peer, nak_list.sqn[0])) return FALSE; } } if (PGM_UNLIKELY(dropped_invalid)) { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Dropped %u messages due to invalid NLA."), dropped_invalid); /* mark receiver window for flushing on next recv() */ if (peer->window->cumulative_losses != peer->last_cumulative_losses && !peer->pending_link.data) { sock->is_reset = TRUE; peer->lost_count = peer->window->cumulative_losses - peer->last_cumulative_losses; peer->last_cumulative_losses = peer->window->cumulative_losses; pgm_peer_set_pending (sock, peer); } } if (nak_backoff_queue->length == 0) { pgm_assert ((struct rxw_packet*)nak_backoff_queue->head == NULL); pgm_assert ((struct rxw_packet*)nak_backoff_queue->tail == NULL); } else { pgm_assert ((struct rxw_packet*)nak_backoff_queue->head != NULL); pgm_assert ((struct rxw_packet*)nak_backoff_queue->tail != NULL); } if (nak_backoff_queue->tail) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Next expiry set in %f seconds."), pgm_to_secsf(next_nak_rb_expiry(peer->window) - now)); } else { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("NAK backoff queue empty.")); } return TRUE; } /* check this peer for NAK state timers, uses the tail of each queue for the nearest * timer execution. * * returns TRUE on complete sweep, returns FALSE if operation would block. */ PGM_GNUC_INTERNAL bool pgm_check_peer_state ( pgm_sock_t*const sock, const pgm_time_t now ) { /* pre-conditions */ pgm_assert (NULL != sock); pgm_debug ("pgm_check_peer_state (sock:%p now:%" PGM_TIME_FORMAT ")", (const void*)sock, now); if (!sock->peers_list) return TRUE; for (pgm_list_t *it = sock->peers_list, *next = it->next; NULL != it; it = next) { pgm_peer_t* peer = it->data; next = it->next; if (peer->spmr_expiry) { if (pgm_time_after_eq (now, peer->spmr_expiry)) { if (sock->can_send_nak) { if (!send_spmr (sock, peer)) { return FALSE; } peer->spmr_tstamp = now; } peer->spmr_expiry = 0; } } if (peer->window->ack_backoff_queue.tail) { pgm_assert (sock->use_pgmcc); if (pgm_time_after_eq (now, next_ack_rb_expiry (peer->window))) if (!ack_rb_state (sock, peer, now)) { return FALSE; } } if (peer->window->nak_backoff_queue.tail) { if (pgm_time_after_eq (now, next_nak_rb_expiry (peer->window))) if (!nak_rb_state (sock, peer, now)) { return FALSE; } } if (peer->window->wait_ncf_queue.tail) { if (pgm_time_after_eq (now, next_nak_rpt_expiry (peer->window))) nak_rpt_state (sock, peer, now); } if (peer->window->wait_data_queue.tail) { if (pgm_time_after_eq (now, next_nak_rdata_expiry (peer->window))) nak_rdata_state (sock, peer, now); } /* expired, remove from hash table and linked list */ if (pgm_time_after_eq (now, peer->expiry)) { if (peer->pending_link.data) { pgm_trace (PGM_LOG_ROLE_SESSION,_("Peer expiration postponed due to committing data, tsi %s"), pgm_tsi_print (&peer->tsi)); peer->expiry += sock->peer_expiry; } else if (peer->window->committed_count) { pgm_trace (PGM_LOG_ROLE_SESSION,_("Peer expiration postponed due to committed data, tsi %s"), pgm_tsi_print (&peer->tsi)); peer->expiry += sock->peer_expiry; } else { pgm_trace (PGM_LOG_ROLE_SESSION,_("Peer expired, tsi %s"), pgm_tsi_print (&peer->tsi)); pgm_hashtable_remove (sock->peers_hashtable, &peer->tsi); sock->peers_list = pgm_list_remove_link (sock->peers_list, &peer->peers_link); if (sock->last_hash_value == peer) sock->last_hash_value = NULL; pgm_peer_unref (peer); } } } /* check for waiting contiguous packets */ if (sock->peers_pending && !sock->is_pending_read) { pgm_debug ("prod rx thread"); pgm_notify_send (&sock->pending_notify); sock->is_pending_read = TRUE; } return TRUE; } /* find the next state expiration time among the socks peers. * * on success, returns the earliest of the expiration parameter or next * peer expiration time. */ PGM_GNUC_INTERNAL pgm_time_t pgm_min_receiver_expiry ( pgm_sock_t* sock, pgm_time_t expiration /* absolute time */ ) { /* pre-conditions */ pgm_assert (NULL != sock); pgm_debug ("pgm_min_receiver_expiry (sock:%p expiration:%" PGM_TIME_FORMAT ")", (void*)sock, expiration); if (!sock->peers_list) return expiration; for (pgm_list_t *it = sock->peers_list, *next = it->next; NULL != it; it = next) { pgm_peer_t* peer = it->data; next = it->next; if (peer->spmr_expiry) { if (pgm_time_after_eq (expiration, peer->spmr_expiry)) expiration = peer->spmr_expiry; } if (peer->window->ack_backoff_queue.tail) { pgm_assert (sock->use_pgmcc); if (pgm_time_after_eq (expiration, next_ack_rb_expiry (peer->window))) expiration = next_ack_rb_expiry (peer->window); } if (peer->window->nak_backoff_queue.tail) { if (pgm_time_after_eq (expiration, next_nak_rb_expiry (peer->window))) expiration = next_nak_rb_expiry (peer->window); } if (peer->window->wait_ncf_queue.tail) { if (pgm_time_after_eq (expiration, next_nak_rpt_expiry (peer->window))) expiration = next_nak_rpt_expiry (peer->window); } if (peer->window->wait_data_queue.tail) { if (pgm_time_after_eq (expiration, next_nak_rdata_expiry (peer->window))) expiration = next_nak_rdata_expiry (peer->window); } } return expiration; } /* check WAIT_NCF_STATE, on expiration move back to BACK-OFF_STATE, on exceeding NAK_NCF_RETRIES * cancel the sequence number. */ static void nak_rpt_state ( pgm_sock_t*restrict sock, pgm_peer_t*restrict peer, const pgm_time_t now ) { pgm_queue_t* wait_ncf_queue; unsigned dropped_invalid = 0; unsigned dropped = 0; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != peer); pgm_assert (NULL != peer->window); pgm_debug ("nak_rpt_state (sock:%p peer:%p now:%" PGM_TIME_FORMAT ")", (void*)sock, (void*)peer, now); wait_ncf_queue = &peer->window->wait_ncf_queue; /* have not learned this peers NLA */ const bool is_valid_nla = 0 != peer->nla.ss_family; for (pgm_list_t *it = wait_ncf_queue->tail, *prev = it->prev; NULL != it; it = prev) { struct pgm_sk_buff_t* skb = (struct pgm_sk_buff_t*)it; pgm_assert (NULL != skb); pgm_rxw_state_t* state = (pgm_rxw_state_t*)&skb->cb; prev = it->prev; /* check this packet for state expiration */ if (pgm_time_after_eq (now, state->timer_expiry)) { if (PGM_UNLIKELY(!is_valid_nla)) { dropped_invalid++; pgm_rxw_lost (peer->window, skb->sequence); /* mark receiver window for flushing on next recv() */ pgm_peer_set_pending (sock, peer); continue; } if (++state->ncf_retry_count >= sock->nak_ncf_retries) { dropped++; cancel_skb (sock, peer, skb, now); peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_NCF_RETRIES_EXCEEDED]++; } else { /* retry */ // state->timer_expiry += nak_rb_ivl(sock); state->timer_expiry = now + nak_rb_ivl (sock); pgm_rxw_state (peer->window, skb, PGM_PKT_STATE_BACK_OFF); pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("NCF retry #%u attempt %u/%u."), skb->sequence, state->ncf_retry_count, sock->nak_ncf_retries); } } else { /* packet expires some time later */ pgm_trace(PGM_LOG_ROLE_RX_WINDOW,_("NCF retry #%u is delayed %f seconds."), skb->sequence, pgm_to_secsf (state->timer_expiry - now)); break; } } if (wait_ncf_queue->length == 0) { pgm_assert ((pgm_rxw_state_t*)wait_ncf_queue->head == NULL); pgm_assert ((pgm_rxw_state_t*)wait_ncf_queue->tail == NULL); } else { pgm_assert ((pgm_rxw_state_t*)wait_ncf_queue->head != NULL); pgm_assert ((pgm_rxw_state_t*)wait_ncf_queue->tail != NULL); } if (PGM_UNLIKELY(dropped_invalid)) { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Dropped %u messages due to invalid NLA."), dropped_invalid); } if (PGM_UNLIKELY(dropped)) { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Dropped %u messages due to ncf cancellation, " "rxw_sqns %" PRIu32 " bo %" PRIu32 " ncf %" PRIu32 " wd %" PRIu32 " lost %" PRIu32 " frag %" PRIu32), dropped, pgm_rxw_length (peer->window), peer->window->nak_backoff_queue.length, peer->window->wait_ncf_queue.length, peer->window->wait_data_queue.length, peer->window->lost_count, peer->window->fragment_count); } /* mark receiver window for flushing on next recv() */ if (PGM_UNLIKELY(peer->window->cumulative_losses != peer->last_cumulative_losses && !peer->pending_link.data)) { sock->is_reset = TRUE; peer->lost_count = peer->window->cumulative_losses - peer->last_cumulative_losses; peer->last_cumulative_losses = peer->window->cumulative_losses; pgm_peer_set_pending (sock, peer); } if (wait_ncf_queue->tail) { if (next_nak_rpt_expiry (peer->window) > now) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Next expiry set in %f seconds."), pgm_to_secsf (next_nak_rpt_expiry (peer->window) - now)); } else { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Next expiry set in -%f seconds."), pgm_to_secsf (now - next_nak_rpt_expiry (peer->window))); } } else { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Wait ncf queue empty.")); } } /* check WAIT_DATA_STATE, on expiration move back to BACK-OFF_STATE, on exceeding NAK_DATA_RETRIES * canel the sequence number. */ static void nak_rdata_state ( pgm_sock_t*restrict sock, pgm_peer_t*restrict peer, const pgm_time_t now ) { pgm_queue_t* wait_data_queue; unsigned dropped_invalid = 0; unsigned dropped = 0; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != peer); pgm_assert (NULL != peer->window); pgm_debug ("nak_rdata_state (sock:%p peer:%p now:%" PGM_TIME_FORMAT ")", (void*)sock, (void*)peer, now); wait_data_queue = &peer->window->wait_data_queue; /* have not learned this peers NLA */ const bool is_valid_nla = 0 != peer->nla.ss_family; for (pgm_list_t *it = wait_data_queue->tail, *prev = it->prev; NULL != it; it = prev) { struct pgm_sk_buff_t* rdata_skb = (struct pgm_sk_buff_t*)it; pgm_assert (NULL != rdata_skb); pgm_rxw_state_t* rdata_state = (pgm_rxw_state_t*)&rdata_skb->cb; prev = it->prev; /* check this packet for state expiration */ if (pgm_time_after_eq (now, rdata_state->timer_expiry)) { if (PGM_UNLIKELY(!is_valid_nla)) { dropped_invalid++; pgm_rxw_lost (peer->window, rdata_skb->sequence); /* mark receiver window for flushing on next recv() */ pgm_peer_set_pending (sock, peer); continue; } if (++rdata_state->data_retry_count >= sock->nak_data_retries) { dropped++; cancel_skb (sock, peer, rdata_skb, now); peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_DATA_RETRIES_EXCEEDED]++; continue; } // rdata_state->timer_expiry += nak_rb_ivl(sock); rdata_state->timer_expiry = now + nak_rb_ivl (sock); pgm_rxw_state (peer->window, rdata_skb, PGM_PKT_STATE_BACK_OFF); /* retry back to back-off state */ pgm_trace(PGM_LOG_ROLE_RX_WINDOW,_("Data retry #%u attempt %u/%u."), rdata_skb->sequence, rdata_state->data_retry_count, sock->nak_data_retries); } else { /* packet expires some time later */ break; } } if (wait_data_queue->length == 0) { pgm_assert (NULL == (pgm_rxw_state_t*)wait_data_queue->head); pgm_assert (NULL == (pgm_rxw_state_t*)wait_data_queue->tail); } else { pgm_assert (NULL != (pgm_rxw_state_t*)wait_data_queue->head); pgm_assert (NULL != (pgm_rxw_state_t*)wait_data_queue->tail); } if (PGM_UNLIKELY(dropped_invalid)) { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Dropped %u messages due to invalid NLA."), dropped_invalid); } if (PGM_UNLIKELY(dropped)) { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Dropped %u messages due to data cancellation."), dropped); } /* mark receiver window for flushing on next recv() */ if (PGM_UNLIKELY(peer->window->cumulative_losses != peer->last_cumulative_losses && !peer->pending_link.data)) { sock->is_reset = TRUE; peer->lost_count = peer->window->cumulative_losses - peer->last_cumulative_losses; peer->last_cumulative_losses = peer->window->cumulative_losses; pgm_peer_set_pending (sock, peer); } if (peer->window->wait_data_queue.tail) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Next expiry set in %f seconds."), pgm_to_secsf (next_nak_rdata_expiry (peer->window) - now)); } else { pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Wait data queue empty.")); } } /* ODATA or RDATA packet with any of the following options: * * OPT_FRAGMENT - this TPDU part of a larger APDU. * * Ownership of skb is taken and must be passed to the receive window or destroyed. * * returns TRUE is skb has been replaced, FALSE is remains unchanged and can be recycled. */ PGM_GNUC_INTERNAL bool pgm_on_data ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, struct pgm_sk_buff_t* const restrict skb ) { unsigned msg_count = 0; pgm_time_t ack_rb_expiry = 0; bool flush_naks = FALSE; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (NULL != skb); pgm_debug ("pgm_on_data (sock:%p source:%p skb:%p)", (void*)sock, (void*)source, (void*)skb); const pgm_time_t nak_rb_expiry = skb->tstamp + nak_rb_ivl (sock); const uint_fast16_t tsdu_length = ntohs (skb->pgm_header->pgm_tsdu_length); skb->pgm_data = skb->data; const uint_fast16_t opt_total_length = (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) ? ntohs(*(uint16_t*)( (char*)( skb->pgm_data + 1 ) + sizeof(uint16_t))) : 0; /* advance data pointer to payload */ pgm_skb_pull (skb, sizeof(struct pgm_data) + opt_total_length); if (opt_total_length > 0 && /* there are options */ get_pgm_options (skb) && /* valid options */ sock->use_pgmcc && /* PGMCC is enabled */ NULL != skb->pgm_opt_pgmcc_data && /* PGMCC options */ 0 == source->ack_rb_expiry) /* not partaking in a current election */ { ack_rb_expiry = skb->tstamp + ack_rb_ivl (sock); } const int add_status = pgm_rxw_add (source->window, skb, skb->tstamp, nak_rb_expiry); /* skb reference is now invalid */ switch (add_status) { case PGM_RXW_MISSING: flush_naks = TRUE; /* fall through */ case PGM_RXW_INSERTED: case PGM_RXW_APPENDED: msg_count++; break; case PGM_RXW_DUPLICATE: source->cumulative_stats[PGM_PC_RECEIVER_DUP_DATAS]++; goto discarded; case PGM_RXW_MALFORMED: source->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_ODATA]++; /* fall through */ case PGM_RXW_BOUNDS: discarded: return FALSE; default: pgm_assert_not_reached(); break; } /* valid data */ PGM_HISTOGRAM_COUNTS("Rx.DataBytesReceived", tsdu_length); source->cumulative_stats[PGM_PC_RECEIVER_DATA_BYTES_RECEIVED] += tsdu_length; source->cumulative_stats[PGM_PC_RECEIVER_DATA_MSGS_RECEIVED] += msg_count; /* congestion control */ if (0 != ack_rb_expiry) { /* save source timestamp and local timestamp for RTT calculation */ source->ack_last_tstamp = ntohl (skb->pgm_opt_pgmcc_data->opt_tstamp); source->last_data_tstamp = skb->tstamp; if (_pgm_is_acker (sock, source, skb)) { if (PGM_UNLIKELY(pgm_sockaddr_is_addr_unspecified ((struct sockaddr*)&source->nla))) { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("Unable to send ACK due to unknown NLA.")); } else if (PGM_UNLIKELY(!send_ack (sock, source, skb->tstamp))) { pgm_debug ("send_ack failed"); } ack_rb_expiry = 0; } else if (_pgm_is_acker_election (skb)) { pgm_trace (PGM_LOG_ROLE_CONGESTION_CONTROL,_("ACKer election.")); _pgm_add_ack (source, ack_rb_expiry); } else if (0 != source->window->ack_backoff_queue.length) { /* purge ACK backoff queue as host is not elected ACKer */ _pgm_remove_ack (source); ack_rb_expiry = 0; } else { /* no election, not the elected ACKer, no outstanding ACKs */ ack_rb_expiry = 0; } } if (flush_naks || 0 != ack_rb_expiry) { /* flush out 1st time nak packets */ pgm_timer_lock (sock); if (flush_naks && pgm_time_after (sock->next_poll, nak_rb_expiry)) sock->next_poll = nak_rb_expiry; if (0 != ack_rb_expiry && pgm_time_after (sock->next_poll, ack_rb_expiry)) sock->next_poll = ack_rb_expiry; pgm_timer_unlock (sock); } return TRUE; } /* POLLs are generated by PGM Parents (Sources or Network Elements). * * returns TRUE on valid packet, FALSE on invalid packet. */ PGM_GNUC_INTERNAL bool pgm_on_poll ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, struct pgm_sk_buff_t* const restrict skb ) { struct pgm_poll *poll4; struct pgm_poll6 *poll6; uint32_t poll_rand; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (NULL != source); pgm_assert (NULL != skb); pgm_debug ("pgm_on_poll (sock:%p source:%p skb:%p)", (void*)sock, (void*)source, (void*)skb); if (PGM_UNLIKELY(!pgm_verify_poll (skb))) { pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded invalid POLL.")); return FALSE; } poll4 = (struct pgm_poll *)skb->data; poll6 = (struct pgm_poll6*)skb->data; memcpy (&poll_rand, (AFI_IP6 == ntohs (poll4->poll_nla_afi)) ? poll6->poll6_rand : poll4->poll_rand, sizeof(poll_rand)); const uint32_t poll_mask = (AFI_IP6 == ntohs (poll4->poll_nla_afi)) ? ntohl (poll6->poll6_mask) : ntohl (poll4->poll_mask); /* Check for probability match */ if (poll_mask && (sock->rand_node_id & poll_mask) != poll_rand) { /* discard early */ return FALSE; } /* scoped per path nla * TODO: manage list of pollers per peer */ const uint32_t poll_sqn = ntohl (poll4->poll_sqn); const uint16_t poll_round = ntohs (poll4->poll_round); /* Check for new poll round */ if (poll_round && poll_sqn != source->last_poll_sqn) { return FALSE; } /* save sequence and round of valid poll */ source->last_poll_sqn = poll_sqn; source->last_poll_round = poll_round; const uint16_t poll_s_type = ntohs (poll4->poll_s_type); /* Check poll type */ switch (poll_s_type) { case PGM_POLL_GENERAL: return on_general_poll (sock, source, skb); case PGM_POLL_DLR: return on_dlr_poll (sock, source, skb); default: /* unknown sub-type, discard */ break; } return FALSE; } /* Used to count PGM children */ static bool on_general_poll ( pgm_sock_t* const restrict sock, pgm_peer_t* const restrict source, struct pgm_sk_buff_t* const restrict skb ) { struct pgm_poll* poll4 = (struct pgm_poll *)skb->data; struct pgm_poll6* poll6 = (struct pgm_poll6*)skb->data; /* TODO: cancel any pending poll-response */ /* defer response based on provided back-off interval */ const uint32_t poll_bo_ivl = (AFI_IP6 == ntohs (poll4->poll_nla_afi)) ? ntohl (poll6->poll6_bo_ivl) : ntohl (poll4->poll_bo_ivl); source->polr_expiry = skb->tstamp + pgm_rand_int_range (&sock->rand_, 0, poll_bo_ivl); pgm_nla_to_sockaddr (&poll4->poll_nla_afi, (struct sockaddr*)&source->poll_nla); /* TODO: schedule poll-response */ return TRUE; } /* Used to count off-tree DLRs */ static bool on_dlr_poll ( PGM_GNUC_UNUSED pgm_sock_t* const restrict sock, PGM_GNUC_UNUSED pgm_peer_t* const restrict source, PGM_GNUC_UNUSED struct pgm_sk_buff_t* const restrict skb ) { /* we are not a DLR */ return FALSE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/thread.c0000644000175000017500000003272111640407354017163 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * mutexes and locks. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include //#define THREAD_DEBUG /* Globals */ bool pgm_smp_system PGM_GNUC_READ_MOSTLY = TRUE; /* Locals */ #if defined(_WIN32) && !defined(CONFIG_HAVE_WIN_COND) static DWORD cond_event_tls = TLS_OUT_OF_INDEXES; #endif static volatile uint32_t thread_ref_count = 0; #if !defined( _WIN32 ) && defined( __GNU__ ) # define posix_check_err(err, name) \ do { \ const int save_error = (err); \ if (PGM_UNLIKELY(save_error)) { \ char errbuf[1024]; \ pgm_error ("file %s: line %d (%s): error '%s' during '%s'", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, \ pgm_strerror_s (errbuf, sizeof (errbuf), save_error), name); \ } \ } while (0) # define posix_check_cmd(cmd) posix_check_err ((cmd), #cmd) #elif !defined( _WIN32 ) && !defined( __GNU__ ) # define posix_check_err(err, name) \ do { \ const int save_error = (err); \ if (PGM_UNLIKELY(save_error)) { \ char errbuf[1024]; \ pgm_error ("file %s: line %d): error '%s' during '%s'", \ __FILE__, __LINE__, \ pgm_strerror_s (errbuf, sizeof (errbuf), save_error), name); \ } \ } while (0) # define posix_check_cmd(cmd) posix_check_err ((cmd), #cmd) #elif defined( _WIN32 ) && defined( __GNU__ ) # define win32_check_err(err, name) \ do { \ const bool save_error = (err); \ if (PGM_UNLIKELY(!save_error)) { \ pgm_error ("file %s: line %d (%s): error '%s' during '%s'", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, \ pgm_wsastrerror (GetLastError ()), name); \ } \ } while (0) # define win32_check_cmd(cmd) win32_check_err ((cmd), #cmd) #elif defined( _WIN32 ) && !defined( __GNU__ ) # define win32_check_err(err, name) \ do { \ const bool save_error = (err); \ if (PGM_UNLIKELY(!save_error)) { \ pgm_error ("file %s: line %d: error '%s' during '%s'", \ __FILE__, __LINE__, \ pgm_wsastrerror (GetLastError ()), name); \ } \ } while (0) # define win32_check_cmd(cmd) win32_check_err ((cmd), #cmd) #else # error "Uncaught error handling scenario." #endif /* !_WIN32 */ /* only needed for Win32 pre-Vista read-write locks */ PGM_GNUC_INTERNAL void pgm_thread_init (void) { if (pgm_atomic_exchange_and_add32 (&thread_ref_count, 1) > 0) return; #if defined(_WIN32) && !defined(CONFIG_HAVE_WIN_COND) win32_check_cmd (TLS_OUT_OF_INDEXES != (cond_event_tls = TlsAlloc ())); #endif if (pgm_get_nprocs() <= 1) pgm_smp_system = FALSE; } PGM_GNUC_INTERNAL void pgm_thread_shutdown (void) { pgm_return_if_fail (pgm_atomic_read32 (&thread_ref_count) > 0); if (pgm_atomic_exchange_and_add32 (&thread_ref_count, (uint32_t)-1) != 1) return; #if defined(_WIN32) && !defined(CONFIG_HAVE_WIN_COND) TlsFree (cond_event_tls); #endif } /* prefer adaptive-mutexes over regular mutexes, an adaptive mutex is wrapped by * a count-limited spinlock to optimize short waits. * * a mutex here is defined as process-private and contention can be 2 or more threads. * * multiple calls to pgm_mutex_init is undefined. */ PGM_GNUC_INTERNAL void pgm_mutex_init ( pgm_mutex_t* mutex ) { pgm_assert (NULL != mutex); #ifdef PTHREAD_MUTEX_ADAPTIVE_NP /* non-portable but define on Linux & FreeBSD, uses spinlock for 200 spins then waits as mutex */ pthread_mutexattr_t attr; posix_check_cmd (pthread_mutexattr_init (&attr)); pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP); posix_check_cmd (pthread_mutex_init (&mutex->pthread_mutex, &attr)); pthread_mutexattr_destroy (&attr); #elif !defined( _WIN32 ) posix_check_cmd (pthread_mutex_init (&mutex->pthread_mutex, NULL)); #elif defined(CONFIG_HAVE_CRITICAL_SECTION_EX) /* reduce memory consumption on mutexes on Vista+ */ InitializeCriticalSectionEx (&mutex->win32_crit, PGM_ADAPTIVE_MUTEX_SPINCOUNT, CRITICAL_SECTION_NO_DEBUG_INFO); #else /* Windows "mutexes" are default shared, "critical sections" are default process-private */ InitializeCriticalSection (&mutex->win32_crit); SetCriticalSectionSpinCount (&mutex->win32_crit, PGM_ADAPTIVE_MUTEX_SPINCOUNT); #endif } /* multiple calls to pgm_mutex_free is undefined. * call to pgm_mutex_free on locked mutex or non-init pointer is undefined. */ PGM_GNUC_INTERNAL void pgm_mutex_free ( pgm_mutex_t* mutex ) { pgm_assert (NULL != mutex); #ifndef _WIN32 posix_check_cmd (pthread_mutex_destroy (&mutex->pthread_mutex)); #else DeleteCriticalSection (&mutex->win32_crit); #endif /* !_WIN32 */ } /* contention on spin-locks is limited to two threads, a receiving thread and a sending thread. */ PGM_GNUC_INTERNAL void pgm_spinlock_init ( pgm_spinlock_t* spinlock ) { pgm_assert (NULL != spinlock); #ifdef CONFIG_TICKET_SPINLOCK pgm_ticket_init (&spinlock->ticket_lock); #elif defined( CONFIG_HAVE_POSIX_SPINLOCK ) posix_check_cmd (pthread_spin_init (&spinlock->pthread_spinlock, PTHREAD_PROCESS_PRIVATE)); #elif defined( __APPLE__ ) spinlock->darwin_spinlock = OS_SPINLOCK_INIT; #else /* Win32/GCC atomics */ spinlock->taken = 0; #endif } PGM_GNUC_INTERNAL void pgm_spinlock_free ( pgm_spinlock_t* spinlock ) { pgm_assert (NULL != spinlock); #ifdef CONFIG_TICKET_SPINLOCK pgm_ticket_free (&spinlock->ticket_lock); #elif defined( CONFIG_HAVE_POSIX_SPINLOCK ) /* ignore return value */ pthread_spin_destroy (&spinlock->pthread_spinlock); #elif defined(__APPLE__) /* NOP */ #else /* Win32/GCC atomics */ /* NOP */ #endif } PGM_GNUC_INTERNAL void pgm_cond_init ( pgm_cond_t* cond ) { pgm_assert (NULL != cond); #ifndef _WIN32 posix_check_cmd (pthread_cond_init (&cond->pthread_cond, NULL)); #elif defined(CONFIG_HAVE_WIN_COND) /* requires Vista+ */ InitializeConditionVariable (&cond->win32_cond); #else cond->len = 0; cond->allocated_len = pgm_nearest_power (1, 2 + 1); cond->phandle = pgm_new (HANDLE, cond->allocated_len); # if defined(CONFIG_HAVE_CRITICAL_SECTION_EX) /* requires Vista+ */ InitializeCriticalSectionEx (&cond->win32_crit, PGM_ADAPTIVE_MUTEX_SPINCOUNT, CRITICAL_SECTION_NO_DEBUG_INFO); # else InitializeCriticalSection (&cond->win32_crit); SetCriticalSectionSpinCount (&cond->win32_crit, PGM_ADAPTIVE_MUTEX_SPINCOUNT); # endif #endif /* !_WIN32 */ } PGM_GNUC_INTERNAL void pgm_cond_signal ( pgm_cond_t* cond ) { pgm_assert (NULL != cond); #ifndef _WIN32 pthread_cond_signal (&cond->pthread_cond); #elif defined(CONFIG_HAVE_WIN_COND) WakeConditionVariable (&cond->win32_cond); #else EnterCriticalSection (&cond->win32_crit); if (cond->len > 0) { SetEvent (cond->phandle[ 0 ]); memmove (&cond->phandle[ 0 ], &cond->phandle[ 1 ], cond->len - 1); cond->len--; } LeaveCriticalSection (&cond->win32_crit); #endif /* !_WIN32 */ } PGM_GNUC_INTERNAL void pgm_cond_broadcast ( pgm_cond_t* cond ) { pgm_assert (NULL != cond); #ifndef _WIN32 pthread_cond_broadcast (&cond->pthread_cond); #elif defined(CONFIG_HAVE_WIN_COND) WakeAllConditionVariable (&cond->win32_cond); #else EnterCriticalSection (&cond->win32_crit); for (unsigned i = 0; i < cond->len; i++) SetEvent (cond->phandle[ i ]); cond->len = 0; LeaveCriticalSection (&cond->win32_crit); #endif /* !_WIN32 */ } #ifndef _WIN32 PGM_GNUC_INTERNAL void pgm_cond_wait ( pgm_cond_t* cond, pthread_mutex_t* mutex ) { pgm_assert (NULL != cond); pgm_assert (NULL != mutex); pthread_cond_wait (&cond->pthread_cond, mutex); } #else PGM_GNUC_INTERNAL void pgm_cond_wait ( pgm_cond_t* cond, CRITICAL_SECTION* spinlock ) { pgm_assert (NULL != cond); pgm_assert (NULL != spinlock); # if defined(CONFIG_HAVE_WIN_COND) SleepConditionVariableCS (&cond->win32_cond, spinlock, INFINITE); # else DWORD status; HANDLE event = TlsGetValue (cond_event_tls); if (!event) { win32_check_cmd (NULL != (event = CreateEvent (0, FALSE, FALSE, NULL))); TlsSetValue (cond_event_tls, event); } EnterCriticalSection (&cond->win32_crit); pgm_assert (WAIT_TIMEOUT == WaitForSingleObject (event, 0)); if ((cond->len + 1) > cond->allocated_len) { cond->allocated_len = pgm_nearest_power (1, cond->len + 1 + 1); cond->phandle = pgm_realloc (cond->phandle, cond->allocated_len); } cond->phandle[ cond->len++ ] = event; LeaveCriticalSection (&cond->win32_crit); EnterCriticalSection (spinlock); win32_check_cmd (WAIT_FAILED != (status = WaitForSingleObject (event, INFINITE))); LeaveCriticalSection (spinlock); if (WAIT_TIMEOUT == status) { EnterCriticalSection (&cond->win32_crit); for (unsigned i = 0; i < cond->len; i++) { if (cond->phandle[ i ] == event) { if (i != cond->len - 1) memmove (&cond->phandle[ i ], &cond->phandle[ i + 1 ], sizeof(HANDLE) * (cond->len - i - 1)); cond->len--; break; } } win32_check_cmd (WAIT_FAILED != (status = WaitForSingleObject (event, 0))); LeaveCriticalSection (&cond->win32_crit); } # endif /* !CONFIG_HAVE_WIN_COND */ } #endif /* !_WIN32 */ PGM_GNUC_INTERNAL void pgm_cond_free ( pgm_cond_t* cond ) { pgm_assert (NULL != cond); #ifndef _WIN32 posix_check_cmd (pthread_cond_destroy (&cond->pthread_cond)); #elif defined(CONFIG_HAVE_WIN_COND) /* nop */ #else DeleteCriticalSection (&cond->win32_crit); pgm_free (cond->phandle); #endif /* !_WIN32 */ } PGM_GNUC_INTERNAL void pgm_rwlock_init ( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); #if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_init (&rwlock->rwspinlock); #elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) /* requires Vista+ */ InitializeSRWLock (&rwlock->win32_rwlock); #elif !defined( _WIN32 ) posix_check_cmd (pthread_rwlock_init (&rwlock->pthread_rwlock, NULL)); #else # if defined(CONFIG_HAVE_CRITICAL_SECTION_EX) /* requires Vista+ */ InitializeCriticalSectionEx (&rwlock->win32_crit, PGM_ADAPTIVE_MUTEX_SPINCOUNT, CRITICAL_SECTION_NO_DEBUG_INFO); # else InitializeCriticalSection (&rwlock->win32_crit); SetCriticalSectionSpinCount (&rwlock->win32_crit, PGM_ADAPTIVE_MUTEX_SPINCOUNT); # endif pgm_cond_init (&rwlock->read_cond); pgm_cond_init (&rwlock->write_cond); rwlock->read_counter = 0; rwlock->have_writer = FALSE; rwlock->want_to_read = 0; rwlock->want_to_write = 0; #endif /* !CONFIG_HAVE_WIN_SRW_LOCK */ } PGM_GNUC_INTERNAL void pgm_rwlock_free ( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); #if defined( CONFIG_DUMB_RWSPINLOCK ) pgm_rwspinlock_free (&rwlock->rwspinlock); #elif defined( CONFIG_HAVE_WIN_SRW_LOCK ) /* nop */ #elif !defined(_WIN32) pthread_rwlock_destroy (&rwlock->pthread_rwlock); #else pgm_cond_free (&rwlock->read_cond); pgm_cond_free (&rwlock->write_cond); DeleteCriticalSection (&rwlock->win32_crit); #endif /* !CONFIG_HAVE_WIN_SRW_LOCK */ } #if !defined(CONFIG_DUMB_RWSPINLOCK) && !defined(CONFIG_HAVE_WIN_SRW_LOCK) && defined(_WIN32) static inline void _pgm_rwlock_signal ( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); if (rwlock->want_to_write) pgm_cond_signal (&rwlock->write_cond); else if (rwlock->want_to_read) pgm_cond_broadcast (&rwlock->read_cond); } PGM_GNUC_INTERNAL void pgm_rwlock_reader_lock ( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); EnterCriticalSection (&rwlock->win32_crit); rwlock->want_to_read++; while (rwlock->have_writer || rwlock->want_to_write) pgm_cond_wait (&rwlock->read_cond, &rwlock->win32_crit); rwlock->want_to_read--; rwlock->read_counter++; LeaveCriticalSection (&rwlock->win32_crit); } PGM_GNUC_INTERNAL bool pgm_rwlock_reader_trylock ( pgm_rwlock_t* rwlock ) { bool status = FALSE; pgm_assert (NULL != rwlock); EnterCriticalSection (&rwlock->win32_crit); if (!rwlock->have_writer && !rwlock->want_to_write) { rwlock->read_counter++; status = TRUE; } LeaveCriticalSection (&rwlock->win32_crit); return status; } PGM_GNUC_INTERNAL void pgm_rwlock_reader_unlock( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); EnterCriticalSection (&rwlock->win32_crit); rwlock->read_counter--; if (rwlock->read_counter == 0) _pgm_rwlock_signal (rwlock); LeaveCriticalSection (&rwlock->win32_crit); } PGM_GNUC_INTERNAL void pgm_rwlock_writer_lock ( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); EnterCriticalSection (&rwlock->win32_crit); rwlock->want_to_write++; while (rwlock->have_writer || rwlock->read_counter) pgm_cond_wait (&rwlock->write_cond, &rwlock->win32_crit); rwlock->want_to_write--; rwlock->have_writer = TRUE; LeaveCriticalSection (&rwlock->win32_crit); } PGM_GNUC_INTERNAL bool pgm_rwlock_writer_trylock ( pgm_rwlock_t* rwlock ) { bool status = FALSE; pgm_assert (NULL != rwlock); EnterCriticalSection (&rwlock->win32_crit); if (!rwlock->have_writer && !rwlock->read_counter) { rwlock->have_writer = TRUE; status = TRUE; } LeaveCriticalSection (&rwlock->win32_crit); return status; } PGM_GNUC_INTERNAL void pgm_rwlock_writer_unlock ( pgm_rwlock_t* rwlock ) { pgm_assert (NULL != rwlock); EnterCriticalSection (&rwlock->win32_crit); rwlock->have_writer = FALSE; _pgm_rwlock_signal (rwlock); LeaveCriticalSection (&rwlock->win32_crit); } #endif /* !_WIN32 && !CONFIG_HAVE_WIN_SRW_LOCK */ /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/msfec.txt0000644000175000017500000000211411640407354017377 0ustar locallocalFEC parameters for Microsoft's PGM stack FECBlockSize (n) [FECGroupSize+1, 255] Maximum number of packets that can be sent for any group, including original data and parity packets. Maximum and default value is 255. FECProActivePackets Number of packets to send proactively with each group. Use this option when the network is dispersed, and upstream NAK requests are expensive. FECGroupSize (k) [2, 128] Number of packets to be treated as one group for the purpose of computing parity packets. Group size must be a power of two. In lossy networks, keep the group size relatively small. fFECOnDemandParityEnabled Specifies whether the sender is enabled for sending parity repair packets. When TRUE, receivers should only request parity repair packets. Reed Solomon codes: encode/decode time (us) RS(255, 2) 4/6 RS(255, 4) 7/10 RS(255, 8) 14/18 RS(255, 16) 29/34 RS(255, 32) 57/64 RS(255, 64) 119/134 RS(255, 128) 236/fail(278) reference platform: Intel Xeon CPU 3.20Ghz Implementation exact copy of Luigi Rizzo FEC code as demonstrated in RMDP: http://info.iet.unipi.it/~luigi/fec.html libpgm-5.1.118-1~dfsg/openpgm/pgm/timer.c0000644000175000017500000001462611640407354017040 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM timer thread. * * Copyright (c) 2006-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include //#define TIMER_DEBUG /* determine which timer fires next: spm (ihb_tmr), nak_rb_ivl, nak_rpt_ivl, or nak_rdata_ivl * and check whether its already due. * * called in sock creation so locks unrequired. */ PGM_GNUC_INTERNAL bool pgm_timer_prepare ( pgm_sock_t* const sock ) { pgm_time_t now, expiration; int32_t msec; /* pre-conditions */ pgm_assert (NULL != sock); pgm_assert (sock->can_send_data || sock->can_recv_data); now = pgm_time_update_now(); if (sock->can_send_data) expiration = sock->next_ambient_spm; else expiration = now + sock->peer_expiry; sock->next_poll = expiration; /* advance time again to adjust for processing time out of the event loop, this * could cause further timers to expire even before checking for new wire data. */ msec = (int32_t)pgm_to_msecs ((int64_t)expiration - (int64_t)now); if (msec < 0) msec = 0; else msec = MIN (INT32_MAX, msec); pgm_trace (PGM_LOG_ROLE_NETWORK,_("Next expiration in %" PRIi32 "ms"), msec); return (msec == 0); } PGM_GNUC_INTERNAL bool pgm_timer_check ( pgm_sock_t* const sock ) { const pgm_time_t now = pgm_time_update_now(); bool expired; /* pre-conditions */ pgm_assert (NULL != sock); pgm_timer_lock (sock); expired = pgm_time_after_eq (now, sock->next_poll); pgm_timer_unlock (sock); return expired; } /* return next timer expiration in microseconds (μs) */ PGM_GNUC_INTERNAL pgm_time_t pgm_timer_expiration ( pgm_sock_t* const sock ) { const pgm_time_t now = pgm_time_update_now(); pgm_time_t expiration; /* pre-conditions */ pgm_assert (NULL != sock); pgm_timer_lock (sock); expiration = pgm_time_after (sock->next_poll, now) ? pgm_to_usecs (sock->next_poll - now) : 0; pgm_timer_unlock (sock); return expiration; } /* call all timers, assume that time_now has been updated by either pgm_timer_prepare * or pgm_timer_check and no other method calls here. * * returns TRUE on success, returns FALSE on blocked send-in-receive operation. */ PGM_GNUC_INTERNAL bool pgm_timer_dispatch ( pgm_sock_t* const sock ) { const pgm_time_t now = pgm_time_update_now(); pgm_time_t next_expiration = 0; /* pre-conditions */ pgm_assert (NULL != sock); pgm_debug ("pgm_timer_dispatch (sock:%p)", (const void*)sock); /* find which timers have expired and call each */ if (sock->can_recv_data) { if (!pgm_check_peer_state (sock, now)) return FALSE; next_expiration = pgm_min_receiver_expiry (sock, now + sock->peer_expiry); } if (sock->can_send_data) { /* reset congestion control on ACK timeout */ if (sock->use_pgmcc && sock->tokens < pgm_fp8 (1) && 0 != sock->ack_expiry) { if (pgm_time_after_eq (now, sock->ack_expiry)) { #ifdef DEBUG_PGMCC char nows[1024]; time_t t = time (NULL); struct tm* tmp = localtime (&t); strftime (nows, sizeof(nows), "%Y-%m-%d %H:%M:%S", tmp); printf ("ACK timeout, T:%u W:%u\n", pgm_fp8tou(sock->tokens), pgm_fp8tou(sock->cwnd_size)); #endif sock->tokens = sock->cwnd_size = pgm_fp8 (1); sock->ack_bitmap = 0xffffffff; sock->ack_expiry = 0; /* notify blocking tx thread that transmission time is now available */ pgm_notify_send (&sock->ack_notify); } next_expiration = next_expiration > 0 ? MIN(next_expiration, sock->ack_expiry) : sock->ack_expiry; } /* SPM broadcast */ pgm_mutex_lock (&sock->timer_mutex); const unsigned spm_heartbeat_state = sock->spm_heartbeat_state; const pgm_time_t next_heartbeat_spm = sock->next_heartbeat_spm; pgm_mutex_unlock (&sock->timer_mutex); /* no lock needed on ambient */ const pgm_time_t next_ambient_spm = sock->next_ambient_spm; pgm_time_t next_spm = spm_heartbeat_state ? MIN(next_heartbeat_spm, next_ambient_spm) : next_ambient_spm; if (pgm_time_after_eq (now, next_spm) && !pgm_send_spm (sock, 0)) return FALSE; /* ambient timing not so important so base next event off current time */ if (pgm_time_after_eq (now, next_ambient_spm)) { sock->next_ambient_spm = now + sock->spm_ambient_interval; next_spm = spm_heartbeat_state ? MIN(next_heartbeat_spm, sock->next_ambient_spm) : sock->next_ambient_spm; } /* heartbeat timing is often high resolution so base times to last event */ if (spm_heartbeat_state && pgm_time_after_eq (now, next_heartbeat_spm)) { unsigned new_heartbeat_state = spm_heartbeat_state; pgm_time_t new_heartbeat_spm = next_heartbeat_spm; do { new_heartbeat_spm += sock->spm_heartbeat_interval[new_heartbeat_state++]; if (new_heartbeat_state == sock->spm_heartbeat_len) { new_heartbeat_state = 0; new_heartbeat_spm = now + sock->spm_ambient_interval; break; } } while (pgm_time_after_eq (now, new_heartbeat_spm)); /* check for reset heartbeat */ pgm_mutex_lock (&sock->timer_mutex); if (next_heartbeat_spm == sock->next_heartbeat_spm) { sock->spm_heartbeat_state = new_heartbeat_state; sock->next_heartbeat_spm = new_heartbeat_spm; next_spm = MIN(sock->next_ambient_spm, new_heartbeat_spm); } else next_spm = MIN(sock->next_ambient_spm, sock->next_heartbeat_spm); sock->next_poll = next_expiration > 0 ? MIN(next_expiration, next_spm) : next_spm; pgm_mutex_unlock (&sock->timer_mutex); return TRUE; } next_expiration = next_expiration > 0 ? MIN(next_expiration, next_spm) : next_spm; /* check for reset */ pgm_mutex_lock (&sock->timer_mutex); sock->next_poll = sock->next_poll > now ? MIN(sock->next_poll, next_expiration) : next_expiration; pgm_mutex_unlock (&sock->timer_mutex); } else sock->next_poll = next_expiration; return TRUE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.Debian40000644000175000017500000002032111640407354021040 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import os import time import sys EnsureSConsVersion( 0, 97 ) SConsignFile('scons.signatures'); opt = Options(None, ARGUMENTS) opt.AddOptions ( (EnumOption ('BUILD', 'build environment', 'debug', ('release', 'debug', 'profile'))), (EnumOption ('BRANCH', 'branch prediction', 'none', ('none', 'profile', 'seed'))), (EnumOption ('COVERAGE', 'test coverage', 'none', ('none', 'full'))), (EnumOption ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', ('true', 'false'))), (EnumOption ('WITH_HTTP', 'HTTP administration', 'true', ('true', 'false'))), (EnumOption ('WITH_SNMP', 'SNMP administration', 'true', ('true', 'false'))), (EnumOption ('WITH_CHECK', 'Check test system', 'false', ('true', 'false'))), (EnumOption ('WITH_TEST', 'Network test system', 'false', ('true', 'false'))), (EnumOption ('WITH_EXAMPLES', 'Examples', 'true', ('true', 'false'))), (EnumOption ('WITH_NCURSES', 'NCURSES examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', ('true', 'false'))), (EnumOption ('WITH_PLUS', 'libpgmplus GPL library', 'false', ('true', 'false'))), ) #----------------------------------------------------------------------------- # Dependencies env = Environment(); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment(ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', '-Winline', '-pedantic', '-std=gnu99', '--param', 'max-inline-insns-single=600', '-D_REENTRANT', '-D_GNU_SOURCE', '-D__need_IOV_MAX', '-DCONFIG_16BIT_CHECKSUM', '-DCONFIG_HAVE_PROC', '-DCONFIG_HAVE_BACKTRACE', '-DCONFIG_HAVE_PSELECT', '-DCONFIG_HAVE_POLL', '-DCONFIG_HAVE_EPOLL', '-DCONFIG_HAVE_CLOCK_GETTIME', '-DCONFIG_HAVE_CLOCK_NANOSLEEP', '-DCONFIG_HAVE_NANOSLEEP', '-DCONFIG_HAVE_USLEEP', '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', '-DCONFIG_HAVE_IFR_NETMASK', '-DCONFIG_HAVE_GETIFADDRS', '-DCONFIG_HAVE_GETHOSTBYNAME2', '-DCONFIG_HAVE_GETPROTOBYNAME_R', '-DCONFIG_HAVE_MCAST_JOIN', '-DCONFIG_HAVE_IP_MREQN', '-DCONFIG_HAVE_DSO_VISIBILITY', '-DCONFIG_BIND_INADDR_ANY', '-DCONFIG_GALOIS_MUL_LUT', ], LINKFLAGS = [ '-pipe', '-lm' ] ) opt.Update (env) # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = '-ggdb', LINKFLAGS = '-gdb') profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment env.ParseConfig('pkg-config --cflags --libs glib-2.0 gthread-2.0'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp env['SNMP_FLAGS'] = { 'CCFLAGS' : [], 'LIBS' : [ 'netsnmpagent', 'netsnmpmibs', 'netsnmphelpers', 'netsnmp' ], }; def CheckSNMP(context): context.Message('Checking Net-SNMP...'); lastLIBS = context.env['LIBS']; lastCCFLAGS= context.env['CCFLAGS']; context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); context.env.Replace(LIBS = lastLIBS, CCFLAGS=lastCCFLAGS); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Enabling extra Red Hat dependencies for Net-SNMP.'; conf.env['SNMP_FLAGS']['LIBS'].append(['librpm', 'libsensors', 'libdl', 'libwrap']); lastLIBS = conf.env['LIBS']; conf.env.ParseConfig('perl -MExtUtils::Embed -e ldopts'); conf.env['SNMP_FLAGS']['LIBS'].append(conf.env['LIBS']); conf.env.Replace(LIBS = lastLIBS); if not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # DSO visibility flags if '-DCONFIG_HAVE_DSO_VISIBILITY' in env['CCFLAGS']: env.Append(CCFLAGS = '-DPGM_GNUC_INTERNAL=G_GNUC_INTERNAL') else: env.Append(CCFLAGS = '-DPGM_GNUC_INTERNAL=') # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); SConscript(ref_node + 'SConscript.libpgm'); SConscript(ref_node + 'SConscript.libpgmex'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/list.c0000644000175000017500000000537311640407354016672 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable doubly-linked list. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include //#define LIST_DEBUG PGM_GNUC_INTERNAL pgm_list_t* pgm_list_append ( pgm_list_t* restrict list, void* restrict data ) { pgm_list_t* new_list; pgm_list_t* last; new_list = pgm_new (pgm_list_t, 1); new_list->data = data; new_list->next = NULL; if (list) { last = pgm_list_last (list); last->next = new_list; new_list->prev = last; return list; } else { new_list->prev = NULL; return new_list; } } PGM_GNUC_INTERNAL pgm_list_t* pgm_list_prepend_link ( pgm_list_t* restrict list, pgm_list_t* restrict link_ ) { pgm_list_t* new_list = link_; pgm_return_val_if_fail (NULL != link_, list); new_list->next = list; new_list->prev = NULL; if (list) list->prev = new_list; return new_list; } static inline pgm_list_t* _pgm_list_remove_link ( pgm_list_t* list, /* list and link_ may be the same */ pgm_list_t* link_ ) { if (PGM_LIKELY (NULL != link_)) { if (link_->prev) link_->prev->next = link_->next; if (link_->next) link_->next->prev = link_->prev; if (link_ == list) list = list->next; link_->next = link_->prev = NULL; } return list; } PGM_GNUC_INTERNAL pgm_list_t* pgm_list_remove_link ( pgm_list_t* list, /* list and link_ may be the same */ pgm_list_t* link_ ) { return _pgm_list_remove_link (list, link_); } PGM_GNUC_INTERNAL pgm_list_t* pgm_list_delete_link ( pgm_list_t* list, /* list and link_ may be the same */ pgm_list_t* link_ ) { pgm_list_t* new_list = _pgm_list_remove_link (list, link_); pgm_free (link_); return new_list; } /* Has pure attribute as NULL is a valid list */ PGM_GNUC_INTERNAL pgm_list_t* pgm_list_last ( pgm_list_t* list ) { if (PGM_LIKELY (NULL != list)) { while (list->next) list = list->next; } return list; } PGM_GNUC_INTERNAL unsigned pgm_list_length ( pgm_list_t* list ) { unsigned length = 0; while (list) { length++; list = list->next; } return length; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConscript.libpgmex0000644000175000017500000000034011640407354021360 0ustar locallocal# -*- mode: python -*- # OpenPGM build script # $Id$ Import('env') e = env.Clone(); e.MergeFlags(env['GLIB_FLAGS']); src = Split(""" log.c backtrace.c signal.c """) e.StaticLibrary('libpgmex', src); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/gsi.c0000644000175000017500000001361111640407354016473 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * global session ID helper functions. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #ifndef _WIN32 # include #endif #include #include //#define GSI_DEBUG /* create a GSI based on md5 of a user provided data block. * * returns TRUE on success, returns FALSE on error and sets error appropriately, */ bool pgm_gsi_create_from_data ( pgm_gsi_t* restrict gsi, const uint8_t* restrict data, const size_t length ) { pgm_return_val_if_fail (NULL != gsi, FALSE); pgm_return_val_if_fail (NULL != data, FALSE); pgm_return_val_if_fail (length > 1, FALSE); #ifdef CONFIG_HAVE_GLIB_CHECKSUM GChecksum* checksum = g_checksum_new (G_CHECKSUM_MD5); pgm_return_val_if_fail (NULL != checksum, FALSE); g_checksum_update (checksum, data, length); memcpy (gsi, g_checksum_get_string (checksum) + 10, 6); g_checksum_free (checksum); #else struct pgm_md5_t ctx; char resblock[16]; pgm_md5_init_ctx (&ctx); pgm_md5_process_bytes (&ctx, data, length); pgm_md5_finish_ctx (&ctx, resblock); memcpy (gsi, resblock + 10, 6); #endif return TRUE; } bool pgm_gsi_create_from_string ( pgm_gsi_t* restrict gsi, const char* restrict str, ssize_t length /* -1 for NULL terminated */ ) { pgm_return_val_if_fail (NULL != gsi, FALSE); pgm_return_val_if_fail (NULL != str, FALSE); if (length < 0) length = strlen (str); return pgm_gsi_create_from_data (gsi, (const uint8_t*)str, length); } /* create a global session ID as recommended by the PGM draft specification using * low order 48 bits of md5 of the hostname. * * returns TRUE on success, returns FALSE on error and sets error appropriately, */ bool pgm_gsi_create_from_hostname ( pgm_gsi_t* restrict gsi, pgm_error_t** restrict error ) { pgm_return_val_if_fail (NULL != gsi, FALSE); char hostname[NI_MAXHOST]; int retval = gethostname (hostname, sizeof(hostname)); if (0 != retval) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Resolving hostname: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno) ); return FALSE; } return pgm_gsi_create_from_string (gsi, hostname, -1); } /* create a global session ID based on the IP address. * * returns TRUE on succcess, returns FALSE on error and sets error. */ bool pgm_gsi_create_from_addr ( pgm_gsi_t* restrict gsi, pgm_error_t** restrict error ) { char hostname[NI_MAXHOST]; struct addrinfo hints, *res = NULL; pgm_return_val_if_fail (NULL != gsi, FALSE); int retval = gethostname (hostname, sizeof(hostname)); if (0 != retval) { const int save_errno = pgm_get_last_sock_error(); char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_sock_errno (save_errno), _("Resolving hostname: %s"), pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno) ); return FALSE; } memset (&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_flags = AI_ADDRCONFIG; retval = getaddrinfo (hostname, NULL, &hints, &res); if (0 != retval) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_eai_errno (retval, errno), _("Resolving hostname address: %s"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), retval)); return FALSE; } /* NB: getaddrinfo may return multiple addresses, one per interface & family, only the first * return result is used. The sorting order of the list defined by RFC 3484 and /etc/gai.conf */ memcpy (gsi, &((struct sockaddr_in*)(res->ai_addr))->sin_addr, sizeof(struct in_addr)); freeaddrinfo (res); const uint16_t random_val = pgm_random_int_range (0, UINT16_MAX); memcpy ((uint8_t*)gsi + sizeof(struct in_addr), &random_val, sizeof(random_val)); return TRUE; } /* re-entrant form of pgm_gsi_print() * * returns number of bytes written to buffer on success, returns -1 on * invalid parameters. */ int pgm_gsi_print_r ( const pgm_gsi_t* restrict gsi, char* restrict buf, const size_t bufsize ) { const uint8_t* restrict src = (const uint8_t* restrict)gsi; pgm_return_val_if_fail (NULL != gsi, -1); pgm_return_val_if_fail (NULL != buf, -1); pgm_return_val_if_fail (bufsize > 0, -1); return pgm_snprintf_s (buf, bufsize, _TRUNCATE, "%u.%u.%u.%u.%u.%u", src[0], src[1], src[2], src[3], src[4], src[5]); } /* transform GSI to ASCII string form. * * on success, returns pointer to ASCII string. on error, returns NULL. */ char* pgm_gsi_print ( const pgm_gsi_t* gsi ) { static char buf[PGM_GSISTRLEN]; pgm_return_val_if_fail (NULL != gsi, NULL); pgm_gsi_print_r (gsi, buf, sizeof(buf)); return buf; } /* compare two global session identifier GSI values and return TRUE if they are equal */ bool pgm_gsi_equal ( const void* restrict p1, const void* restrict p2 ) { const union { pgm_gsi_t gsi; uint16_t s[3]; } *u1 = p1, *u2 = p2; /* pre-conditions */ pgm_assert (NULL != p1); pgm_assert (NULL != p2); return (u1->s[0] == u2->s[0] && u1->s[1] == u2->s[1] && u1->s[2] == u2->s[2]); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/getnodeaddr.c.c89.patch0000644000175000017500000000370211640407354021671 0ustar locallocal--- getnodeaddr.c 2011-03-23 14:15:10.000000000 +0800 +++ getnodeaddr.c89.c 2011-03-23 14:14:38.000000000 +0800 @@ -56,6 +56,7 @@ pgm_debug ("pgm_getnodeaddr (family:%s res:%p error:%p)", pgm_family_string (family), (const void*)res, (const void*)error); + { char hostname[NI_MAXHOST + 1]; struct hostent* he; @@ -71,14 +72,16 @@ return FALSE; } - struct addrinfo hints = { - .ai_family = family, - .ai_socktype = SOCK_STREAM, /* not really */ - .ai_protocol = IPPROTO_TCP, /* not really */ - .ai_flags = AI_ADDRCONFIG, - }, *result, *ai; + { + int e; + struct addrinfo hints, *result, *ai; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = family, + hints.ai_socktype = SOCK_STREAM, /* not really */ + hints.ai_protocol = IPPROTO_TCP, /* not really */ + hints.ai_flags = AI_ADDRCONFIG; - int e = getaddrinfo (hostname, NULL, &hints, &result); + e = getaddrinfo (hostname, NULL, &hints, &result); if (0 == e) { /* NB: getaddrinfo may return multiple addresses, the sorting order of the * list defined by RFC 3484 and /etc/gai.conf @@ -93,6 +96,7 @@ } na = pgm_malloc0 (na_len); + { char* p = (char*)na + na_len; /* point to end of block */ struct addrinfo* prev = NULL; @@ -104,14 +108,17 @@ continue; p -= ai->ai_addrlen; memcpy (p, ai->ai_addr, ai->ai_addrlen); + { struct addrinfo* t = (struct addrinfo*)(p - sizeof (struct addrinfo)); t->ai_family = ai->ai_family; t->ai_addrlen = ai->ai_addrlen; t->ai_addr = (struct sockaddr*)p; t->ai_next = prev; prev = t; + } p -= sizeof (struct addrinfo); } + } freeaddrinfo (result); *res = na; return TRUE; @@ -152,7 +159,9 @@ ); return FALSE; } + } + { struct pgm_ifaddrs_t *ifap, *ifa, *ifa6; if (!pgm_getifaddrs (&ifap, error)) { pgm_prefix_error (error, @@ -205,6 +214,8 @@ memcpy (na->ai_addr, ifa6->ifa_addr, na->ai_addrlen); pgm_freeifaddrs (ifap); *res = na; + } + } return TRUE; } libpgm-5.1.118-1~dfsg/openpgm/pgm/if.c0000644000175000017500000015530611640407354016317 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * network interface handling. * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include #include #include #ifndef _WIN32 # include # include # include /* _GNU_SOURCE for EAI_NODATA */ #endif #include #include #include //#define IF_DEBUG /* temporary structure to contain interface name whilst address family * has not been resolved. */ struct interface_req { char ir_name[IF_NAMESIZE]; unsigned int ir_flags; /* from SIOCGIFFLAGS */ unsigned int ir_interface; /* interface index */ struct sockaddr_storage ir_addr; /* interface address */ }; /* locals */ #ifndef _WIN32 # define IF_DEFAULT_GROUP ((in_addr_t)0xefc00001) /* 239.192.0.1 */ #else # define IF_DEFAULT_GROUP ((u_long)0xefc00001) #endif /* ff08::1 */ #define IF6_DEFAULT_INIT { { { 0xff,8,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } const struct in6_addr if6_default_group_addr = IF6_DEFAULT_INIT; static inline bool is_in_net (const struct in_addr*restrict, const struct in_addr*restrict, const struct in_addr*restrict) PGM_GNUC_WARN_UNUSED_RESULT; static inline bool is_in_net6 (const struct in6_addr*restrict, const struct in6_addr*restrict, const struct in6_addr*restrict) PGM_GNUC_WARN_UNUSED_RESULT; static inline bool is_network_char (const int, const char) PGM_GNUC_CONST; static const char* pgm_family_string (const int) PGM_GNUC_CONST; /* recommended address space for multicast: * rfc4607, rfc3180, rfc2365 * * avoid 5 high-order bit overlap. * * loopback: ffx1::/16 * segment: ffx2::/16 * glop: 238/8 * mysterious admin: 239/8, ffx6::/16 * site: 239.252-255/16, ffx5::/16 * org: 239.192/14, ffx8::/16 * * internets: 224.0.1.0-238.255.255.255, ffxe::/16 */ /* dump all interfaces to console. * * note that interface indexes are only in regard to the link layer and hence * no 1-1 mapping between adapter name to index back to address. */ void pgm_if_print_all (void) { struct pgm_ifaddrs_t *ifap, *ifa; struct pgm_addrinfo_t* res = NULL; if (!pgm_getifaddrs (&ifap, NULL)) return; for (ifa = ifap; ifa; ifa = ifa->ifa_next) { const unsigned int i = NULL == ifa->ifa_addr ? 0 : pgm_if_nametoindex (ifa->ifa_addr->sa_family, ifa->ifa_name); char rname[IF_NAMESIZE * 2 + 3]; char buf[IF_NAMESIZE * 2 + 3]; pgm_if_indextoname (i, rname); pgm_snprintf_s (buf, sizeof (buf), _TRUNCATE, "%s (%s)", ifa->ifa_name ? ifa->ifa_name : "(null)", rname); if (NULL == ifa->ifa_addr || (ifa->ifa_addr->sa_family != AF_INET && ifa->ifa_addr->sa_family != AF_INET6) ) { pgm_info (_("#%d name %-15.15s ---- %-46.46s scope 0 status %s loop %s b/c %s m/c %s"), i, buf, "", ifa->ifa_flags & IFF_UP ? "UP " : "DOWN", ifa->ifa_flags & IFF_LOOPBACK ? "YES" : "NO ", ifa->ifa_flags & IFF_BROADCAST ? "YES" : "NO ", ifa->ifa_flags & IFF_MULTICAST ? "YES" : "NO " ); continue; } char saddr[INET6_ADDRSTRLEN]; getnameinfo (ifa->ifa_addr, pgm_sockaddr_len(ifa->ifa_addr), saddr, sizeof(saddr), NULL, 0, NI_NUMERICHOST); pgm_info (_("#%d name %-15.15s IPv%i %-46.46s scope %u status %s loop %s b/c %s m/c %s"), i, buf, ifa->ifa_addr->sa_family == AF_INET ? 4 : 6, saddr, (unsigned)pgm_sockaddr_scope_id(ifa->ifa_addr), ifa->ifa_flags & IFF_UP ? "UP " : "DOWN", ifa->ifa_flags & IFF_LOOPBACK ? "YES" : "NO ", ifa->ifa_flags & IFF_BROADCAST ? "YES" : "NO ", ifa->ifa_flags & IFF_MULTICAST ? "YES" : "NO " ); } pgm_freeifaddrs (ifap); /* discover default network parameter */ if (pgm_getaddrinfo ("", NULL, &res, NULL)) { char network[INET6_ADDRSTRLEN], group[INET6_ADDRSTRLEN]; struct sockaddr_storage ifaddr; struct sockaddr* addr = (struct sockaddr*)&res->ai_recv_addrs[0].gsr_group; pgm_get_multicast_enabled_node_addr (addr->sa_family, (struct sockaddr*)&ifaddr, sizeof (ifaddr), NULL); pgm_sockaddr_ntop ((struct sockaddr*)&ifaddr, network, sizeof (network)); if (AF_INET == addr->sa_family) { struct sockaddr_in sin; memset (&sin, 0, sizeof (sin)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl (IF_DEFAULT_GROUP); memcpy (&ifaddr, &sin, sizeof (sin)); } else if (AF_INET6 == addr->sa_family) { struct sockaddr_in6 sin6; memset (&sin6, 0, sizeof (sin6)); sin6.sin6_family = AF_INET6; memcpy (&sin6.sin6_addr, &if6_default_group_addr, sizeof(if6_default_group_addr)); memcpy (&ifaddr, &sin6, sizeof (sin6)); } else memset (&ifaddr, 0, sizeof (ifaddr)); pgm_sockaddr_ntop ((struct sockaddr*)&ifaddr, group, sizeof (group)); pgm_info (_("Default network: \"%s;%s\""), network, group); pgm_freeaddrinfo (res); } } /* Equivalent to the description of inet_lnaof(), extract the host * address out of an IP address. * hostaddr = inet_lnaof(addr) * * nb: lnaof = local network address of * * returns TRUE if host address is defined, FALSE if only network address. */ static inline bool pgm_inet_lnaof ( struct in_addr* restrict dst, /* host byte order */ const struct in_addr* restrict src, const struct in_addr* restrict netmask ) { bool has_lna = FALSE; pgm_assert (NULL != dst); pgm_assert (NULL != src); pgm_assert (NULL != netmask); dst->s_addr = src->s_addr & netmask->s_addr; has_lna = (0 != (src->s_addr & ~netmask->s_addr)); return has_lna; } static inline bool pgm_inet6_lnaof ( struct in6_addr* restrict dst, const struct in6_addr* restrict src, const struct in6_addr* restrict netmask ) { bool has_lna = FALSE; pgm_assert (NULL != dst); pgm_assert (NULL != src); pgm_assert (NULL != netmask); for (unsigned i = 0; i < 16; i++) { dst->s6_addr[i] = src->s6_addr[i] & netmask->s6_addr[i]; has_lna |= (0 != (src->s6_addr[i] & !netmask->s6_addr[i])); } return has_lna; } static inline bool is_in_net ( const struct in_addr* restrict addr, /* host byte order */ const struct in_addr* restrict netaddr, const struct in_addr* restrict netmask ) { pgm_assert (NULL != addr); pgm_assert (NULL != netaddr); pgm_assert (NULL != netmask); #ifdef IF_DEBUG const struct in_addr taddr = { .s_addr = htonl (addr->s_addr) }; const struct in_addr tnetaddr = { .s_addr = htonl (netaddr->s_addr) }; const struct in_addr tnetmask = { .s_addr = htonl (netmask->s_addr) }; char saddr[INET_ADDRSTRLEN], snetaddr[INET_ADDRSTRLEN], snetmask[INET_ADDRSTRLEN]; pgm_debug ("is_in_net (addr:%s netaddr:%s netmask:%s)", pgm_inet_ntop (AF_INET, &taddr, saddr, sizeof(saddr)), pgm_inet_ntop (AF_INET, &tnetaddr, snetaddr, sizeof(snetaddr)), pgm_inet_ntop (AF_INET, &tnetmask, snetmask, sizeof(snetmask))); #endif if ((addr->s_addr & netmask->s_addr) == (netaddr->s_addr & netmask->s_addr)) return TRUE; return FALSE; } static bool is_in_net6 ( const struct in6_addr* restrict addr, const struct in6_addr* restrict netaddr, const struct in6_addr* restrict netmask ) { pgm_assert (NULL != addr); pgm_assert (NULL != netaddr); pgm_assert (NULL != netmask); #ifdef IF_DEBUG char saddr[INET6_ADDRSTRLEN], snetaddr[INET6_ADDRSTRLEN], snetmask[INET6_ADDRSTRLEN]; pgm_debug ("is_in_net6 (addr:%s netaddr:%s netmask:%s)", pgm_inet_ntop (AF_INET6, addr, saddr, sizeof(saddr)), pgm_inet_ntop (AF_INET6, netaddr, snetaddr, sizeof(snetaddr)), pgm_inet_ntop (AF_INET6, netmask, snetmask, sizeof(snetmask))); #endif for (unsigned i = 0; i < 16; i++) if ((addr->s6_addr[i] & netmask->s6_addr[i]) != (netaddr->s6_addr[i] & netmask->s6_addr[i])) return FALSE; return TRUE; } /* parse interface entity into an interface-request structure. * * e.g. eth0 * 1.2.3.4 * 1.2 * abcd:: * [abcd::] * * * * special addresses should be ignored: * * local physical link: 169.254.0.0/16, fe80::/64 * broadcast: 255.255.255.255 * multicast: 224.0.0.0/4 (224.0.0.0 to 239.255.255.255), ff00::/8 * * We could use if_nametoindex() but we might as well check that the interface is * actually UP and capable of multicast traffic. * * returns TRUE on success, FALSE on error and sets error appropriately. */ static bool parse_interface ( int family, /* AF_UNSPEC | AF_INET | AF_INET6 */ const char* restrict ifname, /* NULL terminated */ struct interface_req* restrict ir, /* location to write interface details to */ pgm_error_t** restrict error ) { bool check_inet_network = FALSE, check_inet6_network = FALSE; bool check_addr = FALSE; bool check_ifname = FALSE; char literal[1024]; struct in_addr in_addr; struct sockaddr_in6 sa6_addr; struct pgm_ifaddrs_t *ifap, *ifa; struct sockaddr_storage addr_storage, *addr = &addr_storage; unsigned addr_cnt = 1, interface_matches = 0; /* pre-conditions */ pgm_assert (AF_INET == family || AF_INET6 == family || AF_UNSPEC == family); pgm_assert (NULL != ifname); pgm_assert (NULL != ir); pgm_debug ("parse_interface (family:%s ifname:%s%s%s ir:%p error:%p)", pgm_family_string (family), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : "", (const void*)ir, (const void*)error); /* strip any square brackets for IPv6 early evaluation */ if (AF_INET != family && '[' == ifname[0]) { const size_t ifnamelen = strlen (ifname); if (']' == ifname[ ifnamelen - 1 ]) { pgm_strncpy_s (literal, sizeof (literal), ifname + 1, ifnamelen - 2); family = AF_INET6; /* force IPv6 evaluation */ check_inet6_network = TRUE; /* may be a network IP or CIDR block */ check_addr = TRUE; /* cannot be not a name */ ifname = literal; } } /* network address: in_addr in host byte order */ if (AF_INET6 != family && 0 == pgm_inet_network (ifname, &in_addr)) { #ifdef IF_DEBUG struct in_addr t = { .s_addr = htonl (in_addr.s_addr) }; pgm_debug ("IPv4 network address: %s", inet_ntoa (t)); #endif if (IN_MULTICAST(in_addr.s_addr)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Expecting network interface address, found IPv4 multicast network %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } struct sockaddr_in s4; memset (&s4, 0, sizeof(s4)); s4.sin_family = AF_INET; s4.sin_addr.s_addr = htonl (in_addr.s_addr); memcpy (addr, &s4, sizeof(s4)); check_inet_network = TRUE; check_addr = TRUE; } if (AF_INET != family && 0 == pgm_sa6_network (ifname, &sa6_addr)) { if (IN6_IS_ADDR_MULTICAST(&sa6_addr.sin6_addr)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Expecting network interface address, found IPv6 multicast network %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } memcpy (addr, &sa6_addr, sizeof (sa6_addr)); check_inet6_network = TRUE; check_addr = TRUE; } /* numeric host with scope id */ if (!check_addr) { char errbuf[1024]; struct addrinfo hints = { .ai_family = family, .ai_socktype = SOCK_STREAM, /* not really, SOCK_RAW */ .ai_protocol = IPPROTO_TCP, /* not really, IPPROTO_PGM */ .ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST /* AI_V4MAPPED is unhelpful */ }, *res; const int eai = getaddrinfo (ifname, NULL, &hints, &res); switch (eai) { case 0: if (AF_INET == res->ai_family && IN_MULTICAST(ntohl (((struct sockaddr_in*)(res->ai_addr))->sin_addr.s_addr))) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Expecting interface address, found IPv4 multicast address %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); freeaddrinfo (res); return FALSE; } else if (AF_INET6 == res->ai_family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Expecting interface address, found IPv6 multicast address %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); freeaddrinfo (res); return FALSE; } memcpy (addr, res->ai_addr, pgm_sockaddr_len (res->ai_addr)); freeaddrinfo (res); check_addr = TRUE; break; #if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME case EAI_NODATA: #endif case EAI_NONAME: break; default: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_eai_errno (eai, errno), _("Numeric host resolution: %s(%d)"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), eai), eai); return FALSE; } } /* network name into network address, can be expensive with NSS network lookup * * Only Class A, B or C networks are supported, partitioned networks * (i.e. network/26 or network/28) are not supported by this facility. */ if (!(check_inet_network || check_inet6_network)) { const struct pgm_netent_t* ne = pgm_getnetbyname (ifname); /* ne::n_net in host byte order */ if (ne) { switch (ne->n_net.ss_family) { case AF_INET: { struct sockaddr_in sa; if (AF_INET6 == family) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("IP address family conflict when resolving network name %s%s%s, found AF_INET when AF_INET6 expected."), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } memcpy (&sa, &ne->n_net, sizeof (sa)); /* ne->n_net in network order */ in_addr.s_addr = sa.sin_addr.s_addr; if (IN_MULTICAST(in_addr.s_addr)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Network name %s%s%s resolves to IPv4 mulicast address."), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } check_inet_network = TRUE; check_addr = TRUE; break; } case AF_INET6: { #ifdef CONFIG_HAVE_GETNETENT pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("Not configured for IPv6 network name support, %s%s%s is an IPv6 network name."), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; #else if (AF_INET == family) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("IP address family conflict when resolving network name %s%s%s, found AF_INET6 when AF_INET expected."), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } memcpy (&sa6_addr, &ne->n_net, sizeof (sa6_addr)); if (IN6_IS_ADDR_MULTICAST(&sa6_addr.sin6_addr)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Network name resolves to IPv6 mulicast address %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } check_inet6_network = TRUE; check_addr = TRUE; break; #endif } default: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("Network name resolves to non-internet protocol address family %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); return FALSE; } } } /* hostname lookup with potential DNS delay or error */ if (!check_addr) { char errbuf[1024]; struct addrinfo hints = { .ai_family = family, .ai_socktype = SOCK_STREAM, /* not really, SOCK_RAW */ .ai_protocol = IPPROTO_TCP, /* not really, IPPROTO_PGM */ .ai_flags = AI_ADDRCONFIG, /* AI_V4MAPPED is unhelpful */ }, *result, *res; const int eai = getaddrinfo (ifname, NULL, &hints, &result); switch (eai) { case 0: /* NB: getaddrinfo may return multiple addresses, one per interface & family. * The sorting order of the list defined by RFC 3484 and /etc/gai.conf. * * Ex. hinano 127.0.1.1 // default Linux DHCP address due to lack of IPv4 link-local addressing * hinano 10.6.15.88 // IPv4 address provided by DHCP * * Address 127.0.1.1 should be ignored as it is not multicast capable. */ if (NULL != result->ai_next) /* more than one result */ { addr_cnt = 0; for (res = result; NULL != res; res = res->ai_next) { if ((AF_INET == res->ai_family && IN_MULTICAST(ntohl (((struct sockaddr_in*)(res->ai_addr))->sin_addr.s_addr))) || (AF_INET6 == res->ai_family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr))) continue; addr_cnt++; } if (addr_cnt > 1) /* copy all valid entries onto the stack */ { unsigned i = 0; addr = pgm_newa (struct sockaddr_storage, addr_cnt); for (res = result; NULL != res; res = res->ai_next) { if ((AF_INET == res->ai_family && IN_MULTICAST(ntohl (((struct sockaddr_in*)(res->ai_addr))->sin_addr.s_addr))) || (AF_INET6 == res->ai_family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr))) continue; memcpy (&addr[i++], res->ai_addr, pgm_sockaddr_len (res->ai_addr)); } freeaddrinfo (result); /* address list complete */ check_addr = TRUE; break; } else if (1 == addr_cnt) /* find matching entry */ { for (res = result; NULL != res; res = res->ai_next) { if ((AF_INET == res->ai_family && IN_MULTICAST(ntohl (((struct sockaddr_in*)(res->ai_addr))->sin_addr.s_addr))) || (AF_INET6 == res->ai_family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr))) continue; break; } /* verify entry was found */ pgm_assert (NULL != res); } else /* addr_cnt == 0 ∴ use last entry */ { for (res = result; NULL != res->ai_next; res = res->ai_next); addr_cnt++; /* verify entry is valid */ pgm_assert (NULL != res); } } else { res = result; /* only one result */ } if (AF_INET == res->ai_family && IN_MULTICAST(ntohl (((struct sockaddr_in*)(res->ai_addr))->sin_addr.s_addr))) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Expecting interface address, found IPv4 multicast name %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); freeaddrinfo (result); return FALSE; } else if (AF_INET6 == res->ai_family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_XDEV, _("Expecting interface address, found IPv6 multicast name %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); freeaddrinfo (result); return FALSE; } memcpy (addr, res->ai_addr, pgm_sockaddr_len (res->ai_addr)); freeaddrinfo (result); check_addr = TRUE; break; #if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME case EAI_NODATA: #endif case EAI_NONAME: check_ifname = TRUE; break; default: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_eai_errno (eai, errno), _("Internet host resolution: %s(%d)"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), eai), eai); return FALSE; } } /* iterate through interface list and match device name, ip or net address */ if (!pgm_getifaddrs (&ifap, error)) { pgm_prefix_error (error, _("Enumerating network interfaces: ")); return FALSE; } for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (NULL == ifa->ifa_addr) continue; switch (ifa->ifa_addr->sa_family) { /* ignore raw entries on Linux */ #ifdef AF_PACKET case AF_PACKET: continue; #endif case AF_INET: if (AF_INET6 == family) continue; break; case AF_INET6: if (AF_INET == family) continue; break; default: continue; } const unsigned ifindex = pgm_if_nametoindex (ifa->ifa_addr->sa_family, ifa->ifa_name); pgm_assert (0 != ifindex); /* check numeric host */ if (check_addr) { for (unsigned i = 0; i < addr_cnt; i++) { if (0 == pgm_sockaddr_cmp (ifa->ifa_addr, (const struct sockaddr*)&addr[i])) { pgm_strncpy_s (ir->ir_name, IF_NAMESIZE, ifa->ifa_name, _TRUNCATE); ir->ir_flags = ifa->ifa_flags; if (ir->ir_flags & IFF_LOOPBACK) pgm_warn (_("Interface %s reports as a loopback device."), ir->ir_name); if (!(ir->ir_flags & IFF_MULTICAST)) pgm_warn (_("Interface %s reports as a non-multicast capable device."), ir->ir_name); ir->ir_interface = ifindex; memcpy (&ir->ir_addr, ifa->ifa_addr, pgm_sockaddr_len (ifa->ifa_addr)); pgm_freeifaddrs (ifap); return TRUE; } } } /* check network address */ if (check_inet_network && AF_INET == ifa->ifa_addr->sa_family) { const struct in_addr ifaddr = { .s_addr = ntohl (((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr) }; const struct in_addr netmask = { .s_addr = ntohl (((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr.s_addr) }; struct in_addr lna; /* local network address must be null, otherwise should match an address is previous check */ if (!pgm_inet_lnaof (&lna, &in_addr, &netmask) && is_in_net (&ifaddr, &in_addr, &netmask)) { pgm_strncpy_s (ir->ir_name, IF_NAMESIZE, ifa->ifa_name, _TRUNCATE); ir->ir_flags = ifa->ifa_flags; if (ir->ir_flags & IFF_LOOPBACK) { pgm_warn (_("Skipping matching loopback network device %s."), ir->ir_name); goto skip_inet_network; } if (!(ir->ir_flags & IFF_MULTICAST)) { pgm_warn (_("Skipping matching non-multicast capable network device %s."), ir->ir_name); goto skip_inet_network; } /* check for multiple interfaces on same network */ if (interface_matches++) { char saddr[INET_ADDRSTRLEN]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NOTUNIQ, _("Multiple interfaces found with network address %s."), pgm_inet_ntop (AF_INET, &in_addr, saddr, sizeof(saddr))); pgm_freeifaddrs (ifap); return FALSE; } ir->ir_interface = ifindex; memcpy (&ir->ir_addr, ifa->ifa_addr, pgm_sockaddr_len (ifa->ifa_addr)); continue; } } if (check_inet6_network && AF_INET6 == ifa->ifa_addr->sa_family && /* no specified scope or matching scope */ ( 0 == sa6_addr.sin6_scope_id || ((struct sockaddr_in6*)ifa->ifa_addr)->sin6_scope_id == sa6_addr.sin6_scope_id) ) { const struct in6_addr ifaddr = ((struct sockaddr_in6*)ifa->ifa_addr)->sin6_addr; const struct in6_addr netmask = ((struct sockaddr_in6*)ifa->ifa_netmask)->sin6_addr; struct in6_addr lna; if (!pgm_inet6_lnaof (&lna, &sa6_addr.sin6_addr, &netmask) && is_in_net6 (&ifaddr, &sa6_addr.sin6_addr, &netmask)) { pgm_strncpy_s (ir->ir_name, IF_NAMESIZE, ifa->ifa_name, _TRUNCATE); ir->ir_flags = ifa->ifa_flags; if (ir->ir_flags & IFF_LOOPBACK) { pgm_warn (_("Skipping matching loopback network device %s."), ir->ir_name); goto skip_inet_network; } if (!(ir->ir_flags & IFF_MULTICAST)) { pgm_warn (_("Skipping matching non-multicast capable network device %s."), ir->ir_name); goto skip_inet_network; } /* check for multiple interfaces on same network */ if (interface_matches++) { char saddr[INET6_ADDRSTRLEN]; pgm_sockaddr_ntop ((struct sockaddr*)&sa6_addr, saddr, sizeof (saddr)); pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NOTUNIQ, _("Multiple interfaces found with network address %s."), saddr); pgm_freeifaddrs (ifap); return FALSE; } ir->ir_interface = ifindex; memcpy (&ir->ir_addr, ifa->ifa_addr, pgm_sockaddr_len (ifa->ifa_addr)); continue; } } skip_inet_network: /* check interface name */ if (check_ifname) { if (0 != strcmp (ifname, ifa->ifa_name)) continue; ir->ir_flags = ifa->ifa_flags; /* skip loopback and non-multicast capable devices */ if ((ir->ir_flags & IFF_LOOPBACK) || !(ir->ir_flags & IFF_MULTICAST)) continue; /* check for multiple interfaces */ if (interface_matches++) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NOTUNIQ, _("Network interface name not unique %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); pgm_freeifaddrs (ifap); return FALSE; } ir->ir_interface = ifindex; pgm_strncpy_s (ir->ir_name, IF_NAMESIZE, ifa->ifa_name, _TRUNCATE); memcpy (&ir->ir_addr, ifa->ifa_addr, pgm_sockaddr_len (ifa->ifa_addr)); continue; } } if (0 == interface_matches) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("No matching non-loopback and multicast capable network interface %s%s%s"), ifname ? "\"" : "", ifname ? ifname : "(null)", ifname ? "\"" : ""); pgm_freeifaddrs (ifap); return FALSE; } pgm_freeifaddrs (ifap); return TRUE; } /* parse one multicast address, conflict resolution of multiple address families of DNS multicast names is * deferred to libc. * * Zone indices are ignored as interface specification is already available. * * reserved addresses may flag warnings: * * 224.0.0.0/24 for local network control * 224.0.1/24 for internetwork control * 169.254.255.255, ff02::1 all local nodes on segment * ff02::2 all routers * ff05::1 all nodes * ff0x::fb multicast DNS * ff0x::108 NIS * ff05::1:3 DHCP * * returns TRUE on success, FALSE on error and sets error appropriately. */ static bool parse_group ( const int family, /* AF_UNSPEC | AF_INET | AF_INET6 */ const char* restrict group, /* NULL terminated */ struct sockaddr* restrict addr, /* pointer to sockaddr_storage for writing */ pgm_error_t** restrict error ) { /* pre-conditions */ pgm_assert (AF_INET == family || AF_INET6 == family || AF_UNSPEC == family); pgm_assert (NULL != group); pgm_assert (NULL != addr); pgm_debug ("parse_group (family:%s group:%s%s%s addr:%p error:%p)", pgm_family_string (family), group ? "\"" : "", group ? group : "(null)", group ? "\"" : "", (const void*)addr, (const void*)error); /* strip any square brackets for early IPv6 literal evaluation */ if (AF_INET != family && '[' == group[0]) { const size_t grouplen = strlen(group); if (']' == group[ grouplen - 1 ]) { char literal[1024]; pgm_strncpy_s (literal, sizeof (literal), group + 1, grouplen - 2); if (pgm_inet_pton (AF_INET6, literal, &((struct sockaddr_in6*)addr)->sin6_addr) && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)addr)->sin6_addr)) { addr->sa_family = AF_INET6; ((struct sockaddr_in6*)addr)->sin6_port = 0; ((struct sockaddr_in6*)addr)->sin6_flowinfo = 0; ((struct sockaddr_in6*)addr)->sin6_scope_id = 0; return TRUE; } } } /* IPv4 address */ if (AF_INET6 != family && pgm_inet_pton (AF_INET, group, &((struct sockaddr_in*)addr)->sin_addr) && IN_MULTICAST(ntohl (((struct sockaddr_in*)addr)->sin_addr.s_addr))) { addr->sa_family = AF_INET; return TRUE; } if (AF_INET != family && pgm_inet_pton (AF_INET6, group, &((struct sockaddr_in6*)addr)->sin6_addr) && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)addr)->sin6_addr)) { addr->sa_family = AF_INET6; ((struct sockaddr_in6*)addr)->sin6_port = 0; ((struct sockaddr_in6*)addr)->sin6_flowinfo = 0; ((struct sockaddr_in6*)addr)->sin6_scope_id = 0; return TRUE; } /* NSS network */ const struct pgm_netent_t* ne = pgm_getnetbyname (group); /* ne::n_net in host byte order */ if (ne) { switch (ne->n_net.ss_family) { case AF_INET: { struct sockaddr_in sa; if (AF_INET6 == family) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("IP address family conflict when resolving network name %s%s%s, found IPv4 when IPv6 expected."), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); return FALSE; } memcpy (&sa, &ne->n_net, sizeof (sa)); if (IN_MULTICAST(sa.sin_addr.s_addr)) { addr->sa_family = ne->n_net.ss_family; ((struct sockaddr_in*)addr)->sin_addr.s_addr = htonl (sa.sin_addr.s_addr); return TRUE; } pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("IP address class conflict when resolving network name %s%s%s, expected IPv4 multicast."), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); return FALSE; } case AF_INET6: { #ifdef CONFIG_HAVE_GETNETENT pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("Not configured for IPv6 network name support, %s%s%s is an IPv6 network name."), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); return FALSE; #else struct sockaddr_in6 sa6; if (AF_INET == family) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("IP address family conflict when resolving network name %s%s%s, found IPv6 when IPv4 expected."), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); return FALSE; } memcpy (&sa6, &ne->n_net, sizeof (sa6)); if (IN6_IS_ADDR_MULTICAST(&sa6.sin6_addr)) { memcpy (addr, &sa6, sizeof (sa6)); return TRUE; } pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("IP address class conflict when resolving network name %s%s%s, expected IPv6 multicast."), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); return FALSE; #endif /* CONFIG_HAVE_GETNETENT */ } default: pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_NODEV, _("Network name resolves to non-internet protocol address family %s%s%s"), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); return FALSE; } } /* lookup group through name service */ struct addrinfo hints = { .ai_family = family, .ai_socktype = SOCK_STREAM, /* not really, SOCK_RAW */ .ai_protocol = IPPROTO_TCP, /* not really, IPPROTO_PGM */ .ai_flags = AI_ADDRCONFIG, /* AI_V4MAPPED is unhelpful */ }, *result, *res; const int eai = getaddrinfo (group, NULL, &hints, &result); if (0 != eai) { char errbuf[1024]; pgm_set_error (error, PGM_ERROR_DOMAIN_IF, pgm_error_from_eai_errno (eai, errno), _("Resolving receive group: %s(%d)"), pgm_gai_strerror_s (errbuf, sizeof (errbuf), eai), eai); return FALSE; } /* NB: getaddrinfo may return multiple addresses, one per interface & family, only the first * return result is used. The sorting order of the list defined by RFC 3484 and /etc/gai.conf */ for (res = result; NULL != res; res = res->ai_next) { if ((AF_INET6 != family && IN_MULTICAST(ntohl (((struct sockaddr_in*)res->ai_addr)->sin_addr.s_addr))) || (AF_INET != family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr))) { /* return first multicast result */ memcpy (addr, res->ai_addr, res->ai_addrlen); freeaddrinfo (result); return TRUE; } } pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_INVAL, _("Unresolvable receive group %s%s%s"), group ? "\"" : "", group ? group : "(null)", group ? "\"" : ""); freeaddrinfo (result); return FALSE; } /* parse an interface entity from a network parameter. * * family can be unspecified - AF_UNSPEC, can return interfaces with the unspecified * address family * * examples: "eth0" * "hme0,hme1" * "qe0,qe1,qe2" * "qe0,qe2,qe2" => valid even though duplicate interface name * * returns TRUE on success with device_list containing double linked list of devices as * sockaddr/idx pairs. returns FALSE on error, including multiple matching adapters. * * memory ownership of linked list is passed to caller and must be freed with pgm_free * and the pgm_list_free* api. */ static bool parse_interface_entity ( int family, /* AF_UNSPEC | AF_INET | AF_INET6 */ const char* restrict entity, /* NULL terminated */ pgm_list_t** restrict interface_list, /* */ pgm_error_t** restrict error ) { struct interface_req* ir; pgm_list_t* source_list = NULL; /* pre-conditions */ pgm_assert (AF_INET == family || AF_INET6 == family || AF_UNSPEC == family); pgm_assert (NULL != interface_list); pgm_assert (NULL == *interface_list); pgm_debug ("parse_interface_entity (family:%s entity:%s%s%s interface_list:%p error:%p)", pgm_family_string (family), entity ? "\"":"", entity ? entity : "(null)", entity ? "\"":"", (const void*)interface_list, (const void*)error); /* the empty entity, returns in_addr_any for both receive and send interfaces */ if (NULL == entity) { ir = pgm_new0 (struct interface_req, 1); ir->ir_addr.ss_family = family; *interface_list = pgm_list_append (*interface_list, ir); return TRUE; } /* check interface name length limit */ char** tokens = pgm_strsplit (entity, ",", 10); int j = 0; while (tokens && tokens[j]) { pgm_error_t* sub_error = NULL; ir = pgm_new (struct interface_req, 1); if (!parse_interface (family, tokens[j], ir, &sub_error)) { /* mark multiple interfaces for later decision based on group families */ if (sub_error && PGM_ERROR_NOTUNIQ == sub_error->code) { ir->ir_addr.ss_family = AF_UNSPEC; pgm_error_free (sub_error); } /* bail out on first interface with an error */ else { pgm_propagate_error (error, sub_error); pgm_free (ir); pgm_strfreev (tokens); while (source_list) { pgm_free (source_list->data); source_list = pgm_list_delete_link (source_list, source_list); } return FALSE; } } source_list = pgm_list_append (source_list, ir); ++j; } pgm_strfreev (tokens); *interface_list = source_list; return TRUE; } /* parse a receive multicast group entity. can contain more than one multicast group to * support asymmetric fan-out. * * if group is ambiguous, i.e. empty or a name mapping then the address family of the matching * interface is queried. if the interface is also ambiguous, i.e. empty interface and receive group * then the hostname will be used to determine the default node address family. if the hosts * node name resolves both IPv4 and IPv6 address families then the first matching value is taken. * * e.g. "239.192.0.1" * "239.192.0.100,239.192.0.101" * * unspecified address family interfaces are forced to AF_INET or AF_INET6. * * returns TRUE on success, returns FALSE on error and sets error appropriately. */ static bool parse_receive_entity ( int family, /* AF_UNSPEC | AF_INET | AF_INET6 */ const char* restrict entity, /* NULL terminated */ pgm_list_t** restrict interface_list, /* */ pgm_list_t** restrict recv_list, /* */ pgm_error_t** restrict error ) { /* pre-conditions */ pgm_assert (AF_INET == family || AF_INET6 == family || AF_UNSPEC == family); pgm_assert (NULL != recv_list); pgm_assert (NULL == *recv_list); pgm_debug ("parse_receive_entity (family:%s entity:%s%s%s interface_list:%p recv_list:%p error:%p)", pgm_family_string (family), entity ? "\"":"", entity ? entity : "(null)", entity ? "\"":"", (const void*)interface_list, (const void*)recv_list, (const void*)error); struct group_source_req* recv_gsr; struct interface_req* primary_interface = (struct interface_req*)pgm_memdup ((*interface_list)->data, sizeof(struct interface_req)); /* the empty entity */ if (NULL == entity) { /* default receive object */ recv_gsr = pgm_new0 (struct group_source_req, 1); recv_gsr->gsr_interface = primary_interface->ir_interface; recv_gsr->gsr_group.ss_family = family; /* track IPv6 scope from any resolved interface */ unsigned scope_id = 0; /* if using unspec default group check the interface for address family */ if (AF_UNSPEC == recv_gsr->gsr_group.ss_family) { if (AF_UNSPEC == primary_interface->ir_addr.ss_family) { struct sockaddr_storage addr; if (!pgm_get_multicast_enabled_node_addr (AF_UNSPEC, (struct sockaddr*)&addr, sizeof(addr), error)) { pgm_prefix_error (error, _("Node primary address family cannot be determined: ")); pgm_free (recv_gsr); pgm_free (primary_interface); return FALSE; } recv_gsr->gsr_group.ss_family = addr.ss_family; scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&addr); /* was an interface actually specified */ if (primary_interface->ir_name[0] != '\0') { struct interface_req ir; if (!parse_interface (recv_gsr->gsr_group.ss_family, primary_interface->ir_name, &ir, error)) { pgm_prefix_error (error, _("Unique address cannot be determined for interface %s%s%s: "), primary_interface->ir_name ? "\"" : "", primary_interface->ir_name ? primary_interface->ir_name : "(null)", primary_interface->ir_name ? "\"" : ""); pgm_free (recv_gsr); pgm_free (primary_interface); return FALSE; } recv_gsr->gsr_interface = ir.ir_interface; memcpy (&primary_interface->ir_addr, &ir.ir_addr, pgm_sockaddr_len ((struct sockaddr*)&ir.ir_addr)); scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&ir.ir_addr); } } else { /* use interface address family for multicast group */ recv_gsr->gsr_interface = primary_interface->ir_interface; recv_gsr->gsr_group.ss_family = primary_interface->ir_addr.ss_family; scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&primary_interface->ir_addr); } } pgm_assert (AF_UNSPEC != recv_gsr->gsr_group.ss_family); if (AF_UNSPEC != primary_interface->ir_addr.ss_family) { pgm_assert (recv_gsr->gsr_group.ss_family == primary_interface->ir_addr.ss_family); } else { /* check if we can now resolve the interface by address family of the receive group */ if (primary_interface->ir_name[0] != '\0') { struct interface_req ir; if (!parse_interface (recv_gsr->gsr_group.ss_family, primary_interface->ir_name, &ir, error)) { pgm_prefix_error (error, _("Unique address cannot be determined for interface %s%s%s: "), primary_interface->ir_name ? "\"" : "", primary_interface->ir_name ? primary_interface->ir_name : "(null)", primary_interface->ir_name ? "\"" : ""); pgm_free (recv_gsr); pgm_free (primary_interface); return FALSE; } recv_gsr->gsr_interface = ir.ir_interface; scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&ir.ir_addr); } } /* copy default PGM multicast group */ switch (recv_gsr->gsr_group.ss_family) { case AF_INET6: memcpy (&((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_addr, &if6_default_group_addr, sizeof(if6_default_group_addr)); ((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_scope_id = scope_id; break; case AF_INET: ((struct sockaddr_in*)&recv_gsr->gsr_group)->sin_addr.s_addr = htonl(IF_DEFAULT_GROUP); break; default: pgm_assert_not_reached(); } /* ASM: source = group */ memcpy (&recv_gsr->gsr_source, &recv_gsr->gsr_group, pgm_sockaddr_len ((struct sockaddr*)&recv_gsr->gsr_group)); /* scoped multicast groups are invalid on Windows */ #ifdef _WIN32 if (AF_INET6 == recv_gsr->gsr_group.ss_family) { ((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_scope_id = 0; } #endif *recv_list = pgm_list_append (*recv_list, recv_gsr); pgm_free (primary_interface); return TRUE; } /* parse one or more multicast receive groups. */ int j = 0; char** tokens = pgm_strsplit (entity, ",", 10); while (tokens && tokens[j]) { /* default receive object */ recv_gsr = pgm_new0 (struct group_source_req, 1); recv_gsr->gsr_interface = primary_interface->ir_interface; recv_gsr->gsr_group.ss_family = family; if (AF_UNSPEC == recv_gsr->gsr_group.ss_family) { if (AF_UNSPEC == primary_interface->ir_addr.ss_family) { pgm_debug ("Address family of receive group cannot be determined from interface."); } else { recv_gsr->gsr_group.ss_family = primary_interface->ir_addr.ss_family; ((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&primary_interface->ir_addr); } } if (!parse_group (recv_gsr->gsr_group.ss_family, tokens[j], (struct sockaddr*)&recv_gsr->gsr_group, error)) { pgm_prefix_error (error, _("Unresolvable receive entity %s%s%s: "), tokens[j] ? "\"" : "", tokens[j] ? tokens[j] : "(null)", tokens[j] ? "\"" : ""); pgm_free (recv_gsr); pgm_strfreev (tokens); pgm_free (primary_interface); return FALSE; } /* check if we can now resolve the source interface by address family of the receive group */ if (AF_UNSPEC == primary_interface->ir_addr.ss_family) { if (primary_interface->ir_name[0] != '\0') { struct interface_req ir; if (!parse_interface (recv_gsr->gsr_group.ss_family, primary_interface->ir_name, &ir, error)) { pgm_prefix_error (error, _("Unique address cannot be determined for interface %s%s%s: "), primary_interface->ir_name ? "\"" : "", primary_interface->ir_name ? primary_interface->ir_name : "(null)", primary_interface->ir_name ? "\"" : ""); pgm_free (recv_gsr); pgm_free (primary_interface); return FALSE; } recv_gsr->gsr_interface = ir.ir_interface; ((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&ir.ir_addr); } } else { /* keep interface scope */ ((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&primary_interface->ir_addr); } /* ASM: source = group */ memcpy (&recv_gsr->gsr_source, &recv_gsr->gsr_group, pgm_sockaddr_len ((struct sockaddr*)&recv_gsr->gsr_group)); /* scoped multicast groups are invalid on Windows */ #ifdef _WIN32 if (AF_INET6 == recv_gsr->gsr_group.ss_family) { ((struct sockaddr_in6*)&recv_gsr->gsr_group)->sin6_scope_id = 0; } #endif *recv_list = pgm_list_append (*recv_list, recv_gsr); ++j; } pgm_strfreev (tokens); pgm_free (primary_interface); return TRUE; } static bool parse_send_entity ( int family, /* AF_UNSPEC | AF_INET | AF_INET6 */ const char* restrict entity, /* null = empty entity */ pgm_list_t** restrict interface_list, /* */ pgm_list_t** restrict recv_list, /* */ pgm_list_t** restrict send_list, /* */ pgm_error_t** restrict error ) { /* pre-conditions */ pgm_assert (AF_INET == family || AF_INET6 == family || AF_UNSPEC == family); pgm_assert (NULL != recv_list); pgm_assert (NULL != *recv_list); pgm_assert (NULL != send_list); pgm_assert (NULL == *send_list); pgm_debug ("parse_send_entity (family:%s entity:%s%s%s interface_list:%p recv_list:%p send_list:%p error:%p)", pgm_family_string (family), entity ? "\"":"", entity ? entity : "(null)", entity ? "\"":"", (const void*)interface_list, (const void*)recv_list, (const void*)send_list, (const void*)error); struct group_source_req* send_gsr; const struct interface_req* primary_interface = (struct interface_req*)(*interface_list)->data; if (entity == NULL) { send_gsr = pgm_memdup ((*recv_list)->data, sizeof(struct group_source_req)); *send_list = pgm_list_append (*send_list, send_gsr); return TRUE; } /* default send object */ send_gsr = pgm_new0 (struct group_source_req, 1); send_gsr->gsr_interface = primary_interface->ir_interface; if (!parse_group (family, entity, (struct sockaddr*)&send_gsr->gsr_group, error)) { pgm_prefix_error (error, _("Unresolvable send entity %s%s%s: "), entity ? "\"":"", entity ? entity : "(null)", entity ? "\"":""); pgm_free (send_gsr); return FALSE; } /* check if we can now resolve the source interface by address family of the send group */ if (AF_UNSPEC == primary_interface->ir_addr.ss_family) { if (primary_interface->ir_name[0] != '\0') { struct interface_req ir; if (!parse_interface (send_gsr->gsr_group.ss_family, primary_interface->ir_name, &ir, error)) { pgm_prefix_error (error, _("Unique address cannot be determined for interface %s%s%s: "), primary_interface->ir_name ? "\"":"", primary_interface->ir_name ? primary_interface->ir_name : "(null)", primary_interface->ir_name ? "\"":""); pgm_free (send_gsr); return FALSE; } send_gsr->gsr_interface = ir.ir_interface; ((struct sockaddr_in6*)&send_gsr->gsr_group)->sin6_scope_id = pgm_sockaddr_scope_id ((struct sockaddr*)&ir.ir_addr); } } /* ASM: source = group */ memcpy (&send_gsr->gsr_source, &send_gsr->gsr_group, pgm_sockaddr_len ((struct sockaddr*)&send_gsr->gsr_group)); /* scoped multicast groups are invalid on Windows */ #ifdef _WIN32 if (AF_INET6 == send_gsr->gsr_group.ss_family) { ((struct sockaddr_in6*)&send_gsr->gsr_group)->sin6_scope_id = 0; } #endif *send_list = pgm_list_append (*send_list, send_gsr); return TRUE; } /* parse network parameter * * interface list; receive multicast group list; send multicast group */ #define IS_HOSTNAME(x) ( /* RFC 952 */ \ isalnum(x) || \ ((x) == '-') || \ ((x) == '.') \ ) #define IS_IP(x) ( \ isdigit(x) || \ ((x) == '.') || \ ((x) == '/') \ ) #define IS_IP6(x) ( \ isxdigit(x) || \ ((x) == ':') || \ ((x) == '/') || \ ((x) == '.') || \ ((x) == '[') || \ ((x) == ']') \ ) /* e.g. fe80::1%eth0.620 vlan tag, * fe80::1%eth0:0 IP alias * fe80::1%qe0_0 Solaris link name * * The Linux kernel generally doesn't care too much, but everything else falls apart with * random characters in interface names. Hyphen is a popular problematic character. */ #define IS_IP6_WITH_ZONE(x) ( \ IS_IP6(x) || \ ((x) == '%') || \ isalpha(x) || \ ((x) == '_') \ ) #define IS_NETPARAM(x) ( \ ((x) == ',') || \ ((x) == ';') \ ) static inline bool is_network_char ( const int family, const char c ) { if (IS_HOSTNAME(c) || (AF_INET == family && IS_IP(c)) || ((AF_INET6 == family || AF_UNSPEC == family) && IS_IP6_WITH_ZONE(c)) || IS_NETPARAM(c)) return TRUE; else return FALSE; } static bool network_parse ( const char* restrict network, /* NULL terminated */ int family, /* AF_UNSPEC | AF_INET | AF_INET6 */ pgm_list_t** restrict recv_list, /* */ pgm_list_t** restrict send_list, /* */ pgm_error_t** restrict error ) { bool retval = FALSE; const char *p = network; const char *e = p + strlen(network); enum { ENTITY_INTERFACE, ENTITY_RECEIVE, ENTITY_SEND, ENTITY_ERROR } ec = ENTITY_INTERFACE; const char *b = p; /* begin of entity */ pgm_list_t* source_list = NULL; pgm_error_t* sub_error = NULL; /* pre-conditions */ pgm_assert (NULL != network); pgm_assert (AF_UNSPEC == family || AF_INET == family || AF_INET6 == family); pgm_assert (NULL != recv_list); pgm_assert (NULL != send_list); pgm_debug ("network_parse (network:%s%s%s family:%s recv_list:%p send_list:%p error:%p)", network ? "\"" : "", network ? network : "(null)", network ? "\"" : "", pgm_family_string (family), (const void*)recv_list, (const void*)send_list, (const void*)error); while (p < e) { if (!is_network_char (family, *p)) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_INVAL, _("'%c' is not a valid character."), *p); goto free_lists; } if (*p == ';') /* end of entity */ { if (b == p) /* empty entity */ { switch (ec++) { case ENTITY_INTERFACE: retval = parse_interface_entity (family, NULL, &source_list, error); break; case ENTITY_RECEIVE: retval = parse_receive_entity (family, NULL, &source_list, recv_list, error); break; case ENTITY_SEND: retval = parse_send_entity (family, NULL, &source_list, recv_list, send_list, error); break; default: pgm_assert_not_reached(); break; } if (!retval) goto free_lists; b = ++p; continue; } /* entity from b to p-1 */ char entity[1024]; pgm_strncpy_s (entity, sizeof (entity), b, p - b); switch (ec++) { case ENTITY_INTERFACE: if (parse_interface_entity (family, entity, &source_list, &sub_error)) break; if (!(sub_error && PGM_ERROR_XDEV == sub_error->code)) { /* fall through on multicast */ if (!(sub_error && PGM_ERROR_NOTUNIQ == sub_error->code)) { pgm_propagate_error (error, sub_error); goto free_lists; } pgm_clear_error (&sub_error); /* FIXME: too many interfaces */ if (pgm_list_length (source_list) > 1) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_INVAL, _("Send group list contains more than one entity.")); goto free_lists; } break; } pgm_clear_error (&sub_error); while (source_list) { pgm_free (source_list->data); source_list = pgm_list_delete_link (source_list, source_list); } if (!parse_interface_entity (family, NULL, &source_list, &sub_error) && !(sub_error && PGM_ERROR_NOTUNIQ == sub_error->code)) { pgm_propagate_error (error, sub_error); goto free_lists; } pgm_clear_error (&sub_error); ec++; case ENTITY_RECEIVE: if (!parse_receive_entity (family, entity, &source_list, recv_list, error)) goto free_lists; break; case ENTITY_SEND: if (!parse_send_entity (family, entity, &source_list, recv_list, send_list, error)) goto free_lists; break; default: pgm_assert_not_reached(); break; } b = ++p; continue; } p++; } if (b < e) { switch (ec++) { case ENTITY_INTERFACE: if (parse_interface_entity (family, b, &source_list, &sub_error)) break; if (!(sub_error && PGM_ERROR_XDEV == sub_error->code)) { /* fall through on multicast */ if (!(sub_error && PGM_ERROR_NOTUNIQ == sub_error->code)) { pgm_propagate_error (error, sub_error); goto free_lists; } pgm_clear_error (&sub_error); /* FIXME: too many interfaces */ if (pgm_list_length (source_list) > 1) { pgm_set_error (error, PGM_ERROR_DOMAIN_IF, PGM_ERROR_INVAL, _("Send group list contains more than one entity.")); goto free_lists; } break; } pgm_clear_error (&sub_error); while (source_list) { pgm_free (source_list->data); source_list = pgm_list_delete_link (source_list, source_list); } if (!parse_interface_entity (family, NULL, &source_list, &sub_error) && !(sub_error && PGM_ERROR_NOTUNIQ == sub_error->code)) { pgm_propagate_error (error, sub_error); goto free_lists; } ec++; case ENTITY_RECEIVE: if (!parse_receive_entity (family, b, &source_list, recv_list, error)) goto free_lists; break; case ENTITY_SEND: if (!parse_send_entity (family, b, &source_list, recv_list, send_list, error)) goto free_lists; break; default: pgm_assert_not_reached(); break; } } while (ec <= ENTITY_SEND) { switch (ec++) { case ENTITY_INTERFACE: if (!parse_interface_entity (family, NULL, &source_list, error)) goto free_lists; break; case ENTITY_RECEIVE: if (!parse_receive_entity (family, NULL, &source_list, recv_list, error)) goto free_lists; break; case ENTITY_SEND: if (!parse_send_entity (family, NULL, &source_list, recv_list, send_list, error)) goto free_lists; break; default: pgm_assert_not_reached(); break; } } if (pgm_list_length (source_list) > 1) goto free_lists; /* cleanup source interface list */ while (source_list) { pgm_free (source_list->data); source_list = pgm_list_delete_link (source_list, source_list); } return TRUE; free_lists: while (source_list) { pgm_free (source_list->data); source_list = pgm_list_delete_link (source_list, source_list); } while (*recv_list) { pgm_free ((*recv_list)->data); *recv_list = pgm_list_delete_link (*recv_list, *recv_list); } while (*send_list) { pgm_free ((*send_list)->data); *send_list = pgm_list_delete_link (*send_list, *send_list); } return FALSE; } /* create group_source_req as used by pgm_transport_create which specify port, address & interface. * gsr_source is copied from gsr_group for ASM, caller needs to populate gsr_source for SSM. * * returns TRUE on success, returns FALSE on error and sets error appropriately. */ bool pgm_getaddrinfo ( const char* restrict network, const struct pgm_addrinfo_t* const restrict hints, struct pgm_addrinfo_t** restrict res, pgm_error_t** restrict error ) { struct pgm_addrinfo_t* ai; const int family = hints ? hints->ai_family : AF_UNSPEC; pgm_list_t* recv_list = NULL; /* */ pgm_list_t* send_list = NULL; /* */ pgm_return_val_if_fail (NULL != network, FALSE); pgm_return_val_if_fail (AF_UNSPEC == family || AF_INET == family || AF_INET6 == family, FALSE); pgm_return_val_if_fail (NULL != res, FALSE); if (hints) { pgm_debug ("pgm_getaddrinfo (network:%s%s%s hints: {family:%s} res:%p error:%p)", network ? "\"" : "", network ? network : "(null)", network ? "\"" : "", pgm_family_string (family), (const void*)res, (const void*)error); } else { pgm_debug ("pgm_getaddrinfo (network:%s%s%s hints:%p res:%p error:%p)", network ? "\"" : "", network ? network : "(null)", network ? "\"" : "", (const void*)hints, (const void*)res, (const void*)error); } if (!network_parse (network, family, &recv_list, &send_list, error)) return FALSE; const size_t recv_list_len = pgm_list_length (recv_list); const size_t send_list_len = pgm_list_length (send_list); ai = pgm_malloc0 (sizeof(struct pgm_addrinfo_t) + (recv_list_len + send_list_len) * sizeof(struct group_source_req)); ai->ai_recv_addrs_len = (uint32_t)recv_list_len; ai->ai_recv_addrs = (void*)((char*)ai + sizeof(struct pgm_addrinfo_t)); ai->ai_send_addrs_len = (uint32_t)send_list_len; ai->ai_send_addrs = (void*)((char*)ai->ai_recv_addrs + recv_list_len * sizeof(struct group_source_req)); size_t i = 0; while (recv_list) { memcpy (&ai->ai_recv_addrs[i++], recv_list->data, sizeof(struct group_source_req)); pgm_free (recv_list->data); recv_list = pgm_list_delete_link (recv_list, recv_list); } i = 0; while (send_list) { memcpy (&ai->ai_send_addrs[i++], send_list->data, sizeof(struct group_source_req)); pgm_free (send_list->data); send_list = pgm_list_delete_link (send_list, send_list); } *res = ai; return TRUE; } void pgm_freeaddrinfo ( struct pgm_addrinfo_t* res ) { pgm_free (res); } static const char* pgm_family_string ( const int family ) { const char* c; switch (family) { case AF_UNSPEC: c = "AF_UNSPEC"; break; case AF_INET: c = "AF_INET"; break; case AF_INET6: c = "AF_INET6"; break; default: c = "(unknown)"; break; } return c; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.Solaris.sungcc0000644000175000017500000002375611640407354022506 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures'+ '-' + platform.system() + '-' + platform.machine() + '-sungcc'); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies def force_gcc(env): env.PrependENVPath('PATH', '/usr/sfw/bin'); env.PrependENVPath('PATH', '/opt/glib-gcc/bin'); env.Tool('gcc'); env.Tool('g++'); env = Environment(); force_gcc(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', # '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_XOPEN_SOURCE=600', '-D__EXTENSIONS__', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing # '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', # '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration # '-DCONFIG_HAVE_GETIFADDRS', # '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg # '-DCONFIG_HAVE_WSACMSGHDR', # multicast '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf # '-DCONFIG_HAVE_SPRINTF_GROUPING', # '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope # '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ # histogram math 'm', # clock_gettime() 'rt', # Solaris sockets 'resolv', 'socket', 'nsl' ], PROTOBUF_CCFLAGS = '-I/opt/glib-gcc/include', PROTOBUF_LIBS = '/opt/glib-gcc/lib/libprotobuf.a', PROTOBUF_PROTOC = '/opt/glib-gcc/bin/protoc' ) force_gcc(env); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = ['-O2'], LINKFLAGS = []) debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG', '-ggdb'], LINKFLAGS = ['-gdb']) profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = ['-pg']) thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': # net-snmp-config is broken in Solaris 10 and requires two separate calls env['SNMP_FLAGS'] = env.ParseFlags(['!net-snmp-config-32 --cflags', '!net-snmp-config-32 --agent-libs']); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); # backup = context.env.Clone().Dictionary(); lastASFLAGS = context.env.get('ASFLAGS', ''); lastCCFLAGS = context.env.get('CCFLAGS', ''); lastCFLAGS = context.env.get('CFLAGS', ''); lastCPPDEFINES = context.env.get('CPPDEFINES', ''); lastCPPFLAGS = context.env.get('CPPFLAGS', ''); lastCPPPATH = context.env.get('CPPPATH', ''); lastLIBPATH = context.env.get('LIBPATH', ''); lastLIBS = context.env.get('LIBS', ''); lastLINKFLAGS = context.env.get('LINKFLAGS', ''); lastRPATH = context.env.get('RPATH', ''); context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); # context.env.Replace(**backup); context.env.Replace(ASFLAGS = lastASFLAGS, CCFLAGS = lastCCFLAGS, CFLAGS = lastCFLAGS, CPPDEFINES = lastCPPDEFINES, CPPFLAGS = lastCPPFLAGS, CPPPATH = lastCPPPATH, LIBPATH = lastLIBPATH, LIBS = lastLIBS, LINKFLAGS = lastLINKFLAGS, RPATH = lastRPATH); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('pkg-config --cflags --libs check')[0]; context.Result(result); return result; tests = { 'CheckCheck': CheckCheck } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '-sungcc/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/string.c0000644000175000017500000002300511640407354017215 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable string manipulation functions. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(CONFIG_HAVE_VASPRINTF) && !defined(_GNU_SOURCE) # define _GNU_SOURCE #endif #include #include #include /* _GNU_SOURCE for vasprintf */ #include #include //#define STRING_DEBUG /* Return copy of string, must be freed with pgm_free(). */ PGM_GNUC_INTERNAL char* pgm_strdup ( const char* str ) { char *new_str; size_t length; if (PGM_LIKELY (NULL != str)) { length = strlen (str) + 1; new_str = pgm_malloc (length); memcpy (new_str, str, length); } else new_str = NULL; return new_str; } /* Calculates the maximum space needed to store the output of the sprintf() function. */ PGM_GNUC_INTERNAL int pgm_printf_string_upper_bound ( const char* format, va_list args ) { #ifdef _MSC_VER return _vscprintf (format, args) + 1; #else char c; return vsnprintf (&c, 1, format, args) + 1; #endif } /* memory must be freed with pgm_free() */ PGM_GNUC_INTERNAL int pgm_vasprintf ( char** restrict string, const char* restrict format, va_list args ) { int len; pgm_return_val_if_fail (string != NULL, -1); #ifdef CONFIG_HAVE_VASPRINTF char *strp; len = vasprintf (&strp, format, args); if (len < 0) { *string = NULL; } else { *string = pgm_strdup (strp); free (strp); } #else # ifdef _MSC_VER /* can only copy on assignment, pointer to stack frame */ va_list args2 = args; # else va_list args2; va_copy (args2, args); # endif *string = pgm_malloc (pgm_printf_string_upper_bound (format, args)); /* NB: must be able to handle NULL args, fails on GCC */ len = vsprintf (*string, format, args2); va_end (args2); #endif return len; } PGM_GNUC_INTERNAL char* pgm_strdup_vprintf ( const char* format, va_list args ) { char *string = NULL; pgm_vasprintf (&string, format, args); return string; } static char* pgm_stpcpy ( char* restrict dest, const char* restrict src ) { pgm_return_val_if_fail (dest != NULL, NULL); pgm_return_val_if_fail (src != NULL, NULL); #ifdef CONFIG_HAVE_STPCPY return stpcpy (dest, src); #else char *d = dest; const char *s = src; do { *d++ = *s; } while (*s++ != '\0'); return d - 1; #endif } PGM_GNUC_INTERNAL char* pgm_strconcat ( const char* src, ... ) { size_t len; va_list args; char *dest, *s, *to; if (!src) return NULL; len = 1 + strlen (src); va_start (args, src); s = va_arg (args, char*); while (s) { len += strlen (s); s = va_arg (args, char*); } va_end (args); dest = pgm_malloc (len); to = pgm_stpcpy (dest, src); va_start (args, src); s = va_arg (args, char*); while (s) { to = pgm_stpcpy (to, s); s = va_arg (args, char*); } va_end (args); return dest; } /* Split a string with delimiter, result must be freed with pgm_strfreev(). */ PGM_GNUC_INTERNAL char** pgm_strsplit ( const char* restrict string, const char* restrict delimiter, int max_tokens ) { pgm_slist_t *string_list = NULL, *slist; char **str_array, *s; unsigned n = 0; const char *remainder; pgm_return_val_if_fail (string != NULL, NULL); pgm_return_val_if_fail (delimiter != NULL, NULL); pgm_return_val_if_fail (delimiter[0] != '\0', NULL); if (max_tokens < 1) max_tokens = INT_MAX; remainder = string; s = strstr (remainder, delimiter); if (s) { const size_t delimiter_len = strlen (delimiter); while (--max_tokens && s) { const size_t len = s - remainder; char* new_string = pgm_malloc (len + 1); pgm_strncpy_s (new_string, len + 1, remainder, len); string_list = pgm_slist_prepend (string_list, new_string); n++; remainder = s + delimiter_len; s = strstr (remainder, delimiter); } } if (*string) { n++; string_list = pgm_slist_prepend (string_list, pgm_strdup (remainder)); } str_array = pgm_new (char*, n + 1); str_array[n--] = NULL; for (slist = string_list; slist; slist = slist->next) str_array[n--] = slist->data; pgm_slist_free (string_list); return str_array; } /* Free a NULL-terminated array of strings, such as created by pgm_strsplit */ PGM_GNUC_INTERNAL void pgm_strfreev ( char** str_array ) { if (PGM_LIKELY (NULL != str_array)) { for (unsigned i = 0; str_array[i] != NULL; i++) pgm_free (str_array[i]); pgm_free (str_array); } } /* resize dynamic string */ static void pgm_string_maybe_expand ( pgm_string_t* string, size_t len ) { if ((string->len + len) >= string->allocated_len) { string->allocated_len = pgm_nearest_power (1, string->len + len + 1); string->str = pgm_realloc (string->str, string->allocated_len); } } /* val may not be a part of string */ static pgm_string_t* pgm_string_insert_len ( pgm_string_t* restrict string, ssize_t pos, const char* restrict val, ssize_t len ) { pgm_return_val_if_fail (NULL != string, NULL); pgm_return_val_if_fail (NULL != val, string); if (len < 0) len = strlen (val); if (pos < 0) pos = string->len; else pgm_return_val_if_fail ((size_t)pos <= string->len, string); pgm_string_maybe_expand (string, len); if ((size_t)pos < string->len) memmove (string->str + pos + len, string->str + pos, string->len - pos); if (len == 1) string->str[pos] = *val; else memcpy (string->str + pos, val, len); string->len += len; string->str[string->len] = 0; return string; } static pgm_string_t* pgm_string_insert_c ( pgm_string_t* string, ssize_t pos, char c ) { pgm_return_val_if_fail (NULL != string, NULL); if (pos < 0) pos = string->len; else pgm_return_val_if_fail ((size_t)pos <= string->len, string); pgm_string_maybe_expand (string, 1); if ((size_t)pos < string->len) memmove (string->str + pos + 1, string->str + pos, string->len - pos); string->str[pos] = c; string->len ++; string->str[string->len] = '\0'; return string; } static pgm_string_t* pgm_string_append_len ( pgm_string_t* restrict string, const char* restrict val, size_t len ) { pgm_return_val_if_fail (NULL != string, NULL); pgm_return_val_if_fail (NULL != val, string); return pgm_string_insert_len (string, -1, val, len); } /* create new dynamic string */ static pgm_string_t* pgm_string_sized_new ( size_t init_size ) { pgm_string_t* string; string = pgm_new (pgm_string_t, 1); string->allocated_len = 0; string->len = 0; string->str = NULL; pgm_string_maybe_expand (string, MAX(init_size, 2)); string->str[0] = '\0'; return string; } PGM_GNUC_INTERNAL pgm_string_t* pgm_string_new ( const char* init ) { pgm_string_t* string; if (NULL == init || '\0' == *init) string = pgm_string_sized_new (2); else { const size_t len = strlen (init); string = pgm_string_sized_new (len + 2); pgm_string_append_len (string, init, len); } return string; } /* free dynamic string, optionally just the wrapper object */ PGM_GNUC_INTERNAL char* pgm_string_free ( pgm_string_t* string, bool free_segment ) { char* segment; pgm_return_val_if_fail (NULL != string, NULL); if (free_segment) { pgm_free (string->str); segment = NULL; } else segment = string->str; pgm_free (string); return segment; } static pgm_string_t* pgm_string_truncate ( pgm_string_t* restrict string, size_t len ) { pgm_return_val_if_fail (NULL != string, NULL); string->len = MIN (len, string->len); string->str[ string->len ] = '\0'; return string; } PGM_GNUC_INTERNAL pgm_string_t* pgm_string_append ( pgm_string_t* restrict string, const char* restrict val ) { pgm_return_val_if_fail (NULL != string, NULL); pgm_return_val_if_fail (NULL != val, string); return pgm_string_insert_len (string, -1, val, -1); } PGM_GNUC_INTERNAL pgm_string_t* pgm_string_append_c ( pgm_string_t* string, char c ) { pgm_return_val_if_fail (NULL != string, NULL); return pgm_string_insert_c (string, -1, c); } static void pgm_string_append_vprintf (pgm_string_t*restrict, const char*restrict, va_list) PGM_GNUC_PRINTF(2, 0); static void pgm_string_append_vprintf ( pgm_string_t* restrict string, const char* restrict format, va_list args ) { char *buf; int len; pgm_return_if_fail (NULL != string); pgm_return_if_fail (NULL != format); len = pgm_vasprintf (&buf, format, args); if (len >= 0) { pgm_string_maybe_expand (string, len); memcpy (string->str + string->len, buf, len + 1); string->len += len; pgm_free (buf); } } PGM_GNUC_INTERNAL void pgm_string_printf ( pgm_string_t* restrict string, const char* restrict format, ... ) { va_list args; pgm_string_truncate (string, 0); va_start (args, format); pgm_string_append_vprintf (string, format, args); va_end (args); } PGM_GNUC_INTERNAL void pgm_string_append_printf ( pgm_string_t* restrict string, const char* restrict format, ... ) { va_list args; va_start (args, format); pgm_string_append_vprintf (string, format, args); va_end (args); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/m4/0000755000175000017500000000000011644640125016062 5ustar locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/m4/libtool.m40000644000175000017500000104622011644640123017773 0ustar locallocal# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS libpgm-5.1.118-1~dfsg/openpgm/pgm/m4/ltoptions.m40000644000175000017500000002725611644640124020372 0ustar locallocal# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) libpgm-5.1.118-1~dfsg/openpgm/pgm/m4/ltsugar.m40000644000175000017500000001042411644640124020005 0ustar locallocal# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) libpgm-5.1.118-1~dfsg/openpgm/pgm/m4/lt~obsolete.m40000644000175000017500000001375611644640125020712 0ustar locallocal# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) libpgm-5.1.118-1~dfsg/openpgm/pgm/m4/ltversion.m40000644000175000017500000000125611644640124020354 0ustar locallocal# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3293 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4]) m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4' macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.mingw0000644000175000017500000002435311640407354020724 0ustar locallocal# -*- mode: python -*- # OpenPGM build script import platform import os import time import sys EnsureSConsVersion( 1, 0 ) SConsignFile('scons.signatures' + '-Win32-' + platform.machine()); vars = Variables() vars.AddVariables ( EnumVariable ('BUILD', 'build environment', 'debug', allowed_values=('release', 'debug', 'profile')), EnumVariable ('BRANCH', 'branch prediction', 'none', allowed_values=('none', 'profile', 'seed')), EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false', allowed_values=('true', 'false')), EnumVariable ('COVERAGE', 'test coverage', 'none', allowed_values=('none', 'full')), EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_HTTP', 'HTTP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_SNMP', 'SNMP administration', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CHECK', 'Check test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_TEST', 'Network test system', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_CC', 'C++ examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_EXAMPLES', 'Examples', 'true', allowed_values=('true', 'false')), EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false', allowed_values=('true', 'false')), EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false', allowed_values=('true', 'false')), ) #----------------------------------------------------------------------------- # Dependencies def force_mingw(env): env.Tool('crossmingw', toolpath=['.']); env = Environment(); force_mingw(env); def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --atleast-pkgconfig-version=%s' % version)[0] context.Result( ret ) return ret def CheckPKG(context, name): context.Message( 'Checking for %s... ' % name ) ret = context.TryAction('PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --exists \'%s\'' % name)[0] context.Result( ret ) return ret conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig, 'CheckPKG' : CheckPKG }) if not conf.CheckPKGConfig('0.15.0'): print 'pkg-config >= 0.15.0 not found.' # Exit(1) if not conf.CheckPKG('glib-2.0 >= 2.10'): print 'glib-2.0 >= 2.10 not found.' # Exit(1) if not conf.CheckPKG('gthread-2.0'): print 'gthread-2.0 not found.' # Exit(1) env = conf.Finish(); #----------------------------------------------------------------------------- # Platform specifics env = Environment( variables = vars, ENV = os.environ, CCFLAGS = [ '-pipe', '-Wall', '-Wextra', '-Wfloat-equal', '-Wshadow', '-Wunsafe-loop-optimizations', '-Wpointer-arith', '-Wbad-function-cast', '-Wcast-qual', '-Wcast-align', '-Wwrite-strings', '-Waggregate-return', '-Wstrict-prototypes', '-Wold-style-definition', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute', '-Wredundant-decls', '-Wnested-externs', # '-Winline', '-Wno-inline', '-Wno-unused-function', '-pedantic', # C99 '-std=gnu99', '-D_BSD_SOURCE', # 0x0403 required for SetCriticalSectionSpinCount() # 0x0501 required for getaddrinfo() on MinGW and IPv6 enabled getaddrinfo() on XP # /Windows 2000/ required for InterlockedExchangeAdd() # /Windows XP/ required for CreateWellKnownSid(), WSARecvMsg() # NB: MinGW32 defaults to 0x0400, i.e. NT 4.0 # MinGW-w64 defaults to 0x502, i.e. Windows XP SP2 '-D_WIN32_WINNT=0x0501', # re-entrant libc '-D_REENTRANT', # POSIX spinlocks # '-DCONFIG_HAVE_POSIX_SPINLOCK', # NSS protocol lookup # '-DCONFIG_HAVE_GETPROTOBYNAME_R', # '-DCONFIG_HAVE_GETPROTOBYNAME_R2', # NSS networks lookup, IPv4 only # '-DCONFIG_HAVE_GETNETENT', # variadic macros '-DCONFIG_HAVE_ISO_VARARGS', # '-DCONFIG_HAVE_GNUC_VARARGS', # stack memory api header # '-DCONFIG_HAVE_ALLOCA_H', # optimium checksum implementation # '-DCONFIG_8BIT_CHECKSUM', '-DCONFIG_16BIT_CHECKSUM', # '-DCONFIG_32BIT_CHECKSUM', # '-DCONFIG_64BIT_CHECKSUM', # '-DCONFIG_VECTOR_CHECKSUM', # useful /proc system # '-DCONFIG_HAVE_PROC', # example: crash handling # '-DCONFIG_HAVE_BACKTRACE', # timing # '-DCONFIG_HAVE_PSELECT', # '-DCONFIG_HAVE_RTC', '-DCONFIG_HAVE_TSC', # '-DCONFIG_HAVE_HPET', # event handling # '-DCONFIG_HAVE_POLL', # '-DCONFIG_HAVE_EPOLL', # interface enumeration # '-DCONFIG_HAVE_GETIFADDRS', # '-DCONFIG_HAVE_IFR_NETMASK', # win32 cmsg '-DCONFIG_HAVE_WSACMSGHDR', # multicast # '-DCONFIG_HAVE_MCAST_JOIN', # '-DCONFIG_HAVE_IP_MREQN', # sprintf # '-DCONFIG_HAVE_SPRINTF_GROUPING', # '-DCONFIG_HAVE_VASPRINTF', # symbol linking scope '-DCONFIG_HAVE_DSO_VISIBILITY', # socket binding '-DCONFIG_BIND_INADDR_ANY', # IP header order as per IP(4) on FreeBSD # '-DCONFIG_HOST_ORDER_IP_LEN', # '-DCONFIG_HOST_ORDER_IP_OFF', # ticket based spinlocks '-DCONFIG_TICKET_SPINLOCK', # dumb read-write spinlock '-DCONFIG_DUMB_RWSPINLOCK', # optimum galois field multiplication '-DCONFIG_GALOIS_MUL_LUT', # Wine limited API support # '-DCONFIG_TARGET_WINE', # GNU getopt # '-DCONFIG_HAVE_GETOPT' ], LINKFLAGS = [ '-pipe' ], LIBS = [ 'iphlpapi.lib', 'ws2_32.lib', 'winmm.lib' ] ) force_mingw(env); # Win32 regex env['REGEX_FLAGS'] = env.ParseFlags('-I/miru/projects/regex/include -L/miru/projects/regex/lib -lregex'); # Branch prediction if env['BRANCH'] == 'profile': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-fprofile-arcs') elif env['BRANCH'] == 'seed': env.Append(CCFLAGS = '-fbranch-probabilities') # Coverage analysis if env['COVERAGE'] == 'full': env.Append(CCFLAGS = '-fprofile-arcs') env.Append(CCFLAGS = '-ftest-coverage') env.Append(LINKFLAGS = '-fprofile-arcs') env.Append(LINKFLAGS = '-lgcov') # Define separate build environments release = env.Clone(BUILD = 'release') release.Append(CCFLAGS = '-O2') debug = env.Clone(BUILD = 'debug') debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = ['-gdb']) profile = env.Clone(BUILD = 'profile') profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') thirtytwo = release.Clone(BUILD = 'thirtytwo') thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32') # choose and environment to build if env['BUILD'] == 'release': Export({'env':release}) elif env['BUILD'] == 'profile': Export({'env':profile}) elif env['BUILD'] == 'thirtytwo': Export({'env':thirtytwo}) else: Export({'env':debug}) #----------------------------------------------------------------------------- # Re-analyse dependencies Import('env') # vanilla environment if env['WITH_GLIB'] == 'true': env['GLIB_FLAGS'] = env.ParseFlags('!PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --cflags --libs glib-2.0 gthread-2.0'); env.MergeFlags('-Iwin/include -Lwin/lib'); else: env['GLIB_FLAGS'] = ''; # l10n if env['WITH_GETTEXT'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT'); # instrumentation if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true': env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS'); # managed environment for libpgmsnmp, libpgmhttp if env['WITH_SNMP'] == 'true': # no command line helper, so hard code env['SNMP_FLAGS'] = env.ParseFlags('-Iwin/include -Lwin/lib -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp'); def CheckSNMP(context): context.Message('Checking Net-SNMP...'); lastLIBS = context.env['LIBS']; lastCCFLAGS= context.env['CCFLAGS']; context.env.MergeFlags(env['SNMP_FLAGS']); result = context.TryLink(""" int main(int argc, char**argv) { init_agent("PGM"); return 0; } """, '.c'); context.env.Replace(LIBS = lastLIBS, CCFLAGS=lastCCFLAGS); context.Result(not result); return result; def CheckCheck(context): context.Message('Checking Check unit test framework...'); result = context.TryAction('PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --cflags --libs check')[0]; context.Result(result); return result; def CheckEventFD(context): context.Message('Checking eventfd...'); result = context.TryLink(""" #include int main(int argc, char**argv) { eventfd(0,0); return 0; } """, '.c') context.Result(result); return result; tests = { 'CheckCheck': CheckCheck, 'CheckEventFD': CheckEventFD } if env['WITH_SNMP'] == 'true': tests['CheckSNMP'] = CheckSNMP; conf = Configure(env, custom_tests = tests); if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): print 'Net-SNMP libraries not compatible.'; Exit(1); if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): print 'Enabling Check unit tests.'; conf.env['CHECK'] = 'true'; env['CHECK_FLAGS'] = env.ParseFlags('!PKG_CONFIG_PATH=win/lib/pkgconfig pkg-config --cflags --libs check'); else: print 'Disabling Check unit tests.'; conf.env['CHECK'] = 'false'; if conf.CheckEventFD(): print 'Enabling kernel eventfd notification mechanism.'; conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD'); env = conf.Finish(); # add builder to create PIC static libraries for including in shared libraries action_list = [ Action("$ARCOM", "$ARCOMSTR") ]; if env.Detect('ranlib'): ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR"); action_list.append(ranlib_action); pic_lib = Builder( action = action_list, emitter = '$LIBEMITTER', prefix = '$LIBPREFIX', suffix = '$LIBSUFFIX', src_suffix = '$OBJSUFFIX', src_builder = 'SharedObject') env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); #----------------------------------------------------------------------------- ref_node = 'ref/' + env['BUILD'] + '-Win32-' + platform.machine() + '/'; BuildDir(ref_node, '.', duplicate=0) env.Append(CPPPATH = os.getcwd() + '/include'); env.Append(LIBPATH = os.getcwd() + '/' + ref_node); if env['WITH_GLIB'] == 'true': SConscript(ref_node + 'SConscript.libpgmex'); SConscript(ref_node + 'SConscript.libpgm'); if env['WITH_HTTP'] == 'true': SConscript(ref_node + 'SConscript.libpgmhttp'); if env['WITH_SNMP'] == 'true': SConscript(ref_node + 'SConscript.libpgmsnmp'); if env['WITH_TEST'] == 'true': SConscript(ref_node + 'test/SConscript'); if env['WITH_EXAMPLES'] == 'true': SConscript(ref_node + 'examples/SConscript'); # end of file libpgm-5.1.118-1~dfsg/openpgm/pgm/checksum.c0000644000175000017500000005343711640407354017525 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * PGM checksum routines * * Copyright (c) 2006-2010 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include /* locals */ static inline uint16_t do_csum (const void*, uint16_t, uint32_t) PGM_GNUC_PURE; static uint16_t do_csum_8bit (const void*, uint16_t, uint32_t) PGM_GNUC_PURE; static uint16_t do_csum_16bit (const void*, uint16_t, uint32_t) PGM_GNUC_PURE; static uint16_t do_csum_32bit (const void*, uint16_t, uint32_t) PGM_GNUC_PURE; static uint16_t do_csum_64bit (const void*, uint16_t, uint32_t) PGM_GNUC_PURE; #if defined(__amd64) || defined(__x86_64__) || defined(_WIN64) static uint16_t do_csum_vector (const void*, uint16_t, uint32_t) PGM_GNUC_PURE; #endif /* endian independent checksum routine */ static uint16_t do_csum_8bit ( const void* addr, uint16_t len, uint32_t csum ) { uint_fast32_t acc; uint16_t src; const uint8_t* buf; acc = csum; buf = (const uint8_t*)addr; while (len > 1) { /* first byte as most significant */ src = (*buf++) << 8; /* second byte as least significant */ src |= (*buf++); acc += src; len -= 2; } /* trailing odd byte */ if (len > 0) { src = (*buf) << 8; acc += src; } acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); return htons ((uint16_t)acc); } static uint16_t do_csumcpy_8bit ( const void* restrict srcaddr, void* restrict dstaddr, uint16_t len, uint32_t csum ) { uint_fast32_t acc; const uint8_t*restrict srcbuf; uint8_t*restrict dstbuf; uint_fast16_t val16; acc = csum; srcbuf = (const uint8_t*restrict)srcaddr; dstbuf = (uint8_t*restrict)dstaddr; while (len > 1) { /* first byte as most significant */ val16 = (*dstbuf++ = *srcbuf++) << 8; /* second byte as least significant */ val16 |= (*dstbuf++ = *srcbuf++); acc += val16; len -= 2; } /* trailing odd byte */ if (len > 0) { val16 = (*dstbuf = *srcbuf) << 8; acc += val16; } acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); return htons ((uint16_t)acc); } static uint16_t do_csum_16bit ( const void* addr, uint16_t len, uint32_t csum ) { uint_fast32_t acc; const uint8_t* buf; uint16_t remainder; uint_fast16_t count8; bool is_odd; acc = csum; buf = (const uint8_t*)addr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; is_odd = ((uintptr_t)buf & 1); /* align first byte */ if (PGM_UNLIKELY(is_odd)) { ((uint8_t*)&remainder)[1] = *buf++; len--; } /* 8-byte unrolls */ count8 = len >> 3; while (count8--) { acc += ((const uint16_t*)buf)[ 0 ]; acc += ((const uint16_t*)buf)[ 1 ]; acc += ((const uint16_t*)buf)[ 2 ]; acc += ((const uint16_t*)buf)[ 3 ]; buf = &buf[ 8 ]; } len %= 8; /* final 7 bytes */ while (len > 1) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; len -= 2; } /* trailing odd byte */ if (len > 0) { ((uint8_t*)&remainder)[0] = *buf; } acc += remainder; acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } static uint16_t do_csumcpy_16bit ( const void* restrict srcaddr, void* restrict dstaddr, uint16_t len, uint32_t csum ) { uint_fast32_t acc; const uint8_t*restrict srcbuf; uint8_t*restrict dstbuf; uint16_t remainder; uint_fast16_t count8; bool is_odd; acc = csum; srcbuf = (const uint8_t*restrict)srcaddr; dstbuf = (uint8_t*restrict)dstaddr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; is_odd = ((uintptr_t)srcbuf & 1); /* align first byte */ if (PGM_UNLIKELY(is_odd)) { ((uint8_t*restrict)&remainder)[1] = *dstbuf++ = *srcbuf++; len--; } /* 8-byte unrolls, anything larger than 16-byte or less than 8 loses performance */ count8 = len >> 3; while (count8--) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; acc += ((uint16_t*restrict)dstbuf)[ 1 ] = ((const uint16_t*restrict)srcbuf)[ 1 ]; acc += ((uint16_t*restrict)dstbuf)[ 2 ] = ((const uint16_t*restrict)srcbuf)[ 2 ]; acc += ((uint16_t*restrict)dstbuf)[ 3 ] = ((const uint16_t*restrict)srcbuf)[ 3 ]; srcbuf = &srcbuf[ 8 ]; dstbuf = &dstbuf[ 8 ]; } len %= 8; /* final 7 bytes */ while (len > 1) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; len -= 2; } /* trailing odd byte */ if (len > 0) { ((uint8_t*restrict)&remainder)[0] = *dstbuf = *srcbuf; } acc += remainder; acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } static uint16_t do_csum_32bit ( const void* addr, uint16_t len, uint32_t csum ) { uint_fast32_t acc; const uint8_t* buf; uint16_t remainder; uint_fast16_t count; bool is_odd; acc = csum; buf = (const uint8_t*)addr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; is_odd = ((uintptr_t)buf & 1); /* align first byte */ if (PGM_UNLIKELY(is_odd)) { ((uint8_t*)&remainder)[1] = *buf++; len--; } /* 16-bit words */ count = len >> 1; if (count) { if ((uintptr_t)buf & 2) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; count--; len -= 2; } /* 32-bit words */ count >>= 1; if (count) { uint32_t carry = 0; while (count) { acc += carry; acc += ((const uint32_t*)buf)[ 0 ]; carry = ((const uint32_t*)buf)[ 0 ] > acc; buf = &buf[ 4 ]; count--; } acc += carry; acc = (acc >> 16) + (acc & 0xffff); } if (len & 2) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; } } /* trailing odd byte */ if (len & 1) { ((uint8_t*)&remainder)[0] = *buf; } acc += remainder; acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } static uint16_t do_csumcpy_32bit ( const void* restrict srcaddr, void* restrict dstaddr, uint16_t len, uint32_t csum ) { uint_fast32_t acc; const uint8_t*restrict srcbuf; uint8_t*restrict dstbuf; uint16_t remainder; uint_fast16_t count; bool is_odd; acc = csum; srcbuf = (const uint8_t*restrict)srcaddr; dstbuf = (uint8_t*restrict)dstaddr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; is_odd = ((uintptr_t)srcbuf & 1); /* align first byte */ if (PGM_UNLIKELY(is_odd)) { ((uint8_t*restrict)&remainder)[1] = *dstbuf++ = *srcbuf++; len--; } /* 16-bit words */ count = len >> 1; if (count) { if ((uintptr_t)srcbuf & 2) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; count--; len -= 2; } /* 32-bit words */ count >>= 1; if (count) { uint32_t carry = 0; while (count) { acc += carry; acc += ((uint32_t*restrict)dstbuf)[ 0 ] = ((const uint32_t*restrict)srcbuf)[ 0 ]; carry = ((const uint32_t*restrict)dstbuf)[ 0 ] > acc; srcbuf = &srcbuf[ 4 ]; dstbuf = &dstbuf[ 4 ]; count--; } acc += carry; acc = (acc >> 16) + (acc & 0xffff); } if (len & 2) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; } } /* trailing odd byte */ if (len & 1) { ((uint8_t*restrict)&remainder)[0] = *dstbuf = *srcbuf; } acc += remainder; acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } /* best if architecture has native 64-bit words */ static uint16_t do_csum_64bit ( const void* addr, uint16_t len, uint32_t csum ) { uint_fast64_t acc; const uint8_t* buf; uint16_t remainder; uint_fast16_t count; bool is_odd; acc = csum; buf = (const uint8_t*)addr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; is_odd = ((uintptr_t)buf & 1); /* align first byte */ if (PGM_UNLIKELY(is_odd)) { ((uint8_t*)&remainder)[1] = *buf++; len--; } /* 16-bit words */ count = len >> 1; if (count) { if ((uintptr_t)buf & 2) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; count--; len -= 2; } /* 32-bit words */ count >>= 1; if (count) { if ((uintptr_t)buf & 4) { acc += ((const uint32_t*)buf)[ 0 ]; buf = &buf[ 4 ]; count--; len -= 4; } /* 64-bit words */ count >>= 1; if (count) { uint_fast64_t carry = 0; while (count) { acc += carry; acc += ((const uint64_t*)buf)[ 0 ]; carry = ((const uint64_t*)buf)[ 0 ] > acc; buf = &buf[ 8 ]; count--; } acc += carry; acc = (acc >> 32) + (acc & 0xffffffff); } if (len & 4) { acc += ((const uint32_t*)buf)[ 0 ]; buf = &buf[ 4 ]; } } if (len & 2) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; } } /* trailing odd byte */ if (len & 1) { ((uint8_t*)&remainder)[0] = *buf; } acc += remainder; acc = (acc >> 32) + (acc & 0xffffffff); acc = (acc >> 16) + (acc & 0xffff); acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } static uint16_t do_csumcpy_64bit ( const void* restrict srcaddr, void* restrict dstaddr, uint16_t len, uint32_t csum ) { uint_fast64_t acc; const uint8_t* restrict srcbuf; uint8_t* restrict dstbuf; uint16_t remainder; uint_fast16_t count; bool is_odd; acc = csum; srcbuf = (const uint8_t*restrict)srcaddr; dstbuf = (uint8_t*restrict)dstaddr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; is_odd = ((uintptr_t)srcbuf & 1); /* align first byte */ if (PGM_UNLIKELY(is_odd)) { ((uint8_t*restrict)&remainder)[1] = *dstbuf++ = *srcbuf++; len--; } /* 16-bit words */ count = len >> 1; if (count) { if ((uintptr_t)srcbuf & 2) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; count--; len -= 2; } /* 32-bit words */ count >>= 1; if (count) { if ((uintptr_t)srcbuf & 4) { acc += ((uint32_t*restrict)dstbuf)[ 0 ] = ((const uint32_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 4 ]; dstbuf = &dstbuf[ 4 ]; count--; len -= 4; } /* 64-bit words */ count >>= 1; if (count) { /* 64-byte blocks */ uint_fast64_t carry = 0; uint_fast16_t count64 = count >> 3; if (count64) { carry = 0; while (count64) { acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 0 ] = ((const uint64_t*restrict)srcbuf)[ 0 ]; carry = ((const uint64_t*restrict)dstbuf)[ 0 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 1 ] = ((const uint64_t*restrict)srcbuf)[ 1 ]; carry = ((const uint64_t*restrict)dstbuf)[ 1 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 2 ] = ((const uint64_t*restrict)srcbuf)[ 2 ]; carry = ((const uint64_t*restrict)dstbuf)[ 2 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 3 ] = ((const uint64_t*restrict)srcbuf)[ 3 ]; carry = ((const uint64_t*restrict)dstbuf)[ 3 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 4 ] = ((const uint64_t*restrict)srcbuf)[ 4 ]; carry = ((const uint64_t*restrict)dstbuf)[ 4 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 5 ] = ((const uint64_t*restrict)srcbuf)[ 5 ]; carry = ((const uint64_t*restrict)dstbuf)[ 5 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 6 ] = ((const uint64_t*restrict)srcbuf)[ 6 ]; carry = ((const uint64_t*restrict)dstbuf)[ 6 ] > acc; acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 7 ] = ((const uint64_t*restrict)srcbuf)[ 7 ]; carry = ((const uint64_t*restrict)dstbuf)[ 7 ] > acc; srcbuf = &srcbuf[ 64 ]; dstbuf = &dstbuf[ 64 ]; count64--; } acc += carry; acc = (acc >> 32) + (acc & 0xffffffff); count %= 8; } /* last 56 bytes */ carry = 0; while (count) { acc += carry; acc += ((uint64_t*restrict)dstbuf)[ 0 ] = ((const uint64_t*restrict)srcbuf)[ 0 ]; carry = ((const uint64_t*restrict)dstbuf)[ 0 ] > acc; srcbuf = &srcbuf[ 8 ]; dstbuf = &dstbuf[ 8 ]; count--; } acc += carry; acc = (acc >> 32) + (acc & 0xffffffff); } if (len & 4) { acc += ((uint32_t*restrict)dstbuf)[ 0 ] = ((const uint32_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 4 ]; dstbuf = &dstbuf[ 4 ]; } } if (len & 2) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; } } /* trailing odd byte */ if (len & 1) { ((uint8_t*restrict)&remainder)[0] = *dstbuf = *srcbuf; } acc += remainder; acc = (acc >> 32) + (acc & 0xffffffff); acc = (acc >> 16) + (acc & 0xffff); acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } #if defined(__amd64) || defined(__x86_64__) /* simd instructions unique to AMD/Intel 64-bit, so always little endian. */ static uint16_t do_csum_vector ( const void* addr, uint16_t len, uint32_t csum ) { uint64_t acc; /* fixed size for asm */ const uint8_t* buf; uint16_t remainder; /* fixed size for endian swap */ uint_fast16_t count; bool is_odd; acc = csum; buf = (const uint8_t*)addr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; /* align first byte */ is_odd = ((uintptr_t)buf & 1); if (PGM_UNLIKELY(is_odd)) { ((uint8_t*)&remainder)[1] = *buf++; len--; } /* 16-bit words */ count = len >> 1; if (count) { if ((uintptr_t)buf & 2) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; count--; len -= 2; } /* 32-bit words */ count >>= 1; if (count) { if ((uintptr_t)buf & 4) { acc += ((const uint32_t*)buf)[ 0 ]; buf = &buf[ 4 ]; count--; len -= 4; } /* 64-bit words */ count >>= 1; if (count) { uint64_t carry = 0; while (count) { __asm__ volatile ("addq %1, %0\n\t" "adcq %2, %0" : "=r" (acc) : "m" (*(const uint64_t*)buf), "r" (carry), "0" (acc) : "cc" ); buf = &buf[ 8 ]; count--; } acc += carry; acc = (acc >> 32) + (acc & 0xffffffff); } if (len & 4) { acc += ((const uint32_t*)buf)[ 0 ]; buf = &buf[ 4 ]; } } if (len & 2) { acc += ((const uint16_t*)buf)[ 0 ]; buf = &buf[ 2 ]; } } /* trailing odd byte */ if (len & 1) { ((uint8_t*)&remainder)[0] = *buf; } acc += remainder; acc = (acc >> 32) + (acc & 0xffffffff); acc = (acc >> 16) + (acc & 0xffff); acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } static uint16_t do_csumcpy_vector ( const void* restrict srcaddr, void* restrict dstaddr, uint16_t len, uint32_t csum ) { uint64_t acc; /* fixed size for asm */ const uint8_t*restrict srcbuf; uint8_t*restrict dstbuf; uint16_t remainder; /* fixed size for endian swap */ uint_fast16_t count; bool is_odd; acc = csum; srcbuf = (const uint8_t*restrict)srcaddr; dstbuf = (uint8_t*restrict)dstaddr; remainder = 0; if (PGM_UNLIKELY(len == 0)) return (uint16_t)acc; /* fill cache line with source buffer, invalidate destination buffer, * perversly for testing high temporal locality is better than no locality, * whilst in production no locality may be preferred depending on skb re-use. */ pgm_prefetch (srcbuf); pgm_prefetchw (dstbuf); /* align first byte */ is_odd = ((uintptr_t)srcbuf & 1); if (PGM_UNLIKELY(is_odd)) { ((uint8_t*restrict)&remainder)[1] = *dstbuf++ = *srcbuf++; len--; } /* 16-bit words */ count = len >> 1; if (count) { if ((uintptr_t)srcbuf & 2) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; count--; len -= 2; } /* 32-bit words */ count >>= 1; if (count) { if ((uintptr_t)srcbuf & 4) { acc += ((uint32_t*restrict)dstbuf)[ 0 ] = ((const uint32_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 4 ]; dstbuf = &dstbuf[ 4 ]; count--; len -= 4; } /* 64-bit words */ count >>= 1; if (count) { /* 64-byte blocks */ uint64_t carry = 0; uint_fast16_t count64 = count >> 3; while (count64) { pgm_prefetch (&srcbuf[ 64 ]); pgm_prefetchw (&dstbuf[ 64 ]); __asm__ volatile ("movq 0*8(%1), %%r8\n\t" /* load */ "movq 1*8(%1), %%r9\n\t" "movq 2*8(%1), %%r10\n\t" "movq 3*8(%1), %%r11\n\t" "movq 4*8(%1), %%r12\n\t" "movq 5*8(%1), %%r13\n\t" "movq 6*8(%1), %%r14\n\t" "movq 7*8(%1), %%r15\n\t" "adcq %%r8, %0\n\t" /* checksum */ "adcq %%r9, %0\n\t" "adcq %%r10, %0\n\t" "adcq %%r11, %0\n\t" "adcq %%r12, %0\n\t" "adcq %%r13, %0\n\t" "adcq %%r14, %0\n\t" "adcq %%r15, %0\n\t" "adcq %3, %0\n\t" "movq %%r8, 0*8(%2)\n\t" /* save */ "movq %%r9, 1*8(%2)\n\t" "movq %%r10, 2*8(%2)\n\t" "movq %%r11, 3*8(%2)\n\t" "movq %%r12, 4*8(%2)\n\t" "movq %%r13, 5*8(%2)\n\t" "movq %%r14, 6*8(%2)\n\t" "movq %%r15, 7*8(%2)" : "=r" (acc) : "r" (srcbuf), "r" (dstbuf), "r" (carry), "0" (acc) : "cc", "memory", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" ); srcbuf = &srcbuf[ 64 ]; dstbuf = &dstbuf[ 64 ]; count64--; } count %= 8; /* last 56 bytes */ while (count) { __asm__ volatile ("addq %1, %0\n\t" "adcq %2, %0" : "=r" (acc) : "m" (*(const uint64_t*restrict)srcbuf), "r" (carry), "0" (acc) : "cc" ); srcbuf = &srcbuf[ 8 ]; count--; } acc += carry; acc = (acc >> 32) + (acc & 0xffffffff); } if (len & 4) { acc += ((uint32_t*restrict)dstbuf)[ 0 ] = ((const uint32_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 4 ]; dstbuf = &dstbuf[ 4 ]; } } if (len & 2) { acc += ((uint16_t*restrict)dstbuf)[ 0 ] = ((const uint16_t*restrict)srcbuf)[ 0 ]; srcbuf = &srcbuf[ 2 ]; dstbuf = &dstbuf[ 2 ]; } } /* trailing odd byte */ if (len & 1) { ((uint8_t*restrict)&remainder)[0] = *dstbuf = *srcbuf; } acc += remainder; acc = (acc >> 32) + (acc & 0xffffffff); acc = (acc >> 16) + (acc & 0xffff); acc = (acc >> 16) + (acc & 0xffff); acc += (acc >> 16); if (PGM_UNLIKELY(is_odd)) acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); return (uint16_t)acc; } #endif static inline uint16_t do_csum ( const void* addr, uint16_t len, uint32_t csum ) { #if defined(CONFIG_8BIT_CHECKSUM) return do_csum_8bit (addr, len, csum); #elif defined(CONFIG_16BIT_CHECKSUM) return do_csum_16bit (addr, len, csum); #elif defined(CONFIG_32BIT_CHECKSUM) return do_csum_32bit (addr, len, csum); #elif defined(CONFIG_64BIT_CHECKSUM) return do_csum_64bit (addr, len, csum); #elif defined(CONFIG_VECTOR_CHECKSUM) return do_csum_vector (addr, len, csum); #else # error "checksum routine undefined" #endif } /* Calculate an IP header style checksum */ uint16_t pgm_inet_checksum ( const void* addr, uint16_t len, uint16_t csum ) { /* pre-conditions */ pgm_assert (NULL != addr); return ~do_csum (addr, len, csum); } /* Calculate a partial (unfolded) checksum */ uint32_t pgm_compat_csum_partial ( const void* addr, uint16_t len, uint32_t csum ) { /* pre-conditions */ pgm_assert (NULL != addr); csum = (csum >> 16) + (csum & 0xffff); csum += do_csum (addr, len, 0); csum = (csum >> 16) + (csum & 0xffff); return csum; } /* Calculate & copy a partial PGM checksum. * * Optimum performance when src & dst are on same alignment. */ uint32_t pgm_compat_csum_partial_copy ( const void* restrict src, void* restrict dst, uint16_t len, uint32_t csum ) { /* pre-conditions */ pgm_assert (NULL != src); pgm_assert (NULL != dst); #if defined( __sparc__ ) || defined( __sparc ) || defined( __sparcv9 ) /* SPARC will not handle destination & source addresses with different alignment */ memcpy (dst, src, len); return pgm_csum_partial (dst, len, csum); #else # if defined(CONFIG_8BIT_CHECKSUM) return do_csumcpy_8bit (src, dst, len, csum); # elif defined(CONFIG_16BIT_CHECKSUM) return do_csumcpy_16bit (src, dst, len, csum); # elif defined(CONFIG_32BIT_CHECKSUM) return do_csumcpy_32bit (src, dst, len, csum); # elif defined(CONFIG_64BIT_CHECKSUM) return do_csumcpy_64bit (src, dst, len, csum); # elif defined(CONFIG_VECTOR_CHECKSUM) return do_csumcpy_vector (src, dst, len, csum); # else memcpy (dst, src, len); return pgm_csum_partial (dst, len, csum); # endif #endif } /* Fold 32 bit checksum accumulator into 16 bit final value. */ uint16_t pgm_csum_fold ( uint32_t csum ) { csum = (csum >> 16) + (csum & 0xffff); csum += (csum >> 16); /* handle special case of no checksum */ return (uint16_t)(csum == 0xffff ? csum : ~csum); } /* Add together two unfolded checksum accumulators */ uint32_t pgm_csum_block_add ( uint32_t csum, uint32_t csum2, const uint16_t offset ) { if (offset & 1) /* byte magic on odd offset */ csum2 = ((csum2 & 0xff00ff) << 8) + ((csum2 >> 8) & 0xff00ff); csum += csum2; return csum + (csum < csum2); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/txw_unittest.c0000644000175000017500000005155211640407354020500 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for transmit window. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock global */ #define pgm_histogram_add mock_pgm_histogram_add #define pgm_rs_create mock_pgm_rs_create #define pgm_rs_destroy mock_pgm_rs_destroy #define pgm_rs_encode mock_pgm_rs_encode #define pgm_compat_csum_partial mock_pgm_compat_csum_partial #define pgm_histogram_init mock_pgm_histogram_init #define TXW_DEBUG #include "txw.c" /** reed-solomon module */ void mock_pgm_rs_create ( pgm_rs_t* rs, uint8_t n, uint8_t k ) { } void mock_pgm_rs_destroy ( pgm_rs_t* rs ) { } void mock_pgm_rs_encode( pgm_rs_t* rs, const pgm_gf8_t** src, const uint8_t offset, pgm_gf8_t* dst, const uint16_t len ) { } /** checksum module */ uint32_t mock_pgm_compat_csum_partial ( const void* addr, uint16_t len, uint32_t csum ) { return 0x0; } void mock_pgm_histogram_init ( pgm_histogram_t* histogram ) { } void mock_pgm_histogram_add ( pgm_histogram_t* histogram, int value ) { } /* mock functions for external references */ size_t pgm_pkt_offset ( const bool can_fragment, const sa_family_t pgmcc_family /* 0 = disable */ ) { return 0; } PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* generate valid skb, data pointer pointing to PGM payload */ static struct pgm_sk_buff_t* generate_valid_skb (void) { const guint16 tsdu_length = 1000; const guint16 header_length = sizeof(struct pgm_header) + sizeof(struct pgm_data); struct pgm_sk_buff_t* skb = pgm_alloc_skb (1500); /* fake but valid transport and timestamp */ skb->sock = (pgm_sock_t*)0x1; skb->tstamp = 1; /* header */ pgm_skb_reserve (skb, header_length); memset (skb->head, 0, header_length); skb->pgm_header = (struct pgm_header*)skb->head; skb->pgm_data = (struct pgm_data*)(skb->pgm_header + 1); skb->pgm_header->pgm_type = PGM_ODATA; skb->pgm_header->pgm_tsdu_length = g_htons (tsdu_length); /* DATA */ pgm_skb_put (skb, tsdu_length); return skb; } /* target: * pgm_txw_t* * pgm_txw_create ( * const pgm_tsi_t* const tsi, * const guint16 tpdu_size, * const guint32 sqns, * const guint secs, * const guint max_rte, * const gboolean use_fec, * const guint rs_n, * const guint rs_k * ) */ /* vanilla sequence count window */ START_TEST (test_create_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; fail_if (NULL == pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0), "create failed"); } END_TEST /* vanilla time based window */ START_TEST (test_create_pass_002) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; fail_if (NULL == pgm_txw_create (&tsi, 1500, 0, 60, 800000, FALSE, 0, 0), "create failed"); } END_TEST /* jumbo frame */ START_TEST (test_create_pass_003) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; fail_if (NULL == pgm_txw_create (&tsi, 9000, 0, 60, 800000, FALSE, 0, 0), "create failed"); } END_TEST /* max frame */ START_TEST (test_create_pass_004) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; fail_if (NULL == pgm_txw_create (&tsi, UINT16_MAX, 0, 60, 800000, FALSE, 0, 0), "create failed"); } END_TEST /* invalid tpdu size */ START_TEST (test_create_fail_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const pgm_txw_t* window = pgm_txw_create (&tsi, 0, 0, 60, 800000, FALSE, 0, 0); fail ("reached"); } END_TEST /* no specified sequence count or time value */ START_TEST (test_create_fail_002) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const pgm_txw_t* window = pgm_txw_create (&tsi, 0, 0, 0, 800000, FALSE, 0, 0); fail ("reached"); } END_TEST /* no specified rate */ START_TEST (test_create_fail_003) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const pgm_txw_t* window = pgm_txw_create (&tsi, 0, 0, 60, 0, FALSE, 0, 0); fail ("reached"); } END_TEST /* all invalid */ START_TEST (test_create_fail_004) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const pgm_txw_t* window = pgm_txw_create (NULL, 0, 0, 0, 0, FALSE, 0, 0); fail ("reached"); } END_TEST /* target: * void * pgm_txw_shutdown ( * pgm_txw_t* const window * ) */ START_TEST (test_shutdown_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_shutdown_fail_001) { pgm_txw_shutdown (NULL); fail ("reached"); } END_TEST /* target: * void * pgm_txw_add ( * pgm_txw_t* const window, * struct pgm_sk_buff_t* const skb * ) * failures raise assert errors and stop process execution. */ START_TEST (test_add_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); pgm_txw_shutdown (window); } END_TEST /* null skb */ START_TEST (test_add_fail_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); pgm_txw_add (window, NULL); fail ("reached"); } END_TEST /* null window */ START_TEST (test_add_fail_002) { struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (NULL, skb); fail ("reached"); } END_TEST /* null skb content */ START_TEST (test_add_fail_003) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); char buffer[1500]; memset (buffer, 0, sizeof(buffer)); pgm_txw_add (window, (struct pgm_sk_buff_t*)buffer); fail ("reached"); } END_TEST /* target: * struct pgm_sk_buff_t* * pgm_txw_peek ( * pgm_txw_t* const window, * const guint32 sequence * ) */ START_TEST (test_peek_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (skb == pgm_txw_peek (window, window->trail), "peek failed"); pgm_txw_shutdown (window); } END_TEST /* null window */ START_TEST (test_peek_fail_001) { const struct pgm_sk_buff_t* skb = pgm_txw_peek (NULL, 0); fail ("reached"); } END_TEST /* empty window */ START_TEST (test_peek_fail_002) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); fail_unless (NULL == pgm_txw_peek (window, window->trail), "peek failed"); pgm_txw_shutdown (window); } END_TEST /** inline function tests **/ /* pgm_txw_max_length () */ START_TEST (test_max_length_pass_001) { const guint window_length = 100; const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, window_length, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); fail_unless (window_length == pgm_txw_max_length (window), "max_length failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_max_length_fail_001) { const size_t answer = pgm_txw_max_length (NULL); fail ("reached"); } END_TEST /* pgm_txw_length () */ START_TEST (test_length_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); fail_unless (0 == pgm_txw_length (window), "length failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (1 == pgm_txw_length (window), "length failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_length_fail_001) { const uint32_t answer = pgm_txw_length (NULL); fail ("reached"); } END_TEST /* pgm_txw_size () */ START_TEST (test_size_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); fail_unless (0 == pgm_txw_size (window), "size failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (1000 == pgm_txw_size (window), "size failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_size_fail_001) { const size_t answer = pgm_txw_size (NULL); fail ("reached"); } END_TEST /* pgm_txw_is_empty */ START_TEST (test_is_empty_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); fail_unless (pgm_txw_is_empty (window), "is_empty failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_if (pgm_txw_is_empty (window), "is_empty failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_is_empty_fail_001) { const bool answer = pgm_txw_is_empty (NULL); fail ("reached"); } END_TEST /* pgm_txw_is_full */ START_TEST (test_is_full_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 1, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); fail_if (pgm_txw_is_full (window), "is_full failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (pgm_txw_is_full (window), "is_full failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_is_full_fail_001) { const bool answer = pgm_txw_is_full (NULL); fail ("reached"); } END_TEST /* pgm_txw_lead */ START_TEST (test_lead_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); guint32 lead = pgm_txw_lead (window); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (lead + 1 == pgm_txw_lead (window), "lead failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_lead_fail_001) { const uint32_t answer = pgm_txw_lead (NULL); fail ("reached"); } END_TEST /* pgm_txw_next_lead */ START_TEST (test_next_lead_pass_001) { const guint window_length = 100; const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, window_length, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); guint32 next_lead = pgm_txw_next_lead (window); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (next_lead == pgm_txw_lead (window), "lead failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_next_lead_fail_001) { const uint32_t answer = pgm_txw_next_lead (NULL); fail ("reached"); } END_TEST /* pgm_txw_trail */ START_TEST (test_trail_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 1, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); /* does not advance with adding skb */ guint32 trail = pgm_txw_trail (window); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (trail == pgm_txw_trail (window), "trail failed"); /* does advance when filling up window */ skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_if (trail == pgm_txw_trail (window), "trail failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_trail_fail_001) { const uint32_t answer = pgm_txw_trail (NULL); fail ("reached"); } END_TEST /* target: * bool * pgm_txw_retransmit_push ( * pgm_txw_t* const window, * const uint32_t sequence, * const bool is_parity, * const uint8_t tg_sqn_shift * ) */ START_TEST (test_retransmit_push_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); /* empty window invalidates all requests */ fail_unless (FALSE == pgm_txw_retransmit_push (window, window->trail, FALSE, 0), "retransmit_push failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); /* first request */ fail_unless (TRUE == pgm_txw_retransmit_push (window, window->trail, FALSE, 0), "retransmit_push failed"); /* second request eliminated */ fail_unless (FALSE == pgm_txw_retransmit_push (window, window->trail, FALSE, 0), "retransmit_push failed"); pgm_txw_shutdown (window); } END_TEST START_TEST (test_retransmit_push_fail_001) { const bool answer = pgm_txw_retransmit_push (NULL, 0, FALSE, 0); fail ("reached"); } END_TEST /* target: * struct pgm_sk_buff_t* * pgm_txw_retransmit_try_peek ( * pgm_txw_t* const window * ) */ START_TEST (test_retransmit_try_peek_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (1 == pgm_txw_retransmit_push (window, window->trail, FALSE, 0), "retransmit_push failed"); fail_unless (NULL != pgm_txw_retransmit_try_peek (window), "retransmit_try_peek failed"); pgm_txw_shutdown (window); } END_TEST /* null window */ START_TEST (test_retransmit_try_peek_fail_001) { const struct pgm_sk_buff_t* skb = pgm_txw_retransmit_try_peek (NULL); fail ("reached"); } END_TEST /* target: * void * pgm_txw_retransmit_remove_head ( * pgm_txw_t* const window * ) */ START_TEST (test_retransmit_remove_head_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); struct pgm_sk_buff_t* skb = generate_valid_skb (); fail_if (NULL == skb, "generate_valid_skb failed"); pgm_txw_add (window, skb); fail_unless (1 == pgm_txw_retransmit_push (window, window->trail, FALSE, 0), "retransmit_push failed"); fail_unless (NULL != pgm_txw_retransmit_try_peek (window), "retransmit_try_peek failed"); pgm_txw_retransmit_remove_head (window); pgm_txw_shutdown (window); } END_TEST /* null window */ START_TEST (test_retransmit_remove_head_fail_001) { pgm_txw_retransmit_remove_head (NULL); fail ("reached"); } END_TEST /* empty retransmit queue */ START_TEST (test_retransmit_remove_head_fail_002) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; pgm_txw_t* window = pgm_txw_create (&tsi, 0, 100, 0, 0, FALSE, 0, 0); fail_if (NULL == window, "create failed"); pgm_txw_retransmit_remove_head (window); fail ("reached"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_create = tcase_create ("create"); suite_add_tcase (s, tc_create); tcase_add_test (tc_create, test_create_pass_001); tcase_add_test (tc_create, test_create_pass_002); tcase_add_test (tc_create, test_create_pass_003); tcase_add_test (tc_create, test_create_pass_004); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_create, test_create_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_create, test_create_fail_002, SIGABRT); tcase_add_test_raise_signal (tc_create, test_create_fail_003, SIGABRT); tcase_add_test_raise_signal (tc_create, test_create_fail_004, SIGABRT); #endif TCase* tc_shutdown = tcase_create ("shutdown"); suite_add_tcase (s, tc_shutdown); tcase_add_test (tc_shutdown, test_shutdown_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_shutdown, test_shutdown_fail_001, SIGABRT); #endif TCase* tc_add = tcase_create ("add"); suite_add_tcase (s, tc_add); tcase_add_test (tc_add, test_add_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_add, test_add_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_add, test_add_fail_002, SIGABRT); tcase_add_test_raise_signal (tc_add, test_add_fail_003, SIGABRT); #endif TCase* tc_peek = tcase_create ("peek"); suite_add_tcase (s, tc_peek); tcase_add_test (tc_peek, test_peek_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_peek, test_peek_fail_001, SIGABRT); #endif /* logical not fatal errors */ tcase_add_test (tc_peek, test_peek_fail_002); TCase* tc_max_length = tcase_create ("max-length"); suite_add_tcase (s, tc_max_length); tcase_add_test (tc_max_length, test_max_length_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_max_length, test_max_length_fail_001, SIGABRT); #endif TCase* tc_length = tcase_create ("length"); suite_add_tcase (s, tc_length); tcase_add_test (tc_length, test_length_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_length, test_length_fail_001, SIGABRT); #endif TCase* tc_size = tcase_create ("size"); suite_add_tcase (s, tc_size); tcase_add_test (tc_size, test_size_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_size, test_size_fail_001, SIGABRT); #endif TCase* tc_is_empty = tcase_create ("is-empty"); suite_add_tcase (s, tc_is_empty); tcase_add_test (tc_is_empty, test_is_empty_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_is_empty, test_is_empty_fail_001, SIGABRT); #endif TCase* tc_is_full = tcase_create ("is-full"); suite_add_tcase (s, tc_is_full); tcase_add_test (tc_is_full, test_is_full_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_is_full, test_is_full_fail_001, SIGABRT); #endif TCase* tc_lead = tcase_create ("lead"); suite_add_tcase (s, tc_lead); tcase_add_test (tc_lead, test_lead_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_lead, test_lead_fail_001, SIGABRT); #endif TCase* tc_next_lead = tcase_create ("next-lead"); suite_add_tcase (s, tc_next_lead); tcase_add_test (tc_next_lead, test_next_lead_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_next_lead, test_next_lead_fail_001, SIGABRT); #endif TCase* tc_trail = tcase_create ("trail"); suite_add_tcase (s, tc_trail); tcase_add_test (tc_trail, test_trail_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_trail, test_trail_fail_001, SIGABRT); #endif TCase* tc_retransmit_push = tcase_create ("retransmit-push"); suite_add_tcase (s, tc_retransmit_push); tcase_add_test (tc_retransmit_push, test_retransmit_push_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_retransmit_push, test_retransmit_push_fail_001, SIGABRT); #endif TCase* tc_retransmit_try_peek = tcase_create ("retransmit-try-peek"); suite_add_tcase (s, tc_retransmit_try_peek); tcase_add_test (tc_retransmit_try_peek, test_retransmit_try_peek_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_retransmit_try_peek, test_retransmit_try_peek_fail_001, SIGABRT); #endif TCase* tc_retransmit_remove_head = tcase_create ("retransmit-remove-head"); suite_add_tcase (s, tc_retransmit_remove_head); tcase_add_test (tc_retransmit_remove_head, test_retransmit_remove_head_pass_001); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_retransmit_remove_head, test_retransmit_remove_head_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_retransmit_remove_head, test_retransmit_remove_head_fail_002, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/tsi_unittest.c0000644000175000017500000001067511640407354020456 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * unit tests for transport session ID helper functions. * * Copyright (c) 2009 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #ifdef _WIN32 # define PGM_CHECK_NOFORK 1 #endif /* mock state */ /* mock functions for external references */ size_t pgm_transport_pkt_offset2 ( const bool can_fragment, const bool use_pgmcc ) { return 0; } #define TSI_DEBUG #include "tsi.c" PGM_GNUC_INTERNAL int pgm_get_nprocs (void) { return 1; } /* target: * gchar* * pgm_tsi_print ( * const pgm_tsi_t* tsi * ) */ START_TEST (test_print_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; fail_if (NULL == pgm_tsi_print (&tsi), "print failed"); } END_TEST START_TEST (test_print_pass_002) { fail_unless (NULL == pgm_tsi_print (NULL), "print failed"); } END_TEST /* target: * int * pgm_tsi_print_r ( * const pgm_tsi_t* tsi, * char* buf, * gsize bufsize * ) */ START_TEST (test_print_r_pass_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; char buf[PGM_TSISTRLEN]; fail_unless (pgm_tsi_print_r (&tsi, buf, sizeof(buf)) > 0, "print_r failed"); } END_TEST START_TEST (test_print_r_pass_002) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; char buf[PGM_TSISTRLEN]; fail_unless (pgm_tsi_print_r (NULL, buf, sizeof(buf)) == -1, "print_r failed"); fail_unless (pgm_tsi_print_r (&tsi, NULL, sizeof(buf)) == -1, "print_r failed"); fail_unless (pgm_tsi_print_r (&tsi, buf, 0) == -1, "print_r failed"); } END_TEST /* target: * gboolean * pgm_tsi_equal ( * gconstpointer tsi1, * gconstpointer tsi2 * ) */ START_TEST (test_equal_pass_001) { const pgm_tsi_t tsi1 = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const pgm_tsi_t tsi2 = { { 1, 2, 3, 4, 5, 6 }, 1000 }; fail_unless (pgm_tsi_equal (&tsi1, &tsi2), "equal failed"); } END_TEST START_TEST (test_equal_pass_002) { const pgm_tsi_t tsi1 = { { 1, 2, 3, 4, 5, 6 }, 1000 }; const pgm_tsi_t tsi2 = { { 9, 8, 7, 6, 5, 4 }, 2000 }; fail_if (pgm_tsi_equal (&tsi1, &tsi2), "equal failed"); } END_TEST START_TEST (test_equal_fail_001) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; gboolean retval = pgm_tsi_equal (NULL, &tsi); fail ("reached"); } END_TEST START_TEST (test_equal_fail_002) { const pgm_tsi_t tsi = { { 1, 2, 3, 4, 5, 6 }, 1000 }; gboolean retval = pgm_tsi_equal (&tsi, NULL); fail ("reached"); } END_TEST static Suite* make_test_suite (void) { Suite* s; s = suite_create (__FILE__); TCase* tc_print = tcase_create ("print"); suite_add_tcase (s, tc_print); tcase_add_test (tc_print, test_print_pass_001); tcase_add_test (tc_print, test_print_pass_002); TCase* tc_print_r = tcase_create ("print-r"); suite_add_tcase (s, tc_print_r); tcase_add_test (tc_print_r, test_print_r_pass_001); tcase_add_test (tc_print_r, test_print_r_pass_002); TCase* tc_equal = tcase_create ("equal"); suite_add_tcase (s, tc_equal); tcase_add_test (tc_equal, test_equal_pass_001); tcase_add_test (tc_equal, test_equal_pass_002); #ifndef PGM_CHECK_NOFORK tcase_add_test_raise_signal (tc_equal, test_equal_fail_001, SIGABRT); tcase_add_test_raise_signal (tc_equal, test_equal_fail_002, SIGABRT); #endif return s; } static Suite* make_master_suite (void) { Suite* s = suite_create ("Master"); return s; } int main (void) { pgm_messages_init(); SRunner* sr = srunner_create (make_master_suite ()); srunner_add_suite (sr, make_test_suite ()); srunner_run_all (sr, CK_ENV); int number_failed = srunner_ntests_failed (sr); srunner_free (sr); pgm_messages_shutdown(); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/gcov.sh0000755000175000017500000000175511640407354017050 0ustar locallocal#!/bin/bash gcov -fno ref/debug async_unittest.c gcov -fno ref/debug checksum_unittest.c gcov -fno ref/debug getifaddrs_unittest.c gcov -fno ref/debug getnodeaddr_unittest.c gcov -fno ref/debug gsi_unittest.c gcov -fno ref/debug http_unittest.c gcov -fno ref/debug if_unittest.c gcov -fno ref/debug indextoaddr_unittest.c gcov -fno ref/debug inet_network_unittest.c gcov -fno ref/debug md5_unittest.c gcov -fno ref/debug net_unittest.c gcov -fno ref/debug packet_unittest.c gcov -fno ref/debug pgmMIB_unittest.c gcov -fno ref/debug pgm_unittest.c gcov -fno ref/debug rate_control_unittest.c gcov -fno ref/debug receiver_unittest.c gcov -fno ref/debug recv_unittest.c gcov -fno ref/debug reed_solomon_unittest.c gcov -fno ref/debug rxwi_unittest.c gcov -fno ref/debug signal_unittest.c gcov -fno ref/debug snmp_unittest.c gcov -fno ref/debug source_unittest.c gcov -fno ref/debug timer_unittest.c gcov -fno ref/debug time_unittest.c gcov -fno ref/debug tsi_unittest.c gcov -fno ref/debug txwi_unittest.c libpgm-5.1.118-1~dfsg/openpgm/pgm/socket.c.c89.patch0000644000175000017500000002204611640407354020703 0ustar locallocal--- socket.c 2011-04-07 10:09:44.000000000 +0800 +++ socket.c89.c 2011-04-07 10:09:49.000000000 +0800 @@ -377,7 +377,9 @@ new_sock->adv_mode = 0; /* advance with time */ /* PGMCC */ +#pragma warning( disable : 4244 ) new_sock->acker_nla.ss_family = family; +#pragma warning( default : 4244 ) /* source-side */ pgm_mutex_init (&new_sock->source_mutex); @@ -475,6 +477,7 @@ /* Stevens: "SO_REUSEADDR has datatype int." */ pgm_trace (PGM_LOG_ROLE_NETWORK,_("Set socket sharing.")); + { const int v = 1; #ifndef SO_REUSEPORT if (SOCKET_ERROR == setsockopt (new_sock->recv_sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&v, sizeof(v)) || @@ -505,10 +508,12 @@ goto err_destroy; } #endif + } /* request extra packet information to determine destination address on each packet */ #ifndef CONFIG_TARGET_WINE pgm_trace (PGM_LOG_ROLE_NETWORK,_("Request socket packet-info.")); + { const sa_family_t recv_family = new_sock->family; if (SOCKET_ERROR == pgm_sockaddr_pktinfo (new_sock->recv_sock, recv_family, TRUE)) { @@ -521,6 +526,7 @@ pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)); goto err_destroy; } + } #endif } else @@ -777,8 +783,11 @@ { int*restrict intervals = (int*restrict)optval; *optlen = sock->spm_heartbeat_len; - for (unsigned i = 0; i < sock->spm_heartbeat_len; i++) + { + unsigned i; + for (i = 0; i < sock->spm_heartbeat_len; i++) intervals[i] = sock->spm_heartbeat_interval[i + 1]; + } } status = TRUE; break; @@ -1212,8 +1221,11 @@ sock->spm_heartbeat_len = optlen / sizeof (int); sock->spm_heartbeat_interval = pgm_new (unsigned, sock->spm_heartbeat_len + 1); sock->spm_heartbeat_interval[0] = 0; - for (unsigned i = 0; i < sock->spm_heartbeat_len; i++) + { + unsigned i; + for (i = 0; i < sock->spm_heartbeat_len; i++) sock->spm_heartbeat_interval[i + 1] = ((const int*)optval)[i]; + } } status = TRUE; break; @@ -1458,6 +1470,7 @@ break; if (PGM_UNLIKELY(fecinfo->group_size > fecinfo->block_size)) break; + { const uint8_t parity_packets = fecinfo->block_size - fecinfo->group_size; /* technically could re-send previous packets */ if (PGM_UNLIKELY(fecinfo->proactive_packets > parity_packets)) @@ -1474,6 +1487,7 @@ sock->rs_n = fecinfo->block_size; sock->rs_k = fecinfo->group_size; sock->rs_proactive_h = fecinfo->proactive_packets; + } } status = TRUE; break; @@ -1596,7 +1610,9 @@ { const struct group_req* gr = optval; /* verify not duplicate group/interface pairing */ - for (unsigned i = 0; i < sock->recv_gsr_len; i++) + { + unsigned i; + for (i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gr->gr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0 && pgm_sockaddr_cmp ((const struct sockaddr*)&gr->gr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_source) == 0 && @@ -1615,6 +1631,7 @@ break; } } + } if (PGM_UNLIKELY(sock->family != gr->gr_group.ss_family)) break; sock->recv_gsr[sock->recv_gsr_len].gsr_interface = gr->gr_interface; @@ -1646,7 +1663,9 @@ break; { const struct group_req* gr = optval; - for (unsigned i = 0; i < sock->recv_gsr_len;) + { + unsigned i; + for (i = 0; i < sock->recv_gsr_len;) { if ((pgm_sockaddr_cmp ((const struct sockaddr*)&gr->gr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0) && /* drop all matching receiver entries */ @@ -1663,6 +1682,7 @@ } i++; } + } if (PGM_UNLIKELY(sock->family != gr->gr_group.ss_family)) break; if (SOCKET_ERROR == pgm_sockaddr_leave_group (sock->recv_sock, sock->family, gr)) @@ -1721,7 +1741,9 @@ { const struct group_source_req* gsr = optval; /* verify if existing group/interface pairing */ - for (unsigned i = 0; i < sock->recv_gsr_len; i++) + { + unsigned i; + for (i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0 && (gsr->gsr_interface == sock->recv_gsr[i].gsr_interface || @@ -1746,6 +1768,7 @@ break; } } + } if (PGM_UNLIKELY(sock->family != gsr->gsr_group.ss_family)) break; if (PGM_UNLIKELY(sock->family != gsr->gsr_source.ss_family)) @@ -1768,7 +1791,9 @@ { const struct group_source_req* gsr = optval; /* verify if existing group/interface pairing */ - for (unsigned i = 0; i < sock->recv_gsr_len; i++) + { + unsigned i; + for (i = 0; i < sock->recv_gsr_len; i++) { if (pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_group, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0 && pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_source, (struct sockaddr*)&sock->recv_gsr[i].gsr_source) == 0 && @@ -1782,6 +1807,7 @@ } } } + } if (PGM_UNLIKELY(sock->family != gsr->gsr_group.ss_family)) break; if (PGM_UNLIKELY(sock->family != gsr->gsr_source.ss_family)) @@ -2085,17 +2111,19 @@ /* determine IP header size for rate regulation engine & stats */ sock->iphdr_len = (AF_INET == sock->family) ? sizeof(struct pgm_ip) : sizeof(struct pgm_ip6_hdr); - pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming IP header size of %" PRIzu " bytes", sock->iphdr_len); + pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming IP header size of %" PRIzu " bytes", (unsigned long)sock->iphdr_len); if (sock->udp_encap_ucast_port) { const size_t udphdr_len = sizeof(struct pgm_udphdr); - pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming UDP header size of %" PRIzu " bytes", udphdr_len); + pgm_trace (PGM_LOG_ROLE_NETWORK,"Assuming UDP header size of %" PRIzu " bytes", (unsigned long)udphdr_len); sock->iphdr_len += udphdr_len; } + { const sa_family_t pgmcc_family = sock->use_pgmcc ? sock->family : 0; sock->max_tsdu = (uint16_t)(sock->max_tpdu - sock->iphdr_len - pgm_pkt_offset (FALSE, pgmcc_family)); sock->max_tsdu_fragment = (uint16_t)(sock->max_tpdu - sock->iphdr_len - pgm_pkt_offset (TRUE, pgmcc_family)); + { const unsigned max_fragments = sock->txw_sqns ? MIN( PGM_MAX_FRAGMENTS, sock->txw_sqns ) : PGM_MAX_FRAGMENTS; sock->max_apdu = MIN( PGM_MAX_APDU, max_fragments * sock->max_tsdu_fragment ); @@ -2141,6 +2169,7 @@ */ /* TODO: different ports requires a new bound socket */ + { union { struct sockaddr sa; struct sockaddr_in s4; @@ -2309,6 +2338,7 @@ /* save send side address for broadcasting as source nla */ memcpy (&sock->send_addr, &send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)); + } /* rx to nak processor notify channel */ if (sock->can_send_data) @@ -2316,7 +2346,7 @@ /* setup rate control */ if (sock->txw_max_rte > 0) { pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Setting rate regulation to %" PRIzd " bytes per second."), - sock->txw_max_rte); + (long)sock->txw_max_rte); pgm_rate_create (&sock->rate_control, sock->txw_max_rte, sock->iphdr_len, sock->max_tpdu); sock->is_controlled_spm = TRUE; /* must always be set */ } else @@ -2324,13 +2354,13 @@ if (sock->odata_max_rte > 0) { pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Setting ODATA rate regulation to %" PRIzd " bytes per second."), - sock->odata_max_rte); + (long)sock->odata_max_rte); pgm_rate_create (&sock->odata_rate_control, sock->odata_max_rte, sock->iphdr_len, sock->max_tpdu); sock->is_controlled_odata = TRUE; } if (sock->rdata_max_rte > 0) { pgm_trace (PGM_LOG_ROLE_RATE_CONTROL,_("Setting RDATA rate regulation to %" PRIzd " bytes per second."), - sock->rdata_max_rte); + (long)sock->rdata_max_rte); pgm_rate_create (&sock->rdata_rate_control, sock->rdata_max_rte, sock->iphdr_len, sock->max_tpdu); sock->is_controlled_rdata = TRUE; } @@ -2346,6 +2376,8 @@ pgm_rwlock_writer_unlock (&sock->lock); pgm_debug ("PGM socket successfully bound."); return TRUE; + } + } } bool @@ -2359,11 +2391,14 @@ #ifdef CONFIG_TARGET_WINE pgm_return_val_if_fail (sock->recv_gsr_len == 1, FALSE); #endif - for (unsigned i = 0; i < sock->recv_gsr_len; i++) + { + unsigned i; + for (i = 0; i < sock->recv_gsr_len; i++) { pgm_return_val_if_fail (sock->recv_gsr[i].gsr_group.ss_family == sock->recv_gsr[0].gsr_group.ss_family, FALSE); pgm_return_val_if_fail (sock->recv_gsr[i].gsr_group.ss_family == sock->recv_gsr[i].gsr_source.ss_family, FALSE); } + } pgm_return_val_if_fail (sock->send_gsr.gsr_group.ss_family == sock->recv_gsr[0].gsr_group.ss_family, FALSE); /* shutdown */ if (PGM_UNLIKELY(!pgm_rwlock_writer_trylock (&sock->lock))) @@ -2472,6 +2507,7 @@ return SOCKET_ERROR; } + { const bool is_congested = (sock->use_pgmcc && sock->tokens < pgm_fp8 (1)) ? TRUE : FALSE; if (readfds) @@ -2500,6 +2536,7 @@ #endif } } + { const SOCKET pending_fd = pgm_notify_get_socket (&sock->pending_notify); FD_SET(pending_fd, readfds); #ifndef _WIN32 @@ -2507,6 +2544,7 @@ #else fds++; #endif + } } if (sock->can_send_data && writefds && !is_congested) @@ -2524,6 +2562,7 @@ #else return *n_fds + fds; #endif + } } #if defined(CONFIG_HAVE_POLL) || defined(CONFIG_HAVE_WSAPOLL) libpgm-5.1.118-1~dfsg/openpgm/pgm/mem.c.c89.patch0000644000175000017500000000620011640407354020163 0ustar locallocal--- mem.c 2011-03-29 20:36:18.000000000 +0800 +++ mem.c89.c 2011-03-29 20:36:24.000000000 +0800 @@ -79,16 +79,24 @@ if (NULL == string) return result; +/* C++ warning completely irrelevant for C */ +#pragma warning( disable : 4996 ) if (!strcasecmp (string, "all")) { - for (unsigned i = 0; i < nkeys; i++) + { + unsigned i; + for (i = 0; i < nkeys; i++) result |= keys[i].value; + } } else if (!strcasecmp (string, "help")) { fprintf (stderr, "Supported debug values:"); - for (unsigned i = 0; i < nkeys; i++) + { + unsigned i; + for (i = 0; i < nkeys; i++) fprintf (stderr, " %s", keys[i].key); + } fprintf (stderr, "\n"); } else @@ -97,14 +105,18 @@ const char* q = strpbrk (string, ":;, \t"); if (!q) q = string + strlen (string); - for (unsigned i = 0; i < nkeys; i++) + { + unsigned i; + for (i = 0; i < nkeys; i++) if (debug_key_matches (keys[i].key, string, (unsigned)(q - string))) result |= keys[i].value; + } string = q; if (*string) string++; } } +#pragma warning( default : 4996 ) return result; } @@ -122,11 +134,13 @@ if (pgm_atomic_exchange_and_add32 (&mem_ref_count, 1) > 0) return; + { const errno_t err = pgm_dupenv_s (&env, &envlen, "PGM_DEBUG"); if (0 == err && envlen > 0) { flags = pgm_parse_debug_string (env, keys, PGM_N_ELEMENTS (keys)); pgm_free (env); } + } if (flags & 1) pgm_mem_gc_friendly = TRUE; @@ -159,11 +173,11 @@ #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, - n_bytes); + (unsigned long)n_bytes); #else pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, - n_bytes); + (unsigned long)n_bytes); #endif abort (); } @@ -182,11 +196,11 @@ #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): overflow allocating %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, - n_blocks, block_bytes); + (unsigned long)n_blocks, (unsigned long)block_bytes); #else pgm_fatal ("file %s: line %d: overflow allocating %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, - n_blocks, block_bytes); + (unsigned long)n_blocks, (unsigned long)block_bytes); #endif } return pgm_malloc (n_blocks * block_bytes); @@ -206,11 +220,11 @@ #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, - n_bytes); + (unsigned long)n_bytes); #else pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, - n_bytes); + (unsigned long)n_bytes); #endif abort (); } @@ -232,11 +246,11 @@ #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, - n_blocks, block_bytes); + (unsigned long)n_blocks, (unsigned long)block_bytes); #else pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, - n_blocks, block_bytes); + (unsigned long)n_blocks, (unsigned long)block_bytes); #endif abort (); } libpgm-5.1.118-1~dfsg/openpgm/pgm/COPYING0000644000175000017500000006350411640407354016606 0ustar locallocal GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libpgm-5.1.118-1~dfsg/openpgm/pgm/INSTALL0000644000175000017500000000067111640407354016600 0ustar locallocalFor building instructions, see: http://code.google.com/p/openpgm/wiki/OpenPgm5CReferenceBuildLibrary Note this package includes three build systems each with different targets: * SCons is used for development, there is minimal auto-configuration, one SConstruct script per target compiler and platform. * Autoconf is used for Unix-only library release. * CMake is used for Windows-only library release and installer packaging. libpgm-5.1.118-1~dfsg/openpgm/pgm/rand.c.c89.patch0000644000175000017500000000145011640407354020333 0ustar locallocal--- rand.c 2011-03-12 10:20:31.000000000 +0800 +++ rand.c89.c 2011-03-12 10:50:48.000000000 +0800 @@ -31,7 +31,7 @@ /* locals */ -static pgm_rand_t global_rand = { .seed = 0 }; +static pgm_rand_t global_rand = { 0 }; static volatile uint32_t rand_ref_count = 0; static pgm_mutex_t rand_mutex; @@ -83,8 +83,10 @@ return; } #endif /* !_WIN32 */ + { const pgm_time_t now = pgm_time_update_now(); new_rand->seed = (uint32_t)pgm_to_msecs (now); + } } /* derived from POSIX.1-2001 example implementation of rand() @@ -124,9 +126,11 @@ pgm_mutex_lock (&rand_mutex); if (PGM_UNLIKELY(!global_rand.seed)) pgm_rand_create (&global_rand); + { const uint32_t rand_value = pgm_rand_int (&global_rand); pgm_mutex_unlock (&rand_mutex); return rand_value; + } } PGM_GNUC_INTERNAL libpgm-5.1.118-1~dfsg/openpgm/pgm/mem.c0000644000175000017500000001272611640407354016475 0ustar locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab * * portable fail fast memory allocation. * * Copyright (c) 2010-2011 Miru Limited. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #ifdef _WIN32 # define strcasecmp stricmp #endif #include #include //#define MEM_DEBUG /* globals */ bool pgm_mem_gc_friendly PGM_GNUC_READ_MOSTLY = FALSE; /* locals */ struct pgm_debug_key_t { const char* key; unsigned value; }; typedef struct pgm_debug_key_t pgm_debug_key_t; static volatile uint32_t mem_ref_count = 0; static bool debug_key_matches ( const char* restrict key, const char* restrict token, unsigned length ) { for (; length; length--, key++, token++) { const char k = (*key == '_') ? '-' : tolower (*key ); const char t = (*token == '_') ? '-' : tolower (*token); if (k != t) return FALSE; } return *key == '\0'; } static unsigned pgm_parse_debug_string ( const char* restrict string, const pgm_debug_key_t* restrict keys, const unsigned nkeys ) { unsigned result = 0; if (NULL == string) return result; if (!strcasecmp (string, "all")) { for (unsigned i = 0; i < nkeys; i++) result |= keys[i].value; } else if (!strcasecmp (string, "help")) { fprintf (stderr, "Supported debug values:"); for (unsigned i = 0; i < nkeys; i++) fprintf (stderr, " %s", keys[i].key); fprintf (stderr, "\n"); } else { while (string) { const char* q = strpbrk (string, ":;, \t"); if (!q) q = string + strlen (string); for (unsigned i = 0; i < nkeys; i++) if (debug_key_matches (keys[i].key, string, (unsigned)(q - string))) result |= keys[i].value; string = q; if (*string) string++; } } return result; } PGM_GNUC_INTERNAL void pgm_mem_init (void) { static const pgm_debug_key_t keys[] = { { "gc-friendly", 1 }, }; char* env; size_t envlen; unsigned flags = 0; if (pgm_atomic_exchange_and_add32 (&mem_ref_count, 1) > 0) return; const errno_t err = pgm_dupenv_s (&env, &envlen, "PGM_DEBUG"); if (0 == err && envlen > 0) { flags = pgm_parse_debug_string (env, keys, PGM_N_ELEMENTS (keys)); pgm_free (env); } if (flags & 1) pgm_mem_gc_friendly = TRUE; } PGM_GNUC_INTERNAL void pgm_mem_shutdown (void) { pgm_return_if_fail (pgm_atomic_read32 (&mem_ref_count) > 0); if (pgm_atomic_exchange_and_add32 (&mem_ref_count, (uint32_t)-1) != 1) return; /* nop */ } /* malloc wrappers to hard fail */ void* pgm_malloc ( const size_t n_bytes ) { if (PGM_LIKELY (n_bytes)) { void* mem = malloc (n_bytes); if (mem) return mem; #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, n_bytes); #else pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, n_bytes); #endif abort (); } return NULL; } #define SIZE_OVERFLOWS(a,b) (PGM_UNLIKELY ((a) > SIZE_MAX / (b))) void* pgm_malloc_n ( const size_t n_blocks, const size_t block_bytes ) { if (SIZE_OVERFLOWS (n_blocks, block_bytes)) { #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): overflow allocating %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, n_blocks, block_bytes); #else pgm_fatal ("file %s: line %d: overflow allocating %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, n_blocks, block_bytes); #endif } return pgm_malloc (n_blocks * block_bytes); } void* pgm_malloc0 ( const size_t n_bytes ) { if (PGM_LIKELY (n_bytes)) { void* mem = calloc (1, n_bytes); if (mem) return mem; #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, n_bytes); #else pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes", __FILE__, __LINE__, n_bytes); #endif abort (); } return NULL; } void* pgm_malloc0_n ( const size_t n_blocks, const size_t block_bytes ) { if (PGM_LIKELY (n_blocks && block_bytes)) { void* mem = calloc (n_blocks, block_bytes); if (mem) return mem; #ifdef __GNUC__ pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, __PRETTY_FUNCTION__, n_blocks, block_bytes); #else pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu "*%" PRIzu " bytes", __FILE__, __LINE__, n_blocks, block_bytes); #endif abort (); } return NULL; } void* pgm_memdup ( const void* mem, const size_t n_bytes ) { void* new_mem; if (PGM_LIKELY (NULL != mem)) { new_mem = pgm_malloc (n_bytes); memcpy (new_mem, mem, n_bytes); } else new_mem = NULL; return new_mem; } void* pgm_realloc ( void* mem, const size_t n_bytes ) { return realloc (mem, n_bytes); } void pgm_free ( void* mem ) { if (PGM_LIKELY (NULL != mem)) free (mem); } /* eof */ libpgm-5.1.118-1~dfsg/openpgm/pgm/net.c.c89.patch0000644000175000017500000000517711640407354020207 0ustar locallocal--- net.c 2011-03-12 10:16:17.000000000 +0800 +++ net.c89.c 2011-03-12 10:46:51.000000000 +0800 @@ -64,6 +64,7 @@ pgm_assert( tolen > 0 ); #ifdef NET_DEBUG + { char saddr[INET_ADDRSTRLEN]; pgm_sockaddr_ntop (to, saddr, sizeof(saddr)); pgm_debug ("pgm_sendto (sock:%p use_rate_limit:%s minor_rate_control:%p use_router_alert:%s buf:%p len:%" PRIzu " to:%s [toport:%d] tolen:%d)", @@ -72,12 +73,14 @@ (const void*)minor_rate_control, use_router_alert ? "TRUE" : "FALSE", (const void*)buf, - len, + (unsigned long)len, saddr, ntohs (((const struct sockaddr_in*)to)->sin_port), (int)tolen); + } #endif + { const SOCKET send_sock = use_router_alert ? sock->send_with_router_alert_sock : sock->send_sock; if (use_rate_limit) @@ -105,9 +108,11 @@ if (-1 != hops) pgm_sockaddr_multicast_hops (send_sock, sock->send_gsr.gsr_group.ss_family, hops); - ssize_t sent = sendto (send_sock, buf, len, 0, to, (socklen_t)tolen); - pgm_debug ("sendto returned %" PRIzd, sent); - if (sent < 0) { + { + ssize_t sent = sendto (send_sock, buf, (int)len, 0, to, (socklen_t)tolen); + pgm_debug ("sendto returned %" PRIzd, (long)sent); + if (sent < 0) + { int save_errno = pgm_get_last_sock_error(); if (PGM_UNLIKELY(save_errno != PGM_SOCK_ENETUNREACH && /* Network is unreachable */ save_errno != PGM_SOCK_EHOSTUNREACH && /* No route to host */ @@ -123,23 +128,24 @@ const int ready = poll (&p, 1, 500 /* ms */); #else fd_set writefds; + struct timeval tv; + int ready, n_fds; + FD_ZERO(&writefds); FD_SET(send_sock, &writefds); # ifndef _WIN32 - const int n_fds = send_sock + 1; /* largest fd + 1 */ + n_fds = send_sock + 1; /* largest fd + 1 */ # else - const int n_fds = 1; /* count of fds */ + n_fds = 1; /* count of fds */ # endif - struct timeval tv = { - .tv_sec = 0, - .tv_usec = 500 /* ms */ * 1000 - }; - const int ready = select (n_fds, NULL, &writefds, NULL, &tv); + tv.tv_sec = 0; + tv.tv_usec = 500 /* ms */ * 1000; + ready = select (n_fds, NULL, &writefds, NULL, &tv); #endif /* CONFIG_HAVE_POLL */ if (ready > 0) { - sent = sendto (send_sock, buf, len, 0, to, (socklen_t)tolen); - if ( sent < 0 ) + sent = sendto (send_sock, buf, (int)len, 0, to, (socklen_t)tolen); + if (sent < 0) { char errbuf[1024]; char toaddr[INET6_ADDRSTRLEN]; @@ -171,7 +177,9 @@ pgm_sockaddr_multicast_hops (send_sock, sock->send_gsr.gsr_group.ss_family, sock->hops); if (!use_router_alert && sock->can_send_data) pgm_mutex_unlock (&sock->send_mutex); - return sent; + return (ssize_t)sent; + } + } } /* socket helper, for setting pipe ends non-blocking libpgm-5.1.118-1~dfsg/openpgm/pgm/histogram.c.c89.patch0000644000175000017500000001176211640407354021413 0ustar locallocal--- histogram.c 2010-12-06 11:59:59.000000000 +0800 +++ histogram.c89.c 2010-12-06 11:59:13.000000000 +0800 @@ -61,10 +61,12 @@ value = INT_MAX - 1; if (value < 0) value = 0; + { const unsigned i = bucket_index (histogram, value); pgm_assert_cmpint (value, >=, histogram->ranges[ i ]); pgm_assert_cmpint (value, <, histogram->ranges[ i + 1 ]); accumulate (histogram, value, 1, i); + } } void @@ -74,19 +76,21 @@ { if (!pgm_histograms) return; + { pgm_slist_t* snapshot = pgm_histograms; while (snapshot) { pgm_histogram_t* histogram = snapshot->data; pgm_histogram_write_html_graph (histogram, string); snapshot = snapshot->next; } + } } static void pgm_histogram_write_html_graph ( pgm_histogram_t* restrict histogram, - pgm_string_t* restrict string + pgm_string_t* restrict string ) { pgm_string_append (string, "
");
@@ -119,8 +123,11 @@
 	)
 {
 	pgm_count_t total = 0;
-	for (unsigned i = 0; i < sample_set->counts_len; i++)
+	{
+	unsigned i;
+	for (i = 0; i < sample_set->counts_len; i++)
 		total += sample_set->counts[ i ];
+	}
 	return total;
 }
 
@@ -173,7 +180,8 @@
 		const double log_current = log ((double)current);
 		log_ratio = (log_max - log_current) / (histogram->bucket_count - i);
 		log_next = log_current + log_ratio;
-#ifdef __GNUC__	
+		{
+#ifdef __GNUC__ 
 		const int next = floor (exp (log_next) + 0.5);
 #else
 /* bad-function-cast warning in GCC */
@@ -184,6 +192,7 @@
 		else
 			current++;
 		set_bucket_range (histogram, i, current);
+		}
 	}
 	pgm_assert_cmpuint (histogram->bucket_count, ==, i);
 }
@@ -197,6 +206,7 @@
 {
 	pgm_assert_cmpint (histogram->ranges[0], <=, value);
 	pgm_assert_cmpint (histogram->ranges[ histogram->bucket_count ], >, value);
+	{
 	unsigned under = 0;
 	unsigned over = histogram->bucket_count;
 	unsigned mid;
@@ -213,6 +223,7 @@
 	} while (TRUE);
 	pgm_assert (histogram->ranges[ mid ] <= value && histogram->ranges[ mid + 1] > value);
 	return mid;
+	}
 }
 
 static
@@ -235,19 +246,21 @@
 	pgm_string_t*	 restrict output
 	)
 {
-	pgm_count_t snapshot_counts[ histogram->sample.counts_len ];
-	pgm_sample_set_t snapshot = {
-		.counts		= snapshot_counts,
-		.counts_len	= histogram->sample.counts_len,
-		.sum		= histogram->sample.sum,
-		.square_sum	= histogram->sample.square_sum
-	};
+	pgm_count_t* snapshot_counts = pgm_newa (pgm_count_t, histogram->sample.counts_len);
+	pgm_sample_set_t snapshot;
+	snapshot.counts		= snapshot_counts;
+	snapshot.counts_len	= histogram->sample.counts_len;
+	snapshot.sum		= histogram->sample.sum;
+	snapshot.square_sum	= histogram->sample.square_sum;
+
 	memcpy (snapshot_counts, histogram->sample.counts, sizeof(pgm_count_t) * histogram->sample.counts_len);
 
+	{
 	pgm_count_t sample_count = sample_set_total_count (&snapshot);
 	write_ascii_header (histogram, &snapshot, sample_count, output);
 	pgm_string_append (output, newline);
 
+	{
 	double max_size = get_peak_bucket_size (histogram, &snapshot);
 	unsigned largest_non_empty_bucket = histogram->bucket_count - 1;
 	while (0 == snapshot.counts[ largest_non_empty_bucket ])
@@ -257,8 +270,11 @@
 		largest_non_empty_bucket--;
 	}
 
+	{
 	int print_width = 1;
-	for (unsigned i = 0; i < histogram->bucket_count; ++i)
+	{
+	unsigned i;
+	for (i = 0; i < histogram->bucket_count; ++i)
 	{
 		if (snapshot.counts[ i ]) {
 			pgm_string_t* bucket_range = get_ascii_bucket_range (histogram, i);
@@ -268,16 +284,22 @@
 				print_width = width;
 		}
 	}
+	}
 
+	{
 	int64_t remaining = sample_count;
 	int64_t past = 0;
-	for (unsigned i = 0; i < histogram->bucket_count; ++i)
+	{
+	unsigned i;
+	for (i = 0; i < histogram->bucket_count; ++i)
 	{
 		pgm_count_t current = snapshot.counts[ i ];
 		remaining -= current;
+		{
 		pgm_string_t* bucket_range = get_ascii_bucket_range (histogram, i);
 		pgm_string_append_printf (output, "%*s ", print_width, bucket_range->str);
 		pgm_string_free (bucket_range, TRUE);
+		}
 		if (0 == current &&
 		    i < histogram->bucket_count - 1 &&
 		    0 == snapshot.counts[ i + 1 ])
@@ -292,12 +314,19 @@
 			continue;
 		}
 
+		{
 		const double current_size = get_bucket_size (histogram, current, i);
 		write_ascii_bucket_graph (current_size, max_size, output);
+		}
 		write_ascii_bucket_context (past, current, remaining, i, output);
 		pgm_string_append (output, newline);
 		past += current;
 	}
+	}
+	}
+	}
+	}
+	}
 }
 
 static
@@ -379,11 +408,14 @@
 	)
 {
 	double max_size = 0;
-	for (unsigned i = 0; i < histogram->bucket_count; i++) {
+	{
+	unsigned i;
+	for (i = 0; i < histogram->bucket_count; i++) {
 		const double current_size = get_bucket_size (histogram, sample_set->counts[ i ], i);
 		if (current_size > max_size)
 			max_size = current_size;
 	}
+	}
 	return max_size;
 }
 
@@ -396,11 +428,13 @@
 	)
 {
 	pgm_assert_cmpint (histogram->ranges[ i + 1 ], >, histogram->ranges[ i ]);
+	{
 	static const double kTransitionWidth = 5;
 	double denominator = histogram->ranges[ i + 1 ] - histogram->ranges[ i ];
 	if (denominator > kTransitionWidth)
 		denominator = kTransitionWidth;
 	return current / denominator;
+	}
 }
 
 static
libpgm-5.1.118-1~dfsg/openpgm/pgm/engine.c.c89.patch0000644000175000017500000000253511640407354020661 0ustar  locallocal--- engine.c	2011-03-29 20:32:26.000000000 +0800
+++ engine.c89.c	2011-03-29 20:32:32.000000000 +0800
@@ -90,6 +90,7 @@
 	pgm_rand_init();
 
 #ifdef _WIN32
+	{
 	WORD wVersionRequested = MAKEWORD (2, 2);
 	WSADATA wsaData;
 	if (WSAStartup (wVersionRequested, &wsaData) != 0)
@@ -147,9 +148,11 @@
 		closesocket (sock);
 	}
 #	endif
+	}
 #endif /* _WIN32 */
 
 /* find PGM protocol id overriding default value, use first value from NIS */
+	{
 	const struct pgm_protoent_t *proto = pgm_getprotobyname ("pgm");
 	if (proto != NULL) {
 		if (proto->p_proto != pgm_ipproto_pgm) {
@@ -158,8 +161,10 @@
 			pgm_ipproto_pgm = proto->p_proto;
 		}
 	}
+	}
 
 /* ensure timing enabled */
+	{
 	pgm_error_t* sub_error = NULL;
 	if (!pgm_time_init (&sub_error)) {
 		if (sub_error)
@@ -169,9 +174,11 @@
 #endif
 		goto err_shutdown;
 	}
+	}
 
 /* receiver simulated loss rate */
 #ifdef PGM_DEBUG
+	{
 	char* env;
 	size_t envlen;
 
@@ -184,6 +191,7 @@
 		}
 		pgm_free (env);
 	}
+	}
 #endif
 
 /* create global sock list lock */
@@ -216,9 +224,7 @@
 bool
 pgm_shutdown (void)
 {
-/* cannot use pgm_return_val_if_fail() as logging may not be started */
-	if (0 == pgm_atomic_read32 (&pgm_ref_count))
-		return FALSE;
+	pgm_return_val_if_fail (pgm_atomic_read32 (&pgm_ref_count) > 0, FALSE);
 
 	if (pgm_atomic_exchange_and_add32 (&pgm_ref_count, (uint32_t)-1) != 1)
 		return TRUE;
libpgm-5.1.118-1~dfsg/openpgm/pgm/Makefile.in0000644000175000017500000024272311644640133017620 0ustar  locallocal# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

# -*- Makefile -*-



VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(libinclude_HEADERS) \
	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
	$(srcdir)/openpgm-${RELEASE_INFO}.pc.in \
	$(srcdir)/openpgm.spec.in $(top_srcdir)/configure COPYING \
	INSTALL config.guess config.sub depcomp install-sh ltmain.sh \
	missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES = openpgm-${RELEASE_INFO}.pc openpgm.spec
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
  for p in $$list; do echo "$$p $$p"; done | \
  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
    if (++n[$$2] == $(am__install_max)) \
      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
    END { for (dir in files) print dir, files[dir] }'
am__base_list = \
  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
	"$(DESTDIR)$(libincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
libpgm_la_DEPENDENCIES = libpgm_noinst.la
am_libpgm_la_OBJECTS =
libpgm_la_OBJECTS = $(am_libpgm_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
libpgm_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libpgm_la_CFLAGS) \
	$(CFLAGS) $(libpgm_la_LDFLAGS) $(LDFLAGS) -o $@
libpgm_noinst_la_LIBADD =
am_libpgm_noinst_la_OBJECTS = libpgm_noinst_la-thread.lo \
	libpgm_noinst_la-mem.lo libpgm_noinst_la-string.lo \
	libpgm_noinst_la-list.lo libpgm_noinst_la-slist.lo \
	libpgm_noinst_la-queue.lo libpgm_noinst_la-hashtable.lo \
	libpgm_noinst_la-messages.lo libpgm_noinst_la-error.lo \
	libpgm_noinst_la-math.lo libpgm_noinst_la-packet_parse.lo \
	libpgm_noinst_la-packet_test.lo libpgm_noinst_la-sockaddr.lo \
	libpgm_noinst_la-time.lo libpgm_noinst_la-if.lo \
	libpgm_noinst_la-getifaddrs.lo libpgm_noinst_la-get_nprocs.lo \
	libpgm_noinst_la-getnetbyname.lo \
	libpgm_noinst_la-getnodeaddr.lo \
	libpgm_noinst_la-getprotobyname.lo \
	libpgm_noinst_la-indextoaddr.lo \
	libpgm_noinst_la-indextoname.lo \
	libpgm_noinst_la-nametoindex.lo \
	libpgm_noinst_la-inet_network.lo libpgm_noinst_la-md5.lo \
	libpgm_noinst_la-rand.lo libpgm_noinst_la-gsi.lo \
	libpgm_noinst_la-tsi.lo libpgm_noinst_la-txw.lo \
	libpgm_noinst_la-rxw.lo libpgm_noinst_la-skbuff.lo \
	libpgm_noinst_la-socket.lo libpgm_noinst_la-source.lo \
	libpgm_noinst_la-receiver.lo libpgm_noinst_la-recv.lo \
	libpgm_noinst_la-engine.lo libpgm_noinst_la-timer.lo \
	libpgm_noinst_la-net.lo libpgm_noinst_la-rate_control.lo \
	libpgm_noinst_la-checksum.lo libpgm_noinst_la-reed_solomon.lo \
	libpgm_noinst_la-galois_tables.lo \
	libpgm_noinst_la-wsastrerror.lo libpgm_noinst_la-histogram.lo \
	libpgm_noinst_la-version.lo
libpgm_noinst_la_OBJECTS = $(am_libpgm_noinst_la_OBJECTS)
libpgm_noinst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
	$(libpgm_noinst_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
	-o $@
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
	$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo "  CC    " $@;
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo "  CCLD  " $@;
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo "  GEN   " $@;
SOURCES = $(libpgm_la_SOURCES) $(libpgm_noinst_la_SOURCES)
DIST_SOURCES = $(libpgm_la_SOURCES) $(libpgm_noinst_la_SOURCES)
DATA = $(pkgconfig_DATA)
HEADERS = $(libinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
  { test ! -d "$(distdir)" \
    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
         && rm -fr "$(distdir)"; }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PYTHON = @PYTHON@
RANLIB = @RANLIB@
RELEASE_INFO = @RELEASE_INFO@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MICRO = @VERSION_MICRO@
VERSION_MINOR = @VERSION_MINOR@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
noinst_LTLIBRARIES = libpgm_noinst.la
EXTRA_DIST = galois_generator.pl version_generator.py
libpgm_noinst_la_SOURCES = \
	thread.c \
	mem.c \
	string.c \
	list.c \
	slist.c \
	queue.c \
	hashtable.c \
	messages.c \
	error.c \
	math.c \
	packet_parse.c \
	packet_test.c \
	sockaddr.c \
	time.c \
	if.c \
	getifaddrs.c \
	get_nprocs.c \
	getnetbyname.c \
	getnodeaddr.c \
	getprotobyname.c \
	indextoaddr.c \
	indextoname.c \
	nametoindex.c \
	inet_network.c \
	md5.c \
	rand.c \
	gsi.c \
	tsi.c \
	txw.c \
	rxw.c \
	skbuff.c \
	socket.c \
	source.c \
	receiver.c \
	recv.c \
	engine.c \
	timer.c \
	net.c \
	rate_control.c \
	checksum.c \
	reed_solomon.c \
	galois_tables.c \
	wsastrerror.c \
	histogram.c \
	version.c

libincludedir = $(includedir)/pgm-@RELEASE_INFO@/pgm
libinclude_HEADERS = \
	include/pgm/atomic.h \
	include/pgm/engine.h \
	include/pgm/error.h \
	include/pgm/gsi.h \
	include/pgm/if.h \
	include/pgm/in.h \
	include/pgm/list.h \
	include/pgm/macros.h \
	include/pgm/mem.h \
	include/pgm/messages.h \
	include/pgm/msgv.h \
	include/pgm/packet.h \
	include/pgm/pgm.h \
	include/pgm/skbuff.h \
	include/pgm/socket.h \
	include/pgm/time.h \
	include/pgm/tsi.h \
	include/pgm/types.h \
	include/pgm/version.h \
	include/pgm/winint.h \
	include/pgm/wininttypes.h \
	include/pgm/zinttypes.h

libpgm_noinst_la_CFLAGS = \
	-I$(top_srcdir)/include \
	-DCONFIG_16BIT_CHECKSUM \
	-DCONFIG_GALOIS_MUL_LUT \
	-DGETTEXT_PACKAGE='"pgm"'

lib_LTLIBRARIES = libpgm.la
libpgm_la_SOURCES = 
libpgm_la_CFLAGS = $(libpgm_noinst_la_CFLAGS)
libpgm_la_LDFLAGS = -release @RELEASE_INFO@ -version-info @VERSION_INFO@
libpgm_la_LIBADD = libpgm_noinst.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = openpgm-@RELEASE_INFO@.pc
all: all-am

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh:
	@:
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
		&& exit 0; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
	$(am__cd) $(top_srcdir) && \
	  $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    echo ' $(SHELL) ./config.status'; \
	    $(SHELL) ./config.status;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	$(SHELL) ./config.status --recheck

$(top_srcdir)/configure:  $(am__configure_deps)
	$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
openpgm-${RELEASE_INFO}.pc: $(top_builddir)/config.status $(srcdir)/openpgm-${RELEASE_INFO}.pc.in
	cd $(top_builddir) && $(SHELL) ./config.status $@
openpgm.spec: $(top_builddir)/config.status $(srcdir)/openpgm.spec.in
	cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
	@$(NORMAL_INSTALL)
	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
	list2=; for p in $$list; do \
	  if test -f $$p; then \
	    list2="$$list2 $$p"; \
	  else :; fi; \
	done; \
	test -z "$$list2" || { \
	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
	}

uninstall-libLTLIBRARIES:
	@$(NORMAL_UNINSTALL)
	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
	done

clean-libLTLIBRARIES:
	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
	  test "$$dir" != "$$p" || dir=.; \
	  echo "rm -f \"$${dir}/so_locations\""; \
	  rm -f "$${dir}/so_locations"; \
	done

clean-noinstLTLIBRARIES:
	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
	  test "$$dir" != "$$p" || dir=.; \
	  echo "rm -f \"$${dir}/so_locations\""; \
	  rm -f "$${dir}/so_locations"; \
	done
libpgm.la: $(libpgm_la_OBJECTS) $(libpgm_la_DEPENDENCIES) 
	$(AM_V_CCLD)$(libpgm_la_LINK) -rpath $(libdir) $(libpgm_la_OBJECTS) $(libpgm_la_LIBADD) $(LIBS)
libpgm_noinst.la: $(libpgm_noinst_la_OBJECTS) $(libpgm_noinst_la_DEPENDENCIES) 
	$(AM_V_CCLD)$(libpgm_noinst_la_LINK)  $(libpgm_noinst_la_OBJECTS) $(libpgm_noinst_la_LIBADD) $(LIBS)

mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-checksum.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-engine.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-error.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-galois_tables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-get_nprocs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-getifaddrs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-getnetbyname.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-getnodeaddr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-getprotobyname.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-gsi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-hashtable.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-histogram.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-if.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-indextoaddr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-indextoname.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-inet_network.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-list.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-math.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-md5.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-mem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-messages.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-nametoindex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-net.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-packet_parse.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-packet_test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-queue.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-rand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-rate_control.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-receiver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-recv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-reed_solomon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-rxw.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-skbuff.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-slist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-sockaddr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-socket.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-source.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-string.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-thread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-timer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-tsi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-txw.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-version.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpgm_noinst_la-wsastrerror.Plo@am__quote@

.c.o:
@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c $<

.c.obj:
@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`

.c.lo:
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<

libpgm_noinst_la-thread.lo: thread.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-thread.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-thread.Tpo -c -o libpgm_noinst_la-thread.lo `test -f 'thread.c' || echo '$(srcdir)/'`thread.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-thread.Tpo $(DEPDIR)/libpgm_noinst_la-thread.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='thread.c' object='libpgm_noinst_la-thread.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-thread.lo `test -f 'thread.c' || echo '$(srcdir)/'`thread.c

libpgm_noinst_la-mem.lo: mem.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-mem.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-mem.Tpo -c -o libpgm_noinst_la-mem.lo `test -f 'mem.c' || echo '$(srcdir)/'`mem.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-mem.Tpo $(DEPDIR)/libpgm_noinst_la-mem.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mem.c' object='libpgm_noinst_la-mem.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-mem.lo `test -f 'mem.c' || echo '$(srcdir)/'`mem.c

libpgm_noinst_la-string.lo: string.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-string.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-string.Tpo -c -o libpgm_noinst_la-string.lo `test -f 'string.c' || echo '$(srcdir)/'`string.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-string.Tpo $(DEPDIR)/libpgm_noinst_la-string.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='string.c' object='libpgm_noinst_la-string.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-string.lo `test -f 'string.c' || echo '$(srcdir)/'`string.c

libpgm_noinst_la-list.lo: list.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-list.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-list.Tpo -c -o libpgm_noinst_la-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-list.Tpo $(DEPDIR)/libpgm_noinst_la-list.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='list.c' object='libpgm_noinst_la-list.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c

libpgm_noinst_la-slist.lo: slist.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-slist.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-slist.Tpo -c -o libpgm_noinst_la-slist.lo `test -f 'slist.c' || echo '$(srcdir)/'`slist.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-slist.Tpo $(DEPDIR)/libpgm_noinst_la-slist.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='slist.c' object='libpgm_noinst_la-slist.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-slist.lo `test -f 'slist.c' || echo '$(srcdir)/'`slist.c

libpgm_noinst_la-queue.lo: queue.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-queue.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-queue.Tpo -c -o libpgm_noinst_la-queue.lo `test -f 'queue.c' || echo '$(srcdir)/'`queue.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-queue.Tpo $(DEPDIR)/libpgm_noinst_la-queue.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='queue.c' object='libpgm_noinst_la-queue.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-queue.lo `test -f 'queue.c' || echo '$(srcdir)/'`queue.c

libpgm_noinst_la-hashtable.lo: hashtable.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-hashtable.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-hashtable.Tpo -c -o libpgm_noinst_la-hashtable.lo `test -f 'hashtable.c' || echo '$(srcdir)/'`hashtable.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-hashtable.Tpo $(DEPDIR)/libpgm_noinst_la-hashtable.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='hashtable.c' object='libpgm_noinst_la-hashtable.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-hashtable.lo `test -f 'hashtable.c' || echo '$(srcdir)/'`hashtable.c

libpgm_noinst_la-messages.lo: messages.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-messages.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-messages.Tpo -c -o libpgm_noinst_la-messages.lo `test -f 'messages.c' || echo '$(srcdir)/'`messages.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-messages.Tpo $(DEPDIR)/libpgm_noinst_la-messages.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='messages.c' object='libpgm_noinst_la-messages.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-messages.lo `test -f 'messages.c' || echo '$(srcdir)/'`messages.c

libpgm_noinst_la-error.lo: error.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-error.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-error.Tpo -c -o libpgm_noinst_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-error.Tpo $(DEPDIR)/libpgm_noinst_la-error.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='error.c' object='libpgm_noinst_la-error.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c

libpgm_noinst_la-math.lo: math.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-math.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-math.Tpo -c -o libpgm_noinst_la-math.lo `test -f 'math.c' || echo '$(srcdir)/'`math.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-math.Tpo $(DEPDIR)/libpgm_noinst_la-math.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='math.c' object='libpgm_noinst_la-math.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-math.lo `test -f 'math.c' || echo '$(srcdir)/'`math.c

libpgm_noinst_la-packet_parse.lo: packet_parse.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-packet_parse.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-packet_parse.Tpo -c -o libpgm_noinst_la-packet_parse.lo `test -f 'packet_parse.c' || echo '$(srcdir)/'`packet_parse.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-packet_parse.Tpo $(DEPDIR)/libpgm_noinst_la-packet_parse.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='packet_parse.c' object='libpgm_noinst_la-packet_parse.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-packet_parse.lo `test -f 'packet_parse.c' || echo '$(srcdir)/'`packet_parse.c

libpgm_noinst_la-packet_test.lo: packet_test.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-packet_test.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-packet_test.Tpo -c -o libpgm_noinst_la-packet_test.lo `test -f 'packet_test.c' || echo '$(srcdir)/'`packet_test.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-packet_test.Tpo $(DEPDIR)/libpgm_noinst_la-packet_test.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='packet_test.c' object='libpgm_noinst_la-packet_test.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-packet_test.lo `test -f 'packet_test.c' || echo '$(srcdir)/'`packet_test.c

libpgm_noinst_la-sockaddr.lo: sockaddr.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-sockaddr.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-sockaddr.Tpo -c -o libpgm_noinst_la-sockaddr.lo `test -f 'sockaddr.c' || echo '$(srcdir)/'`sockaddr.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-sockaddr.Tpo $(DEPDIR)/libpgm_noinst_la-sockaddr.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sockaddr.c' object='libpgm_noinst_la-sockaddr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-sockaddr.lo `test -f 'sockaddr.c' || echo '$(srcdir)/'`sockaddr.c

libpgm_noinst_la-time.lo: time.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-time.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-time.Tpo -c -o libpgm_noinst_la-time.lo `test -f 'time.c' || echo '$(srcdir)/'`time.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-time.Tpo $(DEPDIR)/libpgm_noinst_la-time.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='time.c' object='libpgm_noinst_la-time.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-time.lo `test -f 'time.c' || echo '$(srcdir)/'`time.c

libpgm_noinst_la-if.lo: if.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-if.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-if.Tpo -c -o libpgm_noinst_la-if.lo `test -f 'if.c' || echo '$(srcdir)/'`if.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-if.Tpo $(DEPDIR)/libpgm_noinst_la-if.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='if.c' object='libpgm_noinst_la-if.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-if.lo `test -f 'if.c' || echo '$(srcdir)/'`if.c

libpgm_noinst_la-getifaddrs.lo: getifaddrs.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-getifaddrs.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-getifaddrs.Tpo -c -o libpgm_noinst_la-getifaddrs.lo `test -f 'getifaddrs.c' || echo '$(srcdir)/'`getifaddrs.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-getifaddrs.Tpo $(DEPDIR)/libpgm_noinst_la-getifaddrs.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='getifaddrs.c' object='libpgm_noinst_la-getifaddrs.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-getifaddrs.lo `test -f 'getifaddrs.c' || echo '$(srcdir)/'`getifaddrs.c

libpgm_noinst_la-get_nprocs.lo: get_nprocs.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-get_nprocs.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-get_nprocs.Tpo -c -o libpgm_noinst_la-get_nprocs.lo `test -f 'get_nprocs.c' || echo '$(srcdir)/'`get_nprocs.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-get_nprocs.Tpo $(DEPDIR)/libpgm_noinst_la-get_nprocs.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='get_nprocs.c' object='libpgm_noinst_la-get_nprocs.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-get_nprocs.lo `test -f 'get_nprocs.c' || echo '$(srcdir)/'`get_nprocs.c

libpgm_noinst_la-getnetbyname.lo: getnetbyname.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-getnetbyname.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-getnetbyname.Tpo -c -o libpgm_noinst_la-getnetbyname.lo `test -f 'getnetbyname.c' || echo '$(srcdir)/'`getnetbyname.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-getnetbyname.Tpo $(DEPDIR)/libpgm_noinst_la-getnetbyname.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='getnetbyname.c' object='libpgm_noinst_la-getnetbyname.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-getnetbyname.lo `test -f 'getnetbyname.c' || echo '$(srcdir)/'`getnetbyname.c

libpgm_noinst_la-getnodeaddr.lo: getnodeaddr.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-getnodeaddr.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-getnodeaddr.Tpo -c -o libpgm_noinst_la-getnodeaddr.lo `test -f 'getnodeaddr.c' || echo '$(srcdir)/'`getnodeaddr.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-getnodeaddr.Tpo $(DEPDIR)/libpgm_noinst_la-getnodeaddr.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='getnodeaddr.c' object='libpgm_noinst_la-getnodeaddr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-getnodeaddr.lo `test -f 'getnodeaddr.c' || echo '$(srcdir)/'`getnodeaddr.c

libpgm_noinst_la-getprotobyname.lo: getprotobyname.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-getprotobyname.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-getprotobyname.Tpo -c -o libpgm_noinst_la-getprotobyname.lo `test -f 'getprotobyname.c' || echo '$(srcdir)/'`getprotobyname.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-getprotobyname.Tpo $(DEPDIR)/libpgm_noinst_la-getprotobyname.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='getprotobyname.c' object='libpgm_noinst_la-getprotobyname.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-getprotobyname.lo `test -f 'getprotobyname.c' || echo '$(srcdir)/'`getprotobyname.c

libpgm_noinst_la-indextoaddr.lo: indextoaddr.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-indextoaddr.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-indextoaddr.Tpo -c -o libpgm_noinst_la-indextoaddr.lo `test -f 'indextoaddr.c' || echo '$(srcdir)/'`indextoaddr.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-indextoaddr.Tpo $(DEPDIR)/libpgm_noinst_la-indextoaddr.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='indextoaddr.c' object='libpgm_noinst_la-indextoaddr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-indextoaddr.lo `test -f 'indextoaddr.c' || echo '$(srcdir)/'`indextoaddr.c

libpgm_noinst_la-indextoname.lo: indextoname.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-indextoname.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-indextoname.Tpo -c -o libpgm_noinst_la-indextoname.lo `test -f 'indextoname.c' || echo '$(srcdir)/'`indextoname.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-indextoname.Tpo $(DEPDIR)/libpgm_noinst_la-indextoname.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='indextoname.c' object='libpgm_noinst_la-indextoname.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-indextoname.lo `test -f 'indextoname.c' || echo '$(srcdir)/'`indextoname.c

libpgm_noinst_la-nametoindex.lo: nametoindex.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-nametoindex.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-nametoindex.Tpo -c -o libpgm_noinst_la-nametoindex.lo `test -f 'nametoindex.c' || echo '$(srcdir)/'`nametoindex.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-nametoindex.Tpo $(DEPDIR)/libpgm_noinst_la-nametoindex.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nametoindex.c' object='libpgm_noinst_la-nametoindex.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-nametoindex.lo `test -f 'nametoindex.c' || echo '$(srcdir)/'`nametoindex.c

libpgm_noinst_la-inet_network.lo: inet_network.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-inet_network.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-inet_network.Tpo -c -o libpgm_noinst_la-inet_network.lo `test -f 'inet_network.c' || echo '$(srcdir)/'`inet_network.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-inet_network.Tpo $(DEPDIR)/libpgm_noinst_la-inet_network.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='inet_network.c' object='libpgm_noinst_la-inet_network.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-inet_network.lo `test -f 'inet_network.c' || echo '$(srcdir)/'`inet_network.c

libpgm_noinst_la-md5.lo: md5.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-md5.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-md5.Tpo -c -o libpgm_noinst_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-md5.Tpo $(DEPDIR)/libpgm_noinst_la-md5.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='md5.c' object='libpgm_noinst_la-md5.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c

libpgm_noinst_la-rand.lo: rand.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-rand.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-rand.Tpo -c -o libpgm_noinst_la-rand.lo `test -f 'rand.c' || echo '$(srcdir)/'`rand.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-rand.Tpo $(DEPDIR)/libpgm_noinst_la-rand.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='rand.c' object='libpgm_noinst_la-rand.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-rand.lo `test -f 'rand.c' || echo '$(srcdir)/'`rand.c

libpgm_noinst_la-gsi.lo: gsi.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-gsi.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-gsi.Tpo -c -o libpgm_noinst_la-gsi.lo `test -f 'gsi.c' || echo '$(srcdir)/'`gsi.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-gsi.Tpo $(DEPDIR)/libpgm_noinst_la-gsi.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gsi.c' object='libpgm_noinst_la-gsi.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-gsi.lo `test -f 'gsi.c' || echo '$(srcdir)/'`gsi.c

libpgm_noinst_la-tsi.lo: tsi.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-tsi.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-tsi.Tpo -c -o libpgm_noinst_la-tsi.lo `test -f 'tsi.c' || echo '$(srcdir)/'`tsi.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-tsi.Tpo $(DEPDIR)/libpgm_noinst_la-tsi.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tsi.c' object='libpgm_noinst_la-tsi.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-tsi.lo `test -f 'tsi.c' || echo '$(srcdir)/'`tsi.c

libpgm_noinst_la-txw.lo: txw.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-txw.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-txw.Tpo -c -o libpgm_noinst_la-txw.lo `test -f 'txw.c' || echo '$(srcdir)/'`txw.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-txw.Tpo $(DEPDIR)/libpgm_noinst_la-txw.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='txw.c' object='libpgm_noinst_la-txw.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-txw.lo `test -f 'txw.c' || echo '$(srcdir)/'`txw.c

libpgm_noinst_la-rxw.lo: rxw.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-rxw.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-rxw.Tpo -c -o libpgm_noinst_la-rxw.lo `test -f 'rxw.c' || echo '$(srcdir)/'`rxw.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-rxw.Tpo $(DEPDIR)/libpgm_noinst_la-rxw.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='rxw.c' object='libpgm_noinst_la-rxw.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-rxw.lo `test -f 'rxw.c' || echo '$(srcdir)/'`rxw.c

libpgm_noinst_la-skbuff.lo: skbuff.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-skbuff.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-skbuff.Tpo -c -o libpgm_noinst_la-skbuff.lo `test -f 'skbuff.c' || echo '$(srcdir)/'`skbuff.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-skbuff.Tpo $(DEPDIR)/libpgm_noinst_la-skbuff.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='skbuff.c' object='libpgm_noinst_la-skbuff.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-skbuff.lo `test -f 'skbuff.c' || echo '$(srcdir)/'`skbuff.c

libpgm_noinst_la-socket.lo: socket.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-socket.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-socket.Tpo -c -o libpgm_noinst_la-socket.lo `test -f 'socket.c' || echo '$(srcdir)/'`socket.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-socket.Tpo $(DEPDIR)/libpgm_noinst_la-socket.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='socket.c' object='libpgm_noinst_la-socket.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-socket.lo `test -f 'socket.c' || echo '$(srcdir)/'`socket.c

libpgm_noinst_la-source.lo: source.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-source.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-source.Tpo -c -o libpgm_noinst_la-source.lo `test -f 'source.c' || echo '$(srcdir)/'`source.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-source.Tpo $(DEPDIR)/libpgm_noinst_la-source.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='source.c' object='libpgm_noinst_la-source.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-source.lo `test -f 'source.c' || echo '$(srcdir)/'`source.c

libpgm_noinst_la-receiver.lo: receiver.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-receiver.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-receiver.Tpo -c -o libpgm_noinst_la-receiver.lo `test -f 'receiver.c' || echo '$(srcdir)/'`receiver.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-receiver.Tpo $(DEPDIR)/libpgm_noinst_la-receiver.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='receiver.c' object='libpgm_noinst_la-receiver.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-receiver.lo `test -f 'receiver.c' || echo '$(srcdir)/'`receiver.c

libpgm_noinst_la-recv.lo: recv.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-recv.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-recv.Tpo -c -o libpgm_noinst_la-recv.lo `test -f 'recv.c' || echo '$(srcdir)/'`recv.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-recv.Tpo $(DEPDIR)/libpgm_noinst_la-recv.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='recv.c' object='libpgm_noinst_la-recv.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-recv.lo `test -f 'recv.c' || echo '$(srcdir)/'`recv.c

libpgm_noinst_la-engine.lo: engine.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-engine.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-engine.Tpo -c -o libpgm_noinst_la-engine.lo `test -f 'engine.c' || echo '$(srcdir)/'`engine.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-engine.Tpo $(DEPDIR)/libpgm_noinst_la-engine.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='engine.c' object='libpgm_noinst_la-engine.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-engine.lo `test -f 'engine.c' || echo '$(srcdir)/'`engine.c

libpgm_noinst_la-timer.lo: timer.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-timer.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-timer.Tpo -c -o libpgm_noinst_la-timer.lo `test -f 'timer.c' || echo '$(srcdir)/'`timer.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-timer.Tpo $(DEPDIR)/libpgm_noinst_la-timer.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='timer.c' object='libpgm_noinst_la-timer.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-timer.lo `test -f 'timer.c' || echo '$(srcdir)/'`timer.c

libpgm_noinst_la-net.lo: net.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-net.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-net.Tpo -c -o libpgm_noinst_la-net.lo `test -f 'net.c' || echo '$(srcdir)/'`net.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-net.Tpo $(DEPDIR)/libpgm_noinst_la-net.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='net.c' object='libpgm_noinst_la-net.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-net.lo `test -f 'net.c' || echo '$(srcdir)/'`net.c

libpgm_noinst_la-rate_control.lo: rate_control.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-rate_control.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-rate_control.Tpo -c -o libpgm_noinst_la-rate_control.lo `test -f 'rate_control.c' || echo '$(srcdir)/'`rate_control.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-rate_control.Tpo $(DEPDIR)/libpgm_noinst_la-rate_control.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='rate_control.c' object='libpgm_noinst_la-rate_control.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-rate_control.lo `test -f 'rate_control.c' || echo '$(srcdir)/'`rate_control.c

libpgm_noinst_la-checksum.lo: checksum.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-checksum.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-checksum.Tpo -c -o libpgm_noinst_la-checksum.lo `test -f 'checksum.c' || echo '$(srcdir)/'`checksum.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-checksum.Tpo $(DEPDIR)/libpgm_noinst_la-checksum.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='checksum.c' object='libpgm_noinst_la-checksum.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-checksum.lo `test -f 'checksum.c' || echo '$(srcdir)/'`checksum.c

libpgm_noinst_la-reed_solomon.lo: reed_solomon.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-reed_solomon.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-reed_solomon.Tpo -c -o libpgm_noinst_la-reed_solomon.lo `test -f 'reed_solomon.c' || echo '$(srcdir)/'`reed_solomon.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-reed_solomon.Tpo $(DEPDIR)/libpgm_noinst_la-reed_solomon.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='reed_solomon.c' object='libpgm_noinst_la-reed_solomon.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-reed_solomon.lo `test -f 'reed_solomon.c' || echo '$(srcdir)/'`reed_solomon.c

libpgm_noinst_la-galois_tables.lo: galois_tables.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-galois_tables.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-galois_tables.Tpo -c -o libpgm_noinst_la-galois_tables.lo `test -f 'galois_tables.c' || echo '$(srcdir)/'`galois_tables.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-galois_tables.Tpo $(DEPDIR)/libpgm_noinst_la-galois_tables.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='galois_tables.c' object='libpgm_noinst_la-galois_tables.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-galois_tables.lo `test -f 'galois_tables.c' || echo '$(srcdir)/'`galois_tables.c

libpgm_noinst_la-wsastrerror.lo: wsastrerror.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-wsastrerror.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-wsastrerror.Tpo -c -o libpgm_noinst_la-wsastrerror.lo `test -f 'wsastrerror.c' || echo '$(srcdir)/'`wsastrerror.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-wsastrerror.Tpo $(DEPDIR)/libpgm_noinst_la-wsastrerror.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='wsastrerror.c' object='libpgm_noinst_la-wsastrerror.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-wsastrerror.lo `test -f 'wsastrerror.c' || echo '$(srcdir)/'`wsastrerror.c

libpgm_noinst_la-histogram.lo: histogram.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-histogram.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-histogram.Tpo -c -o libpgm_noinst_la-histogram.lo `test -f 'histogram.c' || echo '$(srcdir)/'`histogram.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-histogram.Tpo $(DEPDIR)/libpgm_noinst_la-histogram.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='histogram.c' object='libpgm_noinst_la-histogram.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-histogram.lo `test -f 'histogram.c' || echo '$(srcdir)/'`histogram.c

libpgm_noinst_la-version.lo: version.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -MT libpgm_noinst_la-version.lo -MD -MP -MF $(DEPDIR)/libpgm_noinst_la-version.Tpo -c -o libpgm_noinst_la-version.lo `test -f 'version.c' || echo '$(srcdir)/'`version.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libpgm_noinst_la-version.Tpo $(DEPDIR)/libpgm_noinst_la-version.Plo
@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='version.c' object='libpgm_noinst_la-version.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpgm_noinst_la_CFLAGS) $(CFLAGS) -c -o libpgm_noinst_la-version.lo `test -f 'version.c' || echo '$(srcdir)/'`version.c

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs

distclean-libtool:
	-rm -f libtool config.lt
install-pkgconfigDATA: $(pkgconfig_DATA)
	@$(NORMAL_INSTALL)
	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
	for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; \
	done | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
	done

uninstall-pkgconfigDATA:
	@$(NORMAL_UNINSTALL)
	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
	test -n "$$files" || exit 0; \
	echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
	cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
install-libincludeHEADERS: $(libinclude_HEADERS)
	@$(NORMAL_INSTALL)
	test -z "$(libincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libincludedir)"
	@list='$(libinclude_HEADERS)'; test -n "$(libincludedir)" || list=; \
	for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; \
	done | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libincludedir)'"; \
	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libincludedir)" || exit $$?; \
	done

uninstall-libincludeHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(libinclude_HEADERS)'; test -n "$(libincludedir)" || list=; \
	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
	test -n "$$files" || exit 0; \
	echo " ( cd '$(DESTDIR)$(libincludedir)' && rm -f" $$files ")"; \
	cd "$(DESTDIR)$(libincludedir)" && rm -f $$files

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	mkid -fID $$unique
tags: TAGS

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	set x; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	shift; \
	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
	  test -n "$$unique" || unique=$$empty_fix; \
	  if test $$# -gt 0; then \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      "$$@" $$unique; \
	  else \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      $$unique; \
	  fi; \
	fi
ctags: CTAGS
CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	test -z "$(CTAGS_ARGS)$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && $(am__cd) $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) "$$here"

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(DISTFILES)
	$(am__remove_distdir)
	test -d "$(distdir)" || mkdir "$(distdir)"
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
	  dist_files=`for file in $$list; do echo $$file; done | \
	  sed -e "s|^$$srcdirstrip/||;t" \
	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
	case $$dist_files in \
	  */*) $(MKDIR_P) `echo "$$dist_files" | \
			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
			   sort -u` ;; \
	esac; \
	for file in $$dist_files; do \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  if test -d $$d/$$file; then \
	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
	    if test -d "$(distdir)/$$file"; then \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
	  else \
	    test -f "$(distdir)/$$file" \
	    || cp -p $$d/$$file "$(distdir)/$$file" \
	    || exit 1; \
	  fi; \
	done
	$(MAKE) $(AM_MAKEFLAGS) \
	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
	  dist-hook
	-test -n "$(am__skip_mode_fix)" \
	|| find "$(distdir)" -type d ! -perm -755 \
		-exec chmod u+rwx,go+rx {} \; -o \
	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
	|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
	$(am__remove_distdir)

dist-bzip2: distdir
	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
	$(am__remove_distdir)

dist-lzma: distdir
	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
	$(am__remove_distdir)

dist-xz: distdir
	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
	$(am__remove_distdir)

dist-tarZ: distdir
	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
	$(am__remove_distdir)

dist-shar: distdir
	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
	$(am__remove_distdir)

dist-zip: distdir
	-rm -f $(distdir).zip
	zip -rq $(distdir).zip $(distdir)
	$(am__remove_distdir)

dist dist-all: distdir
	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
	$(am__remove_distdir)

# This target untars the dist file and tries a VPATH configuration.  Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
	case '$(DIST_ARCHIVES)' in \
	*.tar.gz*) \
	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
	*.tar.bz2*) \
	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
	*.tar.lzma*) \
	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
	*.tar.xz*) \
	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
	*.tar.Z*) \
	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
	*.shar.gz*) \
	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
	*.zip*) \
	  unzip $(distdir).zip ;;\
	esac
	chmod -R a-w $(distdir); chmod a+w $(distdir)
	mkdir $(distdir)/_build
	mkdir $(distdir)/_inst
	chmod a-w $(distdir)
	test -d $(distdir)/_build || exit 0; \
	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
	  && am__cwd=`pwd` \
	  && $(am__cd) $(distdir)/_build \
	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
	    $(DISTCHECK_CONFIGURE_FLAGS) \
	  && $(MAKE) $(AM_MAKEFLAGS) \
	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
	  && $(MAKE) $(AM_MAKEFLAGS) check \
	  && $(MAKE) $(AM_MAKEFLAGS) install \
	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
	        distuninstallcheck \
	  && chmod -R a-w "$$dc_install_base" \
	  && ({ \
	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
	  && rm -rf "$$dc_destdir" \
	  && $(MAKE) $(AM_MAKEFLAGS) dist \
	  && rm -rf $(DIST_ARCHIVES) \
	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
	  && cd "$$am__cwd" \
	  || exit 1
	$(am__remove_distdir)
	@(echo "$(distdir) archives ready for distribution: "; \
	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
	@$(am__cd) '$(distuninstallcheck_dir)' \
	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
	   || { echo "ERROR: files left after uninstall:" ; \
	        if test -n "$(DESTDIR)"; then \
	          echo "  (check DESTDIR support)"; \
	        fi ; \
	        $(distuninstallcheck_listfiles) ; \
	        exit 1; } >&2
distcleancheck: distclean
	@if test '$(srcdir)' = . ; then \
	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
	  exit 1 ; \
	fi
	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
	  || { echo "ERROR: files left in build directory after distclean:" ; \
	       $(distcleancheck_listfiles) ; \
	       exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
installdirs:
	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(libincludedir)"; do \
	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
	done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-am

clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
	clean-noinstLTLIBRARIES mostlyclean-am

distclean: distclean-am
	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-libtool distclean-tags

dvi: dvi-am

dvi-am:

html: html-am

html-am:

info: info-am

info-am:

install-data-am: install-libincludeHEADERS install-pkgconfigDATA

install-dvi: install-dvi-am

install-dvi-am:

install-exec-am: install-libLTLIBRARIES

install-html: install-html-am

install-html-am:

install-info: install-info-am

install-info-am:

install-man:

install-pdf: install-pdf-am

install-pdf-am:

install-ps: install-ps-am

install-ps-am:

installcheck-am:

maintainer-clean: maintainer-clean-am
	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
	-rm -rf $(top_srcdir)/autom4te.cache
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool

pdf: pdf-am

pdf-am:

ps: ps-am

ps-am:

uninstall-am: uninstall-libLTLIBRARIES uninstall-libincludeHEADERS \
	uninstall-pkgconfigDATA

.MAKE: install-am install-strip

.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
	clean-generic clean-libLTLIBRARIES clean-libtool \
	clean-noinstLTLIBRARIES ctags dist dist-all dist-bzip2 \
	dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
	dist-zip distcheck distclean distclean-compile \
	distclean-generic distclean-libtool distclean-tags \
	distcleancheck distdir distuninstallcheck dvi dvi-am html \
	html-am info info-am install install-am install-data \
	install-data-am install-dvi install-dvi-am install-exec \
	install-exec-am install-html install-html-am install-info \
	install-info-am install-libLTLIBRARIES \
	install-libincludeHEADERS install-man install-pdf \
	install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
	install-strip installcheck installcheck-am installdirs \
	maintainer-clean maintainer-clean-generic mostlyclean \
	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
	pdf pdf-am ps ps-am tags uninstall uninstall-am \
	uninstall-libLTLIBRARIES uninstall-libincludeHEADERS \
	uninstall-pkgconfigDATA


# nb: Solaris make does not understand $<
version.c: version_generator.py
	$(AM_V_GEN)$(PYTHON) $(srcdir)/version_generator.py > $@

galois_tables.c: galois_generator.pl
	$(AM_V_GEN)$(PERL) $(srcdir)/galois_generator.pl > $@
libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status libtool

dist-hook:
	-cp $(top_srcdir)/openpgm.spec $(distdir)/openpgm.spec
	-rm -rf $(distdir)/include
	-cp -R $(top_srcdir)/include $(distdir)/include
	-find $(distdir) -type d -name .svn -exec rm -r {} \; >/dev/null 2>&1 || true

# eof

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
libpgm-5.1.118-1~dfsg/openpgm/pgm/messages.c.c89.patch0000644000175000017500000000155211640407354021221 0ustar  locallocal--- messages.c	2011-03-29 20:40:59.000000000 +0800
+++ messages.c89.c	2011-03-29 20:41:05.000000000 +0800
@@ -176,14 +176,22 @@
 	char tbuf[1024];
 
 	pgm_mutex_lock (&messages_mutex);
+	{
 	const int offset = pgm_snprintf_s (tbuf, sizeof (tbuf), _TRUNCATE, "%s: ", log_level_text (log_level));
 	pgm_vsnprintf_s (tbuf + offset, sizeof(tbuf) - offset, _TRUNCATE, format, args);
+	}
 	if (log_handler)
 		log_handler (log_level, tbuf, log_handler_closure);
 	else {
 /* ignore return value */
-		(void) write (STDOUT_FILENO, tbuf, strlen (tbuf));
-		(void) write (STDOUT_FILENO, "\n", 1);
+#ifdef _MSC_VER
+		const int stdoutfd = _fileno (stdout);
+		_write (stdoutfd, tbuf, (unsigned)strlen (tbuf));
+		_write (stdoutfd, "\n", 1);
+#else
+		write (STDOUT_FILENO, tbuf, strlen (tbuf));
+		write (STDOUT_FILENO, "\n", 1);
+#endif
 	}
 		
 	pgm_mutex_unlock (&messages_mutex);
libpgm-5.1.118-1~dfsg/openpgm/pgm/error.c0000644000175000017500000002021111640407354017034 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * portable error reporting.
 *
 * Copyright (c) 2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _WIN32
#	include 
#endif
#include 
#include 


//#define ERROR_DEBUG


#define ERROR_OVERWRITTEN_WARNING "pgm_error_t set over the top of a previous pgm_error_t or uninitialized memory.\n" \
               "This indicates a bug. You must ensure an error is NULL before it's set.\n" \
               "The overwriting error message was: %s"

static pgm_error_t* pgm_error_new_valist (const int, const int, const char*, va_list) PGM_GNUC_PRINTF(3, 0);
static void pgm_error_add_prefix (char**restrict, const char*restrict, va_list) PGM_GNUC_PRINTF(2, 0);


static
pgm_error_t*
pgm_error_new_valist (
	const int		error_domain,
	const int		error_code,
	const char*		format,
	va_list			args
	)
{
	pgm_error_t *error = pgm_new (pgm_error_t, 1);
	error->domain  = error_domain;
	error->code    = error_code;
	error->message = pgm_strdup_vprintf (format, args);
	return error;
}

void
pgm_error_free (
	pgm_error_t*	error
	)
{
	pgm_return_if_fail (error != NULL);
	pgm_free (error->message);
	pgm_free (error);
}

void
pgm_set_error (
	pgm_error_t** restrict	err,
	const int		error_domain,
	const int		error_code,
	const char*   restrict	format,
	...
	)
{
	pgm_error_t *new;
	va_list args;

	if (NULL == err)
		return;

	va_start (args, format);
	new = pgm_error_new_valist (error_domain, error_code, format, args);
	va_end (args);

	if (NULL == *err)
		*err = new;
	else
		pgm_warn (_(ERROR_OVERWRITTEN_WARNING), new->message); 
}

void
pgm_propagate_error (
	pgm_error_t** restrict	dest,
	pgm_error_t*  restrict	src
	)
{
	pgm_return_if_fail (src != NULL);
 
	if (NULL == dest) {
		if (src)
			pgm_error_free (src);
		return;
	} else {
		if (NULL != *dest) {
			pgm_warn (_(ERROR_OVERWRITTEN_WARNING), src->message);
		} else {
			*dest = src;
		}
	}
}

void
pgm_clear_error (
	pgm_error_t**	err
	)
{
	if (err && *err) {
		pgm_error_free (*err);
		*err = NULL;
	}
}

static
void
pgm_error_add_prefix (
	char**	    restrict	string,
	const char* restrict	format,
	va_list			ap
	)
{
	char* prefix = pgm_strdup_vprintf (format, ap);
	char* oldstring = *string;
	*string = pgm_strconcat (prefix, oldstring, NULL);
	pgm_free (oldstring);
	pgm_free (prefix);
}

void
pgm_prefix_error (
	pgm_error_t** restrict	err,
	const char*   restrict	format,
	...
	)
{
	if (err && *err) {
		va_list ap;
		va_start (ap, format);
		pgm_error_add_prefix (&(*err)->message, format, ap);
		va_end (ap);
	}
}

/* error from libc.
 */

int
pgm_error_from_errno (
	const int	from_errno
	)
{
	switch (from_errno) {
#ifdef EAFNOSUPPORT
	case EAFNOSUPPORT:
		return PGM_ERROR_AFNOSUPPORT;
		break;
#endif

#ifdef EAGAIN
	case EAGAIN:
		return PGM_ERROR_AGAIN;
		break;
#endif

#ifdef EBADF
	case EBADF:
		return PGM_ERROR_BADF;
		break;
#endif

#ifdef ECONNRESET
	case ECONNRESET:
		return PGM_ERROR_CONNRESET;
		break;
#endif

#ifdef EFAULT
	case EFAULT:
		return PGM_ERROR_FAULT;
		break;
#endif

#ifdef EINTR
	case EINTR:
		return PGM_ERROR_INTR;
		break;
#endif

#ifdef EINVAL
	case EINVAL:
		return PGM_ERROR_INVAL;
		break;
#endif

#ifdef EMFILE
	case EMFILE:
		return PGM_ERROR_MFILE;
		break;
#endif

#ifdef ENFILE
	case ENFILE:
		return PGM_ERROR_NFILE;
		break;
#endif

#ifdef ENODEV
	case ENODEV:
		return PGM_ERROR_NODEV;
		break;
#endif

#ifdef ENOENT
	case ENOENT:
		return PGM_ERROR_NOENT;
		break;
#endif

#ifdef ENOMEM
	case ENOMEM:
		return PGM_ERROR_NOMEM;
		break;
#endif

#ifdef ENONET
	case ENONET:
		return PGM_ERROR_NONET;
		break;
#endif

#ifdef ENOPROTOOPT
	case ENOPROTOOPT:
		return PGM_ERROR_NOPROTOOPT;
		break;
#endif

#ifdef ENOTUNIQ
	case ENOTUNIQ:
		return PGM_ERROR_NOTUNIQ;
		break;
#endif

#ifdef ENXIO
	case ENXIO:
		return PGM_ERROR_NXIO;
		break;
#endif

#ifdef EPERM
	case EPERM:
		return PGM_ERROR_PERM;
		break;
#endif

#ifdef EPROTO
	case EPROTO:
		return PGM_ERROR_PROTO;
		break;
#endif

#ifdef ERANGE
	case ERANGE:
		return PGM_ERROR_RANGE;
		break;
#endif

#ifdef EXDEV
	case EXDEV:
		return PGM_ERROR_XDEV;
		break;
#endif

	default :
		return PGM_ERROR_FAILED;
		break;
	}
}

/* h_errno from gethostbyname.
 */

int
pgm_error_from_h_errno (
	const int	from_h_errno
	)
{
	switch (from_h_errno) {
#ifdef HOST_NOT_FOUND
	case HOST_NOT_FOUND:
		return PGM_ERROR_NONAME;
		break;
#endif

#ifdef TRY_AGAIN
	case TRY_AGAIN:
		return PGM_ERROR_AGAIN;
		break;
#endif

#ifdef NO_RECOVERY
	case NO_RECOVERY:
		return PGM_ERROR_FAIL;
		break;
#endif

#ifdef NO_DATA
	case NO_DATA:
		return PGM_ERROR_NODATA;
		break;
#endif

	default:
		return PGM_ERROR_FAILED;
		break;
	}
}

/* errno must be preserved before calling to catch correct error
 * status with EAI_SYSTEM.
 */

int
pgm_error_from_eai_errno (
	const int	from_eai_errno,
#ifdef EAI_SYSTEM
	const int	from_errno
#else
	PGM_GNUC_UNUSED const int from_errno
#endif
	)
{
	switch (from_eai_errno) {
#ifdef EAI_ADDRFAMILY
	case EAI_ADDRFAMILY:
		return PGM_ERROR_ADDRFAMILY;
		break;
#endif

#ifdef EAI_AGAIN
	case EAI_AGAIN:
		return PGM_ERROR_AGAIN;
		break;
#endif

#ifdef EAI_BADFLAGS
	case EAI_BADFLAGS:
		return PGM_ERROR_INVAL;
		break;
#endif

#ifdef EAI_FAIL
	case EAI_FAIL:
		return PGM_ERROR_FAIL;
		break;
#endif

#ifdef EAI_FAMILY
	case EAI_FAMILY:
		return PGM_ERROR_AFNOSUPPORT;
		break;
#endif

#ifdef EAI_MEMORY
	case EAI_MEMORY:
		return PGM_ERROR_NOMEM;
		break;
#endif

#ifdef EAI_NODATA
	case EAI_NODATA:
		return PGM_ERROR_NODATA;
		break;
#endif

#if defined(EAI_NONAME) && EAI_NONAME != EAI_NODATA
	case EAI_NONAME:
		return PGM_ERROR_NONAME;
		break;
#endif

#ifdef EAI_SERVICE
	case EAI_SERVICE:
		return PGM_ERROR_SERVICE;
		break;
#endif

#ifdef EAI_SOCKTYPE
	case EAI_SOCKTYPE:
		return PGM_ERROR_SOCKTNOSUPPORT;
		break;
#endif

#ifdef EAI_SYSTEM
	case EAI_SYSTEM:
		return pgm_error_from_errno (from_errno);
		break;
#endif

	default :
		return PGM_ERROR_FAILED;
		break;
	}
}

/* from WSAGetLastError()
 */

int
pgm_error_from_wsa_errno (
	const int	from_wsa_errno
        )
{
	switch (from_wsa_errno) {
#ifdef WSAEINVAL
	case WSAEINVAL:
		return PGM_ERROR_INVAL;
		break;
#endif
#ifdef WSAEMFILE
	case WSAEMFILE:
		return PGM_ERROR_MFILE;
		break;
#endif
#ifdef WSA_NOT_ENOUGH_MEMORY
	case WSA_NOT_ENOUGH_MEMORY:
		return PGM_ERROR_NOMEM;
		break;
#endif
#ifdef WSAENOPROTOOPT
	case WSAENOPROTOOPT:
		return PGM_ERROR_NOPROTOOPT;
		break;
#endif
#ifdef WSAECONNRESET
	case WSAECONNRESET:
		return PGM_ERROR_CONNRESET;
		break;
#endif

	default :
		return PGM_ERROR_FAILED;
		break;
	}
}

/* from Last-Error codes, i.e. Windows non-WinSock and non-DOS errors.
 */

int
pgm_error_from_win_errno (
	const int	from_win_errno
        )
{
	switch (from_win_errno) {
#ifdef ERROR_ADDRESS_NOT_ASSOCIATED
	case ERROR_ADDRESS_NOT_ASSOCIATED:
		return PGM_ERROR_NODATA;
		break;
#endif

#ifdef ERROR_BUFFER_OVERFLOW
	case ERROR_BUFFER_OVERFLOW:
		return PGM_ERROR_NOBUFS;
		break;
#endif

#ifdef ERROR_INVALID_DATA
	case ERROR_INVALID_DATA:
		return PGM_ERROR_BADE;
		break;
#endif

#ifdef ERROR_INSUFFICIENT_BUFFER
	case ERROR_INSUFFICIENT_BUFFER:
		return PGM_ERROR_NOMEM;
		break;
#endif

#ifdef ERROR_INVALID_PARAMETER
	case ERROR_INVALID_PARAMETER:
		return PGM_ERROR_INVAL;
		break;
#endif

#ifdef ERROR_NOT_ENOUGH_MEMORY
	case ERROR_NOT_ENOUGH_MEMORY:
		return PGM_ERROR_NOMEM;
		break;
#endif

#ifdef ERROR_NO_DATA
	case ERROR_NO_DATA:
		return PGM_ERROR_NODATA;
		break;
#endif

#ifdef ERROR_NOT_SUPPORTED
	case ERROR_NOT_SUPPORTED:
		return PGM_ERROR_NOSYS;
		break;
#endif

	default :
		return PGM_ERROR_FAILED;
		break;
	}
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/receiver.c.c89.patch0000644000175000017500000003213211640407354021214 0ustar  locallocal--- receiver.c	2011-03-12 10:55:40.000000000 +0800
+++ receiver.c89.c	2011-03-12 10:55:33.000000000 +0800
@@ -166,6 +166,7 @@
 
 	pgm_trace (PGM_LOG_ROLE_RX_WINDOW, _("Lost data #%u due to cancellation."), skb->sequence);
 
+	{
 	const uint32_t fail_time = (uint32_t)(now - skb->tstamp);
 	if (!peer->max_fail_time)
 		peer->max_fail_time = peer->min_fail_time = fail_time;
@@ -176,6 +177,7 @@
 
 	pgm_rxw_lost (peer->window, skb->sequence);
 	PGM_HISTOGRAM_TIMES("Rx.FailTime", fail_time);
+	}
 
 /* mark receiver window for flushing on next recv() */
 	pgm_peer_set_pending (sock, peer);
@@ -215,6 +217,7 @@
 	pgm_assert (NULL != skb);
 	pgm_assert (NULL != skb->pgm_opt_pgmcc_data);
 
+	{
 	const unsigned acker_afi = ntohs (skb->pgm_opt_pgmcc_data->opt_nla_afi);
 	switch (acker_afi) {
 	case AFI_IP:
@@ -231,6 +234,7 @@
 	}
 
 	return FALSE;
+	}
 }
 
 /* add state for an ACK on a data packet.
@@ -390,11 +394,13 @@
 	pgm_assert (dst_addrlen > 0);
 
 #ifdef PGM_DEBUG
+	{
 	char saddr[INET6_ADDRSTRLEN], daddr[INET6_ADDRSTRLEN];
 	pgm_sockaddr_ntop (src_addr, saddr, sizeof(saddr));
 	pgm_sockaddr_ntop (dst_addr, daddr, sizeof(daddr));
 	pgm_debug ("pgm_new_peer (sock:%p tsi:%s src-addr:%s src-addrlen:%u dst-addr:%s dst-addrlen:%u)",
 		(void*)sock, pgm_tsi_print (tsi), saddr, (unsigned)src_addrlen, daddr, (unsigned)dst_addrlen);
+	}
 #endif
 
 	peer = pgm_new0 (pgm_peer_t, 1);
@@ -463,6 +469,7 @@
 		pgm_peer_t* peer = sock->peers_pending->data;
 		if (peer->last_commit && peer->last_commit < sock->last_commit)
 			pgm_rxw_remove_commit (peer->window);
+		{
 		const ssize_t peer_bytes = pgm_rxw_readv (peer->window, pmsg, (unsigned)(msg_end - *pmsg + 1));
 
 		if (peer->last_cumulative_losses != ((pgm_rxw_t*)peer->window)->cumulative_losses)
@@ -489,6 +496,7 @@
 		}
 /* clear this reference and move to next */
 		sock->peers_pending = pgm_slist_remove_first (sock->peers_pending);
+		}
 	}
 
 	return retval;
@@ -592,6 +600,7 @@
 
 	spm  = (struct pgm_spm *)skb->data;
 	spm6 = (struct pgm_spm6*)skb->data;
+	{
 	const uint32_t spm_sqn = ntohl (spm->spm_sqn);
 
 /* check for advancing sequence number, or first SPM */
@@ -604,6 +613,7 @@
 		source->spm_sqn = spm_sqn;
 
 /* update receive window */
+		{
 		const pgm_time_t nak_rb_expiry = skb->tstamp + nak_rb_ivl (sock);
 		const unsigned naks = pgm_rxw_update (source->window,
 						      ntohl (spm->spm_lead),
@@ -626,6 +636,7 @@
 			source->last_cumulative_losses = source->window->cumulative_losses;
 			pgm_peer_set_pending (sock, source);
 		}
+		}
 	}
 	else
 	{	/* does not advance SPM sequence number */
@@ -671,6 +682,7 @@
 					return FALSE;
 				}
 
+				{
 				const uint32_t parity_prm_tgs = ntohl (opt_parity_prm->parity_prm_tgs);
 				if (PGM_UNLIKELY(parity_prm_tgs < 2 || parity_prm_tgs > 128))
 				{
@@ -685,6 +697,7 @@
 					source->is_fec_enabled = 1;
 					pgm_rxw_update_fec (source->window, parity_prm_tgs);
 				}
+				}
 			}
 		} while (!(opt_header->opt_type & PGM_OPT_END));
 	}
@@ -697,6 +710,7 @@
 		source->spmr_tstamp = 0;
 	}
 	return TRUE;
+	}
 }
 
 /* Multicast peer-to-peer NAK handling, pretty much the same as a NCF but different direction
@@ -746,7 +760,10 @@
 
 /* NAK_GRP_NLA contains one of our sock receive multicast groups: the sources send multicast group */ 
 	pgm_nla_to_sockaddr ((AF_INET6 == nak_src_nla.ss_family) ? &nak6->nak6_grp_nla_afi : &nak->nak_grp_nla_afi, (struct sockaddr*)&nak_grp_nla);
-	for (unsigned i = 0; i < sock->recv_gsr_len; i++)
+
+	{
+	unsigned i;
+	for (i = 0; i < sock->recv_gsr_len; i++)
 	{
 		if (pgm_sockaddr_cmp ((struct sockaddr*)&nak_grp_nla, (struct sockaddr*)&sock->recv_gsr[i].gsr_group) == 0)
 		{
@@ -754,6 +771,7 @@
 			break;
 		}
 	}
+	}
 
 	if (PGM_UNLIKELY(!found_nak_grp)) {
 		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded multicast NAK on multicast group mismatch."));
@@ -886,6 +904,7 @@
 		return FALSE;
 	}
 
+	{
 	const pgm_time_t ncf_rdata_ivl = skb->tstamp + sock->nak_rdata_ivl;
 	const pgm_time_t ncf_rb_ivl    = skb->tstamp + nak_rb_ivl(sock);
 	ncf_status = pgm_rxw_confirm (source->window,
@@ -964,6 +983,7 @@
 		pgm_peer_set_pending (sock, source);
 	}
 	return TRUE;
+	}
 }
 
 /* send SPM-request to a new peer, this packet type has no contents
@@ -990,6 +1010,7 @@
 	pgm_debug ("send_spmr (sock:%p source:%p)",
 		(const void*)sock, (const void*)source);
 
+	{
 	const size_t tpdu_length = sizeof(struct pgm_header);
 	buf = pgm_alloca (tpdu_length);
 	header = (struct pgm_header*)buf;
@@ -1004,17 +1025,20 @@
 	header->pgm_checksum	= pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0));
 
 /* send multicast SPMR TTL 1 to our peers listening on the same groups */
-	for (unsigned i = 0; i < sock->recv_gsr_len; i++)
+	{
+	unsigned i;
+	for (i = 0; i < sock->recv_gsr_len; i++)
 		sent = pgm_sendto_hops (sock,
-					FALSE,			/* not rate limited */
+					FALSE,                  /* not rate limited */
 					NULL,
-					FALSE,			/* regular socket */
+					FALSE,                  /* regular socket */
 					1,
 					header,
 					tpdu_length,
 					(struct sockaddr*)&sock->recv_gsr[i].gsr_group,
 					pgm_sockaddr_len ((struct sockaddr*)&sock->recv_gsr[i].gsr_group));
 /* ignore errors on peer multicast */
+	}
 
 /* send unicast SPMR with regular TTL */
 	sent = pgm_sendto (sock,
@@ -1028,8 +1052,9 @@
 	if (sent < 0 && PGM_LIKELY(PGM_SOCK_EAGAIN == pgm_get_last_sock_error()))
 		return FALSE;
 
-	sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT] += tpdu_length * 2;
+	sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT] += (uint32_t)(tpdu_length * 2);
 	return TRUE;
+	}
 }
 
 /* send selective NAK for one sequence number.
@@ -1212,15 +1237,20 @@
 	pgm_assert_cmpuint (sqn_list->len, <=, 63);
 
 #ifdef RECEIVER_DEBUG
+	{
 	char list[1024];
 	sprintf (list, "%" PRIu32, sqn_list->sqn[0]);
-	for (unsigned i = 1; i < sqn_list->len; i++) {
+	{
+	unsigned i;
+	for (i = 1; i < sqn_list->len; i++) {
 		char sequence[2 + strlen("4294967295")];
 		sprintf (sequence, " %" PRIu32, sqn_list->sqn[i]);
 		strcat (list, sequence);
 	}
+	}
 	pgm_debug("send_nak_list (sock:%p source:%p sqn-list:[%s])",
 		(const void*)sock, (const void*)source, list);
+	}
 #endif
 
 	tpdu_length = sizeof(struct pgm_header) +
@@ -1274,8 +1304,11 @@
 	opt_nak_list = (struct pgm_opt_nak_list*)(opt_header + 1);
 	opt_nak_list->opt_reserved = 0;
 
-	for (unsigned i = 1; i < sqn_list->len; i++)
+	{
+	unsigned i;
+	for (i = 1; i < sqn_list->len; i++)
 		opt_nak_list->opt_sqn[i-1] = htonl (sqn_list->sqn[i]);
+	}
 
         header->pgm_checksum    = 0;
         header->pgm_checksum	= pgm_csum_fold (pgm_csum_partial (buf, (uint16_t)tpdu_length, 0));
@@ -1323,8 +1356,8 @@
 	pgm_assert (NULL != source);
 	pgm_assert (sock->use_pgmcc);
 
-	pgm_debug ("send_ack (sock:%p source:%p now:%" PGM_TIME_FORMAT ")",
-		(void*)sock, (void*)source, now);
+	pgm_debug ("send_ack (source:%p now:%" PGM_TIME_FORMAT ")",
+		(const void*)source, now);
 
 	tpdu_length = sizeof(struct pgm_header) +
 			     sizeof(struct pgm_ack) +
@@ -1369,8 +1402,10 @@
 	opt_pgmcc_feedback = (struct pgm_opt_pgmcc_feedback*)(opt_header + 1);
 	opt_pgmcc_feedback->opt_reserved = 0;
 
+	{
 	const uint32_t t = (uint32_t)(source->ack_last_tstamp + pgm_to_msecs( now - source->last_data_tstamp ));
 	opt_pgmcc_feedback->opt_tstamp = htonl (t);
+	}
 	pgm_sockaddr_to_nla ((struct sockaddr*)&sock->send_addr, (char*)&opt_pgmcc_feedback->opt_nla_afi);
 	opt_pgmcc_feedback->opt_loss_rate = htons ((uint16_t)source->window->data_loss);
 
@@ -1426,9 +1461,12 @@
 	}
 
 /* have not learned this peers NLA */
+	{
 	const bool is_valid_nla = (0 != peer->nla.ss_family);
 
-	for (pgm_list_t *it = ack_backoff_queue->tail, *prev = it->prev;
+	{
+	pgm_list_t *it, *prev;
+	for (it = ack_backoff_queue->tail, prev = it->prev;
 	     NULL != it;
 	     it = prev)
 	{
@@ -1455,6 +1493,8 @@
 			break;
 		}
 	}
+	}
+	}
 
 	if (ack_backoff_queue->length == 0)
 	{
@@ -1523,6 +1563,7 @@
 	}
 
 /* have not learned this peers NLA */
+	{
 	const bool is_valid_nla = 0 != peer->nla.ss_family;
 
 /* TODO: process BOTH selective and parity NAKs? */
@@ -1540,7 +1581,9 @@
 
 /* parity NAK generation */
 
-		for (pgm_list_t *it = nak_backoff_queue->tail, *prev = it->prev;
+		{
+		pgm_list_t *it, *prev;
+		for (it = nak_backoff_queue->tail, prev = it->prev;
 		     NULL != it;
 		     it = prev)
 		{
@@ -1561,6 +1604,7 @@
 				}
 
 /* TODO: parity nak lists */
+				{
 				const uint32_t tg_sqn = skb->sequence & tg_sqn_mask;
 				if (	(  nak_pkt_cnt && tg_sqn == nak_tg_sqn ) ||
 					( !nak_pkt_cnt && tg_sqn != current_tg_sqn )	)
@@ -1589,23 +1633,28 @@
 				{	/* different transmission group */
 					break;
 				}
+				}
 			}
 			else
 			{	/* packet expires some time later */
 				break;
 			}
 		}
+		}
 
 		if (nak_pkt_cnt && !send_parity_nak (sock, peer, nak_tg_sqn, nak_pkt_cnt))
 			return FALSE;
 	}
 	else
 	{
-		struct pgm_sqn_list_t nak_list = { .len = 0 };
+		struct pgm_sqn_list_t nak_list;
+		nak_list.len = 0;
 
 /* select NAK generation */
 
-		for (pgm_list_t *it = nak_backoff_queue->tail, *prev = it->prev;
+		{
+		pgm_list_t *it, *prev;
+		for (it = nak_backoff_queue->tail, prev = it->prev;
 		     NULL != it;
 		     it = prev)
 		{
@@ -1660,6 +1709,7 @@
 				break;
 			}
 		}
+		}
 
 		if (sock->can_send_nak && nak_list.len)
 		{
@@ -1670,6 +1720,7 @@
 		}
 
 	}
+	}
 
 	if (PGM_UNLIKELY(dropped_invalid))
 	{
@@ -1731,7 +1782,9 @@
 	if (!sock->peers_list)
 		return TRUE;
 
-	for (pgm_list_t *it = sock->peers_list, *next = it->next;
+	{
+	pgm_list_t *it, *next;
+	for (it = sock->peers_list, next = it->next;
 	     NULL != it;
 	     it = next)
 	{
@@ -1808,6 +1861,7 @@
 		}
 
 	}
+	}
 
 /* check for waiting contiguous packets */
 	if (sock->peers_pending && !sock->is_pending_read)
@@ -1841,7 +1895,9 @@
 	if (!sock->peers_list)
 		return expiration;
 
-	for (pgm_list_t *it = sock->peers_list, *next = it->next;
+	{
+	pgm_list_t *it, *next;
+	for (it = sock->peers_list, next = it->next;
 	     NULL != it;
 	     it = next)
 	{
@@ -1881,6 +1937,7 @@
 		}
 
 	}
+	}
 
 	return expiration;
 }
@@ -1912,14 +1969,18 @@
 	wait_ncf_queue = &peer->window->wait_ncf_queue;
 
 /* have not learned this peers NLA */
+	{
 	const bool is_valid_nla = 0 != peer->nla.ss_family;
 
-	for (pgm_list_t *it = wait_ncf_queue->tail, *prev = it->prev;
+	{
+	pgm_list_t *it, *prev;
+	for (it = wait_ncf_queue->tail, prev = it->prev;
 	     NULL != it;
 	     it = prev)
 	{
 		struct pgm_sk_buff_t* skb	= (struct pgm_sk_buff_t*)it;
 		pgm_assert (NULL != skb);
+		{
 		pgm_rxw_state_t* state		= (pgm_rxw_state_t*)&skb->cb;
 
 		prev = it->prev;
@@ -1957,6 +2018,8 @@
 				skb->sequence, pgm_to_secsf (state->timer_expiry - now));
 			break;
 		}
+		}
+	}
 	}
 
 	if (wait_ncf_queue->length == 0)
@@ -2016,6 +2079,7 @@
 	{
 		pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Wait ncf queue empty."));
 	}
+	}
 }
 
 /* check WAIT_DATA_STATE, on expiration move back to BACK-OFF_STATE, on exceeding NAK_DATA_RETRIES
@@ -2045,14 +2109,18 @@
 	wait_data_queue = &peer->window->wait_data_queue;
 
 /* have not learned this peers NLA */
+	{
 	const bool is_valid_nla = 0 != peer->nla.ss_family;
 
-	for (pgm_list_t *it = wait_data_queue->tail, *prev = it->prev;
+	{
+	pgm_list_t *it, *prev;
+	for (it = wait_data_queue->tail, prev = it->prev;
 	     NULL != it;
 	     it = prev)
 	{
 		struct pgm_sk_buff_t* rdata_skb	= (struct pgm_sk_buff_t*)it;
 		pgm_assert (NULL != rdata_skb);
+		{
 		pgm_rxw_state_t* rdata_state	= (pgm_rxw_state_t*)&rdata_skb->cb;
 
 		prev = it->prev;
@@ -2088,6 +2156,8 @@
 			break;
 		}
 		
+		}
+	}
 	}
 
 	if (wait_data_queue->length == 0)
@@ -2125,6 +2195,7 @@
 	} else {
 		pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Wait data queue empty."));
 	}
+	}
 }
 
 /* ODATA or RDATA packet with any of the following options:
@@ -2156,11 +2227,13 @@
 	pgm_debug ("pgm_on_data (sock:%p source:%p skb:%p)",
 		(void*)sock, (void*)source, (void*)skb);
 
+	{
 	const pgm_time_t nak_rb_expiry = skb->tstamp + nak_rb_ivl (sock);
 	const uint_fast16_t tsdu_length = ntohs (skb->pgm_header->pgm_tsdu_length);
 
 	skb->pgm_data = skb->data;
 
+	{
 	const uint_fast16_t opt_total_length = (skb->pgm_header->pgm_options & PGM_OPT_PRESENT) ?
 		ntohs(*(uint16_t*)( (char*)( skb->pgm_data + 1 ) + sizeof(uint16_t))) :
 		0;
@@ -2177,6 +2250,7 @@
 		ack_rb_expiry = skb->tstamp + ack_rb_ivl (sock);
 	}
 
+	{
 	const int add_status = pgm_rxw_add (source->window, skb, skb->tstamp, nak_rb_expiry);
 
 /* skb reference is now invalid */
@@ -2254,6 +2328,9 @@
 		pgm_timer_unlock (sock);
 	}
 	return TRUE;
+	}
+	}
+	}
 }
 
 /* POLLs are generated by PGM Parents (Sources or Network Elements).
@@ -2291,6 +2368,7 @@
 	memcpy (&poll_rand, (AFI_IP6 == ntohs (poll4->poll_nla_afi)) ?
 		poll6->poll6_rand :
 		poll4->poll_rand, sizeof(poll_rand));
+	{
 	const uint32_t poll_mask = (AFI_IP6 == ntohs (poll4->poll_nla_afi)) ?
 		ntohl (poll6->poll6_mask) :
 		ntohl (poll4->poll_mask);
@@ -2306,6 +2384,7 @@
 /* scoped per path nla
  * TODO: manage list of pollers per peer
  */
+	{
 	const uint32_t poll_sqn   = ntohl (poll4->poll_sqn);
 	const uint16_t poll_round = ntohs (poll4->poll_round);
 
@@ -2320,6 +2399,7 @@
 	source->last_poll_sqn   = poll_sqn;
 	source->last_poll_round = poll_round;
 
+	{
 	const uint16_t poll_s_type = ntohs (poll4->poll_s_type);
 
 /* Check poll type */
@@ -2336,6 +2416,9 @@
 	}
 
 	return FALSE;
+	}
+	}
+	}
 }
 
 /* Used to count PGM children */
libpgm-5.1.118-1~dfsg/openpgm/pgm/bootstrap.log0000644000175000017500000000000011644640122020245 0ustar  locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/recv.c0000644000175000017500000007425311640407354016661 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Transport recv API.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _GNU_SOURCE
#	define _GNU_SOURCE
#endif

#include 
#ifndef _WIN32
#	include 
#	include 
#	include 		/* _GNU_SOURCE for in6_pktinfo */
#else
#	include 
#	include 
#endif
#include 
#include 
#include 
#include 
#include 
#include 


//#define RECV_DEBUG

#ifndef RECV_DEBUG
#	define PGM_DISABLE_ASSERT
#endif

#ifndef _WIN32
#	define PGM_CMSG_FIRSTHDR(msg)		CMSG_FIRSTHDR(msg)
#	define PGM_CMSG_NXTHDR(msg, cmsg)	CMSG_NXTHDR(msg, cmsg)
#	define PGM_CMSG_DATA(cmsg)		CMSG_DATA(cmsg)
#	define PGM_CMSG_SPACE(len)		CMSG_SPACE(len)
#	define PGM_CMSG_LEN(len)		CMSG_LEN(len)
#else
#	define PGM_CMSG_FIRSTHDR(msg)		WSA_CMSG_FIRSTHDR(msg)
#	define PGM_CMSG_NXTHDR(msg, cmsg)	WSA_CMSG_NXTHDR(msg, cmsg)
#	define PGM_CMSG_DATA(cmsg)		WSA_CMSG_DATA(cmsg)
#	define PGM_CMSG_SPACE(len)		WSA_CMSG_SPACE(len)
#	define PGM_CMSG_LEN(len)		WSA_CMSG_LEN(len)
#endif

#ifdef CONFIG_HAVE_WSACMSGHDR
#	ifdef __GNU__
/* as listed in MSDN */
#		define pgm_cmsghdr			wsacmsghdr
#	else
#		define pgm_cmsghdr			_WSACMSGHDR
#	endif
#else
#	define pgm_cmsghdr			cmsghdr
#endif


/* read a packet into a PGM skbuff
 * on success returns packet length, on closed socket returns 0,
 * on error returns -1.
 */

static
ssize_t
recvskb (
	pgm_sock_t*           const restrict sock,
	struct pgm_sk_buff_t* const restrict skb,
	const int			     flags,
	struct sockaddr*      const restrict src_addr,
	const socklen_t			     src_addrlen,
	struct sockaddr*      const restrict dst_addr,
	const socklen_t			     dst_addrlen
	)
{
/* pre-conditions */
	pgm_assert (NULL != sock);
	pgm_assert (NULL != skb);
	pgm_assert (NULL != src_addr);
	pgm_assert (src_addrlen > 0);
	pgm_assert (NULL != dst_addr);
	pgm_assert (dst_addrlen > 0);

	pgm_debug ("recvskb (sock:%p skb:%p flags:%d src-addr:%p src-addrlen:%d dst-addr:%p dst-addrlen:%d)",
		(void*)sock, (void*)skb, flags, (void*)src_addr, (int)src_addrlen, (void*)dst_addr, (int)dst_addrlen);

	if (PGM_UNLIKELY(sock->is_destroyed))
		return 0;

#ifdef CONFIG_TARGET_WINE
	socklen_t fromlen = src_addrlen;
	const ssize_t len = recvfrom (sock->recv_sock, skb->head, sock->max_tpdu, 0, src_addr, &fromlen);
	if (len <= 0)
		return len;
#else
	struct pgm_iovec iov = {
		.iov_base	= skb->head,
		.iov_len	= sock->max_tpdu
	};
	char aux[ 1024 ];
#	ifndef _WIN32
	struct msghdr msg = {
		.msg_name	= src_addr,
		.msg_namelen	= src_addrlen,
		.msg_iov	= (void*)&iov,
		.msg_iovlen	= 1,
		.msg_control	= aux,
		.msg_controllen = sizeof(aux),
		.msg_flags	= 0
	};
	ssize_t len = recvmsg (sock->recv_sock, &msg, flags);
	if (len <= 0)
		return len;
#	else /* !_WIN32 */
	WSAMSG msg = {
		.name		= (LPSOCKADDR)src_addr,
		.namelen	= src_addrlen,
		.lpBuffers	= (LPWSABUF)&iov,
		.dwBufferCount	= 1,
		.dwFlags	= 0
	};
	msg.Control.buf		= aux;
	msg.Control.len		= sizeof(aux);
	DWORD len;
	if (SOCKET_ERROR == pgm_WSARecvMsg (sock->recv_sock, &msg, &len, NULL, NULL)) {
		return SOCKET_ERROR;
	}
#	endif /* !_WIN32 */
#endif /* !CONFIG_TARGET_WINE */

#ifdef PGM_DEBUG
	if (PGM_UNLIKELY(pgm_loss_rate > 0)) {
		const unsigned percent = pgm_rand_int_range (&sock->rand_, 0, 100);
		if (percent <= pgm_loss_rate) {
			pgm_debug ("Simulated packet loss");
			pgm_set_last_sock_error (PGM_SOCK_EAGAIN);
			return SOCKET_ERROR;
		}
	}
#endif

	skb->sock		= sock;
	skb->tstamp		= pgm_time_update_now();
	skb->data		= skb->head;
	skb->len		= (uint16_t)len;
	skb->zero_padded	= 0;
	skb->tail		= (char*)skb->data + len;

#ifdef CONFIG_TARGET_WINE
	pgm_assert (pgm_sockaddr_len (&sock->recv_gsr[0].gsr_group) <= dst_addrlen);
	memcpy (dst_addr, &sock->recv_gsr[0].gsr_group, pgm_sockaddr_len (&sock->recv_gsr[0].gsr_group));
#else
	if (sock->udp_encap_ucast_port ||
	    AF_INET6 == pgm_sockaddr_family (src_addr))
	{
		struct pgm_cmsghdr* cmsg;
		for (cmsg = PGM_CMSG_FIRSTHDR(&msg);
		     cmsg != NULL;
		     cmsg = PGM_CMSG_NXTHDR(&msg, cmsg))
		{
/* both IP_PKTINFO and IP_RECVDSTADDR exist on OpenSolaris, so capture
 * each type if defined.
 */
#ifdef IP_PKTINFO
			if (IPPROTO_IP == cmsg->cmsg_level && 
			    IP_PKTINFO == cmsg->cmsg_type)
			{
				const void* pktinfo		= PGM_CMSG_DATA(cmsg);
/* discard on invalid address */
				if (PGM_UNLIKELY(NULL == pktinfo)) {
					pgm_debug ("in_pktinfo is NULL");
					return -1;
				}
				const struct in_pktinfo* in	= pktinfo;
				struct sockaddr_in s4;
				memset (&s4, 0, sizeof(s4));
				s4.sin_family			= AF_INET;
				s4.sin_addr.s_addr		= in->ipi_addr.s_addr;
				memcpy (dst_addr, &s4, sizeof(s4));
				break;
			}
#endif
#ifdef IP_RECVDSTADDR
			if (IPPROTO_IP == cmsg->cmsg_level &&
			    IP_RECVDSTADDR == cmsg->cmsg_type)
			{
				const void* recvdstaddr		= PGM_CMSG_DATA(cmsg);
/* discard on invalid address */
				if (PGM_UNLIKELY(NULL == recvdstaddr)) {
					pgm_debug ("in_recvdstaddr is NULL");
					return -1;
				}
				const struct in_addr* in	= recvdstaddr;
				struct sockaddr_in s4;
				memset (&s4, 0, sizeof(s4));
				s4.sin_family			= AF_INET;
				s4.sin_addr.s_addr		= in->s_addr;
				memcpy (dst_addr, &s4, sizeof(s4));
				break;
			}
#endif
#if !defined(IP_PKTINFO) && !defined(IP_RECVDSTADDR)
#	error "No defined CMSG type for IPv4 destination address."
#endif

			if (IPPROTO_IPV6 == cmsg->cmsg_level && 
			    IPV6_PKTINFO == cmsg->cmsg_type)
			{
				const void* pktinfo		= PGM_CMSG_DATA(cmsg);
/* discard on invalid address */
				if (PGM_UNLIKELY(NULL == pktinfo)) {
					pgm_debug ("in6_pktinfo is NULL");
					return -1;
				}
				const struct in6_pktinfo* in6	= pktinfo;
				struct sockaddr_in6 s6;
				memset (&s6, 0, sizeof(s6));
				s6.sin6_family			= AF_INET6;
				s6.sin6_addr			= in6->ipi6_addr;
				s6.sin6_scope_id		= in6->ipi6_ifindex;
				memcpy (dst_addr, &s6, sizeof(s6));
/* does not set flow id */
				break;
			}
		}
	}
#endif
	return len;
}

/* upstream = receiver to source, peer-to-peer = receive to receiver
 *
 * NB: SPMRs can be upstream or peer-to-peer, if the packet is multicast then its
 *     a peer-to-peer message, if its unicast its an upstream message.
 *
 * returns TRUE on valid processed packet, returns FALSE on discarded packet.
 */

static
bool
on_upstream (
	pgm_sock_t*           const restrict sock,
	struct pgm_sk_buff_t* const restrict skb
	)
{
/* pre-conditions */
	pgm_assert (NULL != sock);
	pgm_assert (NULL != skb);
	pgm_assert_cmpuint (skb->pgm_header->pgm_dport, ==, sock->tsi.sport);

	pgm_debug ("on_upstream (sock:%p skb:%p)",
		(const void*)sock, (const void*)skb);

	if (PGM_UNLIKELY(!sock->can_send_data)) {
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet for muted source."));
		goto out_discarded;
	}

/* unicast upstream message, note that dport & sport are reversed */
	if (PGM_UNLIKELY(skb->pgm_header->pgm_sport != sock->dport)) {
/* its upstream/peer-to-peer for another session */
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet on data-destination port mismatch."));
		goto out_discarded;
	}

	if (PGM_UNLIKELY(!pgm_gsi_equal (&skb->tsi.gsi, &sock->tsi.gsi))) {
/* its upstream/peer-to-peer for another session */
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet on data-destination port mismatch."));
		goto out_discarded;
	}

/* advance SKB pointer to PGM type header */
	skb->data	= (char*)skb->data + sizeof(struct pgm_header);
	skb->len       -= sizeof(struct pgm_header);

	switch (skb->pgm_header->pgm_type) {
	case PGM_NAK:
		if (PGM_UNLIKELY(!pgm_on_nak (sock, skb)))
			goto out_discarded;
		break;

	case PGM_NNAK:
		if (PGM_UNLIKELY(!pgm_on_nnak (sock, skb)))
			goto out_discarded;
		break;

	case PGM_SPMR:
		if (PGM_UNLIKELY(!pgm_on_spmr (sock, NULL, skb)))
			goto out_discarded;
		break;

	case PGM_ACK:
		if (PGM_UNLIKELY(!pgm_on_ack (sock, skb)))
			goto out_discarded;
		break;

	case PGM_POLR:
	default:
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded unsupported PGM type packet."));
		goto out_discarded;
	}

	return TRUE;
out_discarded:
	sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED]++;
	return FALSE;
}

/* peer to peer message, either multicast NAK or multicast SPMR.
 *
 * returns TRUE on valid processed packet, returns FALSE on discarded packet.
 */

static
bool
on_peer (
	pgm_sock_t*           const restrict sock,
	struct pgm_sk_buff_t* const restrict skb,
	pgm_peer_t**		    restrict source
	)
{
/* pre-conditions */
	pgm_assert (NULL != sock);
	pgm_assert (NULL != skb);
	pgm_assert_cmpuint (skb->pgm_header->pgm_dport, !=, sock->tsi.sport);
	pgm_assert (NULL != source);

	pgm_debug ("on_peer (sock:%p skb:%p source:%p)",
		(const void*)sock, (const void*)skb, (const void*)source);

/* we are not the source */
	if (PGM_UNLIKELY(!sock->can_recv_data)) {
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet for muted receiver."));
		goto out_discarded;
	}

/* unicast upstream message, note that dport & sport are reversed */
	if (PGM_UNLIKELY(skb->pgm_header->pgm_sport != sock->dport)) {
/* its upstream/peer-to-peer for another session */
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet on data-destination port mismatch."));
		goto out_discarded;
	}

/* check to see the source this peer-to-peer message is about is in our peer list */
	pgm_tsi_t upstream_tsi;
	memcpy (&upstream_tsi.gsi, &skb->tsi.gsi, sizeof(pgm_gsi_t));
	upstream_tsi.sport = skb->pgm_header->pgm_dport;

	pgm_rwlock_reader_lock (&sock->peers_lock);
	*source = pgm_hashtable_lookup (sock->peers_hashtable, &upstream_tsi);
	pgm_rwlock_reader_unlock (&sock->peers_lock);
	if (PGM_UNLIKELY(NULL == *source)) {
/* this source is unknown, we don't care about messages about it */
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded peer packet about new source."));
		goto out_discarded;
	}

/* advance SKB pointer to PGM type header */
	skb->data	= (char*)skb->data + sizeof(struct pgm_header);
	skb->len       -= sizeof(struct pgm_header);

	switch (skb->pgm_header->pgm_type) {
	case PGM_NAK:
		if (PGM_UNLIKELY(!pgm_on_peer_nak (sock, *source, skb)))
			goto out_discarded;
		break;

	case PGM_SPMR:
		if (PGM_UNLIKELY(!pgm_on_spmr (sock, *source, skb)))
			goto out_discarded;
		break;

	case PGM_NNAK:
	case PGM_POLR:
	default:
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded unsupported PGM type packet."));
		goto out_discarded;
	}

	return TRUE;
out_discarded:
	if (*source)
		(*source)->cumulative_stats[PGM_PC_RECEIVER_PACKETS_DISCARDED]++;
	else if (sock->can_send_data)
		sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED]++;
	return FALSE;
}

/* source to receiver message
 *
 * returns TRUE on valid processed packet, returns FALSE on discarded packet.
 */

static
bool
on_downstream (
	pgm_sock_t*           const restrict sock,
	struct pgm_sk_buff_t* const restrict skb,
	struct sockaddr*      const restrict src_addr,
	struct sockaddr*      const restrict dst_addr,
	pgm_peer_t**	  	    restrict source
	)
{
/* pre-conditions */
	pgm_assert (NULL != sock);
	pgm_assert (NULL != skb);
	pgm_assert (NULL != src_addr);
	pgm_assert (NULL != dst_addr);
	pgm_assert (NULL != source);

#ifdef RECV_DEBUG
	char saddr[INET6_ADDRSTRLEN], daddr[INET6_ADDRSTRLEN];
	pgm_sockaddr_ntop (src_addr, saddr, sizeof(saddr));
	pgm_sockaddr_ntop (dst_addr, daddr, sizeof(daddr));
	pgm_debug ("on_downstream (sock:%p skb:%p src-addr:%s dst-addr:%s source:%p)",
		(const void*)sock, (const void*)skb, saddr, daddr, (const void*)source);
#endif

	if (PGM_UNLIKELY(!sock->can_recv_data)) {
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet for muted receiver."));
		goto out_discarded;
	}

/* pgm packet DPORT contains our sock DPORT */
	if (PGM_UNLIKELY(skb->pgm_header->pgm_dport != sock->dport)) {
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded packet on data-destination port mismatch."));
		goto out_discarded;
	}

/* search for TSI peer context or create a new one */
	if (PGM_LIKELY(pgm_tsi_hash (&skb->tsi) == sock->last_hash_key &&
			NULL != sock->last_hash_value))
	{
		*source = sock->last_hash_value;
	}
	else
	{
		pgm_rwlock_reader_lock (&sock->peers_lock);
		*source = pgm_hashtable_lookup_extended (sock->peers_hashtable, &skb->tsi, &sock->last_hash_key);
		pgm_rwlock_reader_unlock (&sock->peers_lock);
		if (PGM_UNLIKELY(NULL == *source)) {
			*source = pgm_new_peer (sock,
					       &skb->tsi,
					       (struct sockaddr*)src_addr, pgm_sockaddr_len(src_addr),
					       (struct sockaddr*)dst_addr, pgm_sockaddr_len(dst_addr),
						skb->tstamp);
		}
		sock->last_hash_value = *source;
	}

	(*source)->cumulative_stats[PGM_PC_RECEIVER_BYTES_RECEIVED] += skb->len;
	(*source)->last_packet = skb->tstamp;

	skb->data       = (void*)( skb->pgm_header + 1 );
	skb->len       -= sizeof(struct pgm_header);

/* handle PGM packet type */
	switch (skb->pgm_header->pgm_type) {
	case PGM_ODATA:
	case PGM_RDATA:
		if (PGM_UNLIKELY(!pgm_on_data (sock, *source, skb)))
			goto out_discarded;
		sock->rx_buffer = pgm_alloc_skb (sock->max_tpdu);
		break;

	case PGM_NCF:
		if (PGM_UNLIKELY(!pgm_on_ncf (sock, *source, skb)))
			goto out_discarded;
		break;

	case PGM_SPM:
		if (PGM_UNLIKELY(!pgm_on_spm (sock, *source, skb)))
			goto out_discarded;

/* update group NLA if appropriate */
		if (PGM_LIKELY(pgm_sockaddr_is_addr_multicast ((struct sockaddr*)dst_addr)))
			memcpy (&(*source)->group_nla, dst_addr, pgm_sockaddr_len(dst_addr));
		break;

#ifdef CONFIG_PGM_POLLING
	case PGM_POLL:
		if (PGM_UNLIKELY(!pgm_on_poll (sock, *source, skb)))
			goto out_discarded;
		break;
#endif

	default:
		pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded unsupported PGM type packet."));
		goto out_discarded;
	}

	return TRUE;
out_discarded:
	if (*source)
		(*source)->cumulative_stats[PGM_PC_RECEIVER_PACKETS_DISCARDED]++;
	else if (sock->can_send_data)
		sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED]++;
	return FALSE;
}

/* process a pgm packet
 *
 * returns TRUE on valid processed packet, returns FALSE on discarded packet.
 */
static
bool
on_pgm (
	pgm_sock_t*           const restrict sock,
	struct pgm_sk_buff_t* const restrict skb,
	struct sockaddr*      const restrict src_addr,
	struct sockaddr*      const restrict dst_addr,
	pgm_peer_t**		    restrict source
	)
{
/* pre-conditions */
	pgm_assert (NULL != sock);
	pgm_assert (NULL != skb);
	pgm_assert (NULL != src_addr);
	pgm_assert (NULL != dst_addr);
	pgm_assert (NULL != source);

#ifdef RECV_DEBUG
	char saddr[INET6_ADDRSTRLEN], daddr[INET6_ADDRSTRLEN];
	pgm_sockaddr_ntop (src_addr, saddr, sizeof(saddr));
	pgm_sockaddr_ntop (dst_addr, daddr, sizeof(daddr));
	pgm_debug ("on_pgm (sock:%p skb:%p src-addr:%s dst-addr:%s source:%p)",
		(const void*)sock, (const void*)skb, saddr, daddr, (const void*)source);
#endif

	if (PGM_IS_DOWNSTREAM (skb->pgm_header->pgm_type))
		return on_downstream (sock, skb, src_addr, dst_addr, source);
	if (skb->pgm_header->pgm_dport == sock->tsi.sport)
	{
		if (PGM_IS_UPSTREAM (skb->pgm_header->pgm_type) ||
		    PGM_IS_PEER (skb->pgm_header->pgm_type))
		{
			return on_upstream (sock, skb);
		}
	}
	else if (PGM_IS_PEER (skb->pgm_header->pgm_type))
		return on_peer (sock, skb, source);

	pgm_trace (PGM_LOG_ROLE_NETWORK,_("Discarded unknown PGM packet."));
	if (sock->can_send_data)
		sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED]++;
	return FALSE;
}

/* block on receiving socket whilst holding sock::waiting-mutex
 * returns EAGAIN for waiting data, returns EINTR for waiting timer event,
 * returns ENOENT on closed sock, and returns EFAULT for libc error.
 */

static
int
wait_for_event (
	pgm_sock_t* const	sock
	)
{
	int n_fds = 3;

/* pre-conditions */
	pgm_assert (NULL != sock);

	pgm_debug ("wait_for_event (sock:%p)", (const void*)sock);

	do {
		if (PGM_UNLIKELY(sock->is_destroyed))
			return ENOENT;

		if (sock->can_send_data && !pgm_txw_retransmit_is_empty (sock->window))
/* tight loop on blocked send */
			pgm_on_deferred_nak (sock);

#ifdef CONFIG_HAVE_POLL
		struct pollfd fds[ n_fds ];
		memset (fds, 0, sizeof(fds));
		const int status = pgm_poll_info (sock, fds, &n_fds, POLLIN);
		pgm_assert (-1 != status);
#else
		fd_set readfds;
		FD_ZERO(&readfds);
		const int status = pgm_select_info (sock, &readfds, NULL, &n_fds);
		pgm_assert (-1 != status);
#endif /* CONFIG_HAVE_POLL */

/* flush any waiting notifications */
		if (sock->is_pending_read) {
			pgm_notify_clear (&sock->pending_notify);
			sock->is_pending_read = FALSE;
		}

		int timeout;
		if (sock->can_send_data && !pgm_txw_retransmit_is_empty (sock->window))
			timeout = 0;
		else
			timeout = (int)pgm_timer_expiration (sock);
		
#ifdef CONFIG_HAVE_POLL
		const int ready = poll (fds, n_fds, timeout /* μs */ / 1000 /* to ms */);
#else
		struct timeval tv_timeout = {
			.tv_sec		= timeout > 1000000L ? (timeout / 1000000L) : 0,
			.tv_usec	= timeout > 1000000L ? (timeout % 1000000L) : timeout
		};
		const int ready = select (n_fds, &readfds, NULL, NULL, &tv_timeout);
#endif
		if (PGM_UNLIKELY(SOCKET_ERROR == ready)) {
			pgm_debug ("block returned errno=%i",errno);
			return EFAULT;
		} else if (ready > 0) {
			pgm_debug ("recv again on empty");
			return EAGAIN;
		}
	} while (pgm_timer_check (sock));
	pgm_debug ("state generated event");
	return EINTR;
}

/* data incoming on receive sockets, can be from a sender or receiver, or simply bogus.
 * for IPv4 we receive the IP header to handle fragmentation, for IPv6 we cannot, but the
 * underlying stack handles this for us.
 *
 * recvmsgv reads a vector of apdus each contained in a IO scatter/gather array.
 *
 * can be called due to event from incoming socket(s) or timer induced data loss.
 *
 * On success, returns PGM_IO_STATUS_NORMAL and saves the count of bytes read
 * into _bytes_read.  With non-blocking sockets a block returns
 * PGM_IO_STATUS_WOULD_BLOCK.  When rate limited sending repair data, returns
 * PGM_IO_STATUS_RATE_LIMITED and caller should wait.  During recovery state,
 * returns PGM_IO_STATUS_TIMER_PENDING and caller should also wait.  On
 * unrecoverable dataloss, returns PGM_IO_STATUS_CONN_RESET.  If connection is
 * closed, returns PGM_IO_STATUS_EOF.  On error, returns PGM_IO_STATUS_ERROR.
 */

int
pgm_recvmsgv (
	pgm_sock_t*   	   const restrict sock,
	struct pgm_msgv_t* const restrict msg_start,
	const size_t			  msg_len,
	const int			  flags,	/* MSG_DONTWAIT for non-blocking */
	size_t*			 restrict _bytes_read,	/* may be NULL */
	pgm_error_t**		 restrict error
	)
{
	int status = PGM_IO_STATUS_WOULD_BLOCK;

	pgm_debug ("pgm_recvmsgv (sock:%p msg-start:%p msg-len:%" PRIzu " flags:%d bytes-read:%p error:%p)",
		(void*)sock, (void*)msg_start, msg_len, flags, (void*)_bytes_read, (void*)error);

/* parameters */
	pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR);
	if (PGM_LIKELY(msg_len)) pgm_return_val_if_fail (NULL != msg_start, PGM_IO_STATUS_ERROR);

/* shutdown */
	if (PGM_UNLIKELY(!pgm_rwlock_reader_trylock (&sock->lock)))
		pgm_return_val_if_reached (PGM_IO_STATUS_ERROR);

/* state */
	if (PGM_UNLIKELY(!sock->is_bound || sock->is_destroyed))
	{
		pgm_rwlock_reader_unlock (&sock->lock);
		pgm_return_val_if_reached (PGM_IO_STATUS_ERROR);
	}

/* pre-conditions */
	pgm_assert (NULL != sock->rx_buffer);
	pgm_assert (sock->max_tpdu > 0);
	if (sock->can_recv_data) {
		pgm_assert (NULL != sock->peers_hashtable);
		pgm_assert_cmpuint (sock->nak_bo_ivl, >, 1);
		pgm_assert (pgm_notify_is_valid (&sock->pending_notify));
	}

/* receiver */
	pgm_mutex_lock (&sock->receiver_mutex);

	if (PGM_UNLIKELY(sock->is_reset)) {
		pgm_assert (NULL != sock->peers_pending);
		pgm_assert (NULL != sock->peers_pending->data);
		pgm_peer_t* peer = sock->peers_pending->data;
		if (flags & MSG_ERRQUEUE)
			pgm_set_reset_error (sock, peer, msg_start);
		else if (error) {
			char tsi[PGM_TSISTRLEN];
			pgm_tsi_print_r (&peer->tsi, tsi, sizeof(tsi));
			pgm_set_error (error,
				     PGM_ERROR_DOMAIN_RECV,
				     PGM_ERROR_CONNRESET,
				     _("Transport has been reset on unrecoverable loss from %s."),
				     tsi);
		}
		if (!sock->is_abort_on_reset)
			sock->is_reset = !sock->is_reset;
		pgm_mutex_unlock (&sock->receiver_mutex);
		pgm_rwlock_reader_unlock (&sock->lock);
		return PGM_IO_STATUS_RESET;
	}

/* timer status */
	if (pgm_timer_check (sock) &&
	    !pgm_timer_dispatch (sock))
	{
/* block on send-in-recv */
		status = PGM_IO_STATUS_RATE_LIMITED;
	}
/* NAK status */
	else if (sock->can_send_data)
	{
		if (!pgm_txw_retransmit_is_empty (sock->window))
		{
			if (!pgm_on_deferred_nak (sock))
				status = PGM_IO_STATUS_RATE_LIMITED;
		}
		else
			pgm_notify_clear (&sock->rdata_notify);
	}

	size_t bytes_read = 0;
	unsigned data_read = 0;
	struct pgm_msgv_t* pmsg = msg_start;
	const struct pgm_msgv_t* msg_end = msg_start + msg_len - 1;

	if (PGM_UNLIKELY(0 == ++(sock->last_commit)))
		++(sock->last_commit);

	/* second, flush any remaining contiguous messages from previous call(s) */
	if (sock->peers_pending) {
		if (0 != pgm_flush_peers_pending (sock, &pmsg, msg_end, &bytes_read, &data_read))
			goto out;
/* returns on: reset or full buffer */
	}

/* read the data:
 *
 * We cannot actually block here as packets pushed by the timers need to be addressed too.
 */
	struct sockaddr_storage src, dst;
	ssize_t len;
	size_t bytes_received = 0;

recv_again:

	len = recvskb (sock,
		       sock->rx_buffer,		/* PGM skbuff */
		       0,
		       (struct sockaddr*)&src,
		       sizeof(src),
		       (struct sockaddr*)&dst,
		       sizeof(dst));
	if (len < 0)
	{
		const int save_errno = pgm_get_last_sock_error();
		char errbuf[1024];
		if (PGM_LIKELY(PGM_SOCK_EAGAIN == save_errno)) {
			goto check_for_repeat;
		}
		status = PGM_IO_STATUS_ERROR;
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_RECV,
			     pgm_error_from_sock_errno (save_errno),
			     _("Transport socket error: %s"),
			     pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno));
		goto out;
	}
	else if (0 == len)
	{
/* cannot return NORMAL/0 as that is valid payload with SKB */
		status = PGM_IO_STATUS_EOF;
		goto out;
	}
	else
	{
		bytes_received += len;
	}

	pgm_error_t* err = NULL;
	const bool is_valid = (sock->udp_encap_ucast_port || AF_INET6 == src.ss_family) ?
					pgm_parse_udp_encap (sock->rx_buffer, &err) :
					pgm_parse_raw (sock->rx_buffer, (struct sockaddr*)&dst, &err);
	if (PGM_UNLIKELY(!is_valid))
	{
/* inherently cannot determine PGM_PC_RECEIVER_CKSUM_ERRORS unless only one receiver */
		pgm_trace (PGM_LOG_ROLE_NETWORK,
				_("Discarded invalid packet: %s"),
				(err && err->message) ? err->message : "(null)");
		pgm_error_free (err);
		if (sock->can_send_data) {
			if (err && PGM_ERROR_CKSUM == err->code)
				sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS]++;
			sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED]++;
		}
		goto recv_again;
	}

	pgm_peer_t* source = NULL;
	if (PGM_UNLIKELY(!on_pgm (sock, sock->rx_buffer, (struct sockaddr*)&src, (struct sockaddr*)&dst, &source)))
		goto recv_again;

/* check whether this source has waiting data */
	if (source && pgm_peer_has_pending (source)) {
		pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("New pending data."));
		pgm_peer_set_pending (sock, source);
	}

flush_pending:
/* flush any congtiguous packets generated by the receipt of this packet */
	if (sock->peers_pending)
	{
		if (0 != pgm_flush_peers_pending (sock, &pmsg, msg_end, &bytes_read, &data_read))
		{
/* recv vector is now full */
			goto out;
		}
	}

check_for_repeat:
/* repeat if non-blocking and not full */
	if (sock->is_nonblocking ||
	    flags & MSG_DONTWAIT)
	{
		if (len > 0 && pmsg <= msg_end) {
			pgm_trace (PGM_LOG_ROLE_NETWORK,_("Recv again on not-full"));
			goto recv_again;		/* \:D/ */
		}
	}
	else
	{
/* repeat if blocking and empty, i.e. received non data packet.
 */
		if (0 == data_read) {
			const int wait_status = wait_for_event (sock);
			switch (wait_status) {
			case EAGAIN:
				goto recv_again;
			case EINTR:
				if (!pgm_timer_dispatch (sock))
					goto check_for_repeat;
				goto flush_pending;
			case ENOENT:
				pgm_mutex_unlock (&sock->receiver_mutex);
				pgm_rwlock_reader_unlock (&sock->lock);
				return PGM_IO_STATUS_EOF;
			case EFAULT: {
				const int save_errno = pgm_get_last_sock_error();
				char errbuf[1024];
				pgm_set_error (error,
						PGM_ERROR_DOMAIN_RECV,
						pgm_error_from_sock_errno (save_errno),
						_("Waiting for event: %s"),
						pgm_sock_strerror_s (errbuf, sizeof (errbuf), save_errno)
						);
				pgm_mutex_unlock (&sock->receiver_mutex);
				pgm_rwlock_reader_unlock (&sock->lock);
				return PGM_IO_STATUS_ERROR;
			}
			default:
				pgm_assert_not_reached();
			}
		}
	}

out:
	if (0 == data_read)
	{
/* clear event notification */
		if (sock->is_pending_read) {
			pgm_notify_clear (&sock->pending_notify);
			sock->is_pending_read = FALSE;
		}
/* report data loss */
		if (PGM_UNLIKELY(sock->is_reset)) {
			pgm_assert (NULL != sock->peers_pending);
			pgm_assert (NULL != sock->peers_pending->data);
			pgm_peer_t* peer = sock->peers_pending->data;
			if (flags & MSG_ERRQUEUE)
				pgm_set_reset_error (sock, peer, msg_start);
			else if (error) {
				char tsi[PGM_TSISTRLEN];
				pgm_tsi_print_r (&peer->tsi, tsi, sizeof(tsi));
				pgm_set_error (error,
					     PGM_ERROR_DOMAIN_RECV,
					     PGM_ERROR_CONNRESET,
					     _("Transport has been reset on unrecoverable loss from %s."),
					     tsi);
			}
			if (!sock->is_abort_on_reset)
				sock->is_reset = !sock->is_reset;
			pgm_mutex_unlock (&sock->receiver_mutex);
			pgm_rwlock_reader_unlock (&sock->lock);
			return PGM_IO_STATUS_RESET;
		}
		pgm_mutex_unlock (&sock->receiver_mutex);
		pgm_rwlock_reader_unlock (&sock->lock);
		if (PGM_IO_STATUS_WOULD_BLOCK == status &&
		    ( sock->can_send_data ||
		      ( sock->can_recv_data && NULL != sock->peers_list )))
		{
			status = PGM_IO_STATUS_TIMER_PENDING;
		}
		return status;
	}

	if (sock->peers_pending)
	{
/* set event notification for additional available data */
		if (sock->is_pending_read && sock->is_edge_triggered_recv)
		{
/* empty pending-pipe */
			pgm_notify_clear (&sock->pending_notify);
			sock->is_pending_read = FALSE;
		}
		else if (!sock->is_pending_read && !sock->is_edge_triggered_recv)
		{
/* fill pending-pipe */
			pgm_notify_send (&sock->pending_notify);
			sock->is_pending_read = TRUE;
		}
	}

	if (NULL != _bytes_read)
		*_bytes_read = bytes_read;
	pgm_mutex_unlock (&sock->receiver_mutex);
	pgm_rwlock_reader_unlock (&sock->lock);
	return PGM_IO_STATUS_NORMAL;
}

/* read one contiguous apdu and return as a IO scatter/gather array.  msgv is owned by
 * the caller, tpdu contents are owned by the receive window.
 *
 * on success, returns PGM_IO_STATUS_NORMAL.
 */

int
pgm_recvmsg (
	pgm_sock_t*   	   const restrict sock,
	struct pgm_msgv_t* const restrict msgv,
	const int			  flags,	/* MSG_DONTWAIT for non-blocking */
	size_t*			 restrict bytes_read,	/* may be NULL */
	pgm_error_t**		 restrict error
	)
{
	pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR);
	pgm_return_val_if_fail (NULL != msgv, PGM_IO_STATUS_ERROR);

	pgm_debug ("pgm_recvmsg (sock:%p msgv:%p flags:%d bytes_read:%p error:%p)",
		(const void*)sock, (const void*)msgv, flags, (const void*)bytes_read, (const void*)error);

	return pgm_recvmsgv (sock, msgv, 1, flags, bytes_read, error);
}

/* vanilla read function.  copies from the receive window to the provided buffer
 * location.  the caller must provide an adequately sized buffer to store the largest
 * expected apdu or else it will be truncated.
 *
 * on success, returns PGM_IO_STATUS_NORMAL.
 */

int
pgm_recvfrom (
	pgm_sock_t*	 const restrict sock,
	void*			  restrict buf,
	const size_t			   buflen,
	const int			   flags,		/* MSG_DONTWAIT for non-blocking */
	size_t*			  restrict _bytes_read,	/* may be NULL */
	struct pgm_sockaddr_t*	  restrict from,		/* may be NULL */
	socklen_t*		  restrict fromlen,
	pgm_error_t**		  restrict error
	)
{
	struct pgm_msgv_t msgv;
	size_t bytes_read = 0;

	pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR);
	if (PGM_LIKELY(buflen)) pgm_return_val_if_fail (NULL != buf, PGM_IO_STATUS_ERROR);
	if (fromlen) {
		pgm_return_val_if_fail (NULL != from, PGM_IO_STATUS_ERROR);
		pgm_return_val_if_fail (sizeof (struct pgm_sockaddr_t) == *fromlen, PGM_IO_STATUS_ERROR);
	}

	pgm_debug ("pgm_recvfrom (sock:%p buf:%p buflen:%" PRIzu " flags:%d bytes-read:%p from:%p from:%p error:%p)",
		(const void*)sock, buf, buflen, flags, (const void*)_bytes_read, (const void*)from, (const void*)fromlen, (const void*)error);

	const int status = pgm_recvmsg (sock, &msgv, flags & ~(MSG_ERRQUEUE), &bytes_read, error);
	if (PGM_IO_STATUS_NORMAL != status)
		return status;

	size_t bytes_copied = 0;
	struct pgm_sk_buff_t** skb = msgv.msgv_skb;
	struct pgm_sk_buff_t* pskb = *skb;

	if (from) {
		from->sa_port = ntohs (sock->dport);
		from->sa_addr.sport = ntohs (pskb->tsi.sport);
		memcpy (&from->sa_addr.gsi, &pskb->tsi.gsi, sizeof(pgm_gsi_t));
	}

	while (bytes_copied < bytes_read) {
		size_t copy_len = pskb->len;
		if (bytes_copied + copy_len > buflen) {
			pgm_warn (_("APDU truncated, original length %" PRIzu " bytes."),
				bytes_read);
			copy_len = buflen - bytes_copied;
			bytes_read = buflen;
		}
		memcpy ((char*)buf + bytes_copied, pskb->data, copy_len);
		bytes_copied += copy_len;
		pskb = *(++skb);
	}
	if (_bytes_read)
		*_bytes_read = bytes_copied;
	return PGM_IO_STATUS_NORMAL;
}

/* Basic recv operation, copying data from window to application.
 *
 * on success, returns PGM_IO_STATUS_NORMAL.
 */

int
pgm_recv (
	pgm_sock_t* const restrict sock,
	void*		  restrict buf,
	const size_t		   buflen,
	const int		   flags,	/* MSG_DONTWAIT for non-blocking */
	size_t*	    const restrict bytes_read,	/* may be NULL */
	pgm_error_t**     restrict error
	)
{
	pgm_return_val_if_fail (NULL != sock, PGM_IO_STATUS_ERROR);
	if (PGM_LIKELY(buflen)) pgm_return_val_if_fail (NULL != buf, PGM_IO_STATUS_ERROR);

	pgm_debug ("pgm_recv (sock:%p buf:%p buflen:%" PRIzu " flags:%d bytes-read:%p error:%p)",
		(const void*)sock, buf, buflen, flags, (const void*)bytes_read, (const void*)error);

	return pgm_recvfrom (sock, buf, buflen, flags, bytes_read, NULL, NULL, error);
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/wsastrerror.c0000644000175000017500000002612511640407354020312 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Winsock Error strings.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 

#ifdef _WIN32
#	include 


char*
pgm_wsastrerror (
	const int	wsa_errno
	)
{
	switch (wsa_errno) {
#ifdef WSA_INVALID_HANDLE
	case WSA_INVALID_HANDLE: return _("Specified event object handle is invalid.");
#endif
#ifdef WSA_NOT_ENOUGH_MEMORY
	case WSA_NOT_ENOUGH_MEMORY: return _("Insufficient memory available.");
#endif
#ifdef WSA_INVALID_PARAMETER
	case WSA_INVALID_PARAMETER: return _("One or more parameters are invalid.");
#endif
#ifdef WSA_OPERATION_ABORTED
	case WSA_OPERATION_ABORTED: return _("Overlapped operation aborted.");
#endif
#ifdef WSA_IO_INCOMPLETE
	case WSA_IO_INCOMPLETE: return _("Overlapped I/O event object not in signaled state.");
#endif
#ifdef WSA_IO_PENDING
	case WSA_IO_PENDING: return _("Overlapped operations will complete later.");
#endif
#ifdef WSAEINTR
	case WSAEINTR: return _("Interrupted function call.");
#endif
#ifdef WSAEBADF
	case WSAEBADF: return _("File handle is not valid.");
#endif
#ifdef WSAEACCES
	case WSAEACCES: return _("Permission denied.");
#endif
#ifdef WSAEFAULT
	case WSAEFAULT: return _("Bad address.");
#endif
#ifdef WSAEINVAL
	case WSAEINVAL: return _("Invalid argument.");
#endif
#ifdef WSAEMFILE
	case WSAEMFILE: return _("Too many open files.");
#endif
#ifdef WSAEWOULDBLOCK
	case WSAEWOULDBLOCK: return _("Resource temporarily unavailable.");
#endif
#ifdef WSAEINPROGRESS
	case WSAEINPROGRESS: return _("Operation now in progress.");
#endif
#ifdef WSAEALREADY
	case WSAEALREADY: return _("Operation already in progress.");
#endif
#ifdef WSAENOTSOCK
	case WSAENOTSOCK: return _("Socket operation on nonsocket.");
#endif
#ifdef WSAEDESTADDRREQ
	case WSAEDESTADDRREQ: return _("Destination address required.");
#endif
#ifdef WSAEMSGSIZE
	case WSAEMSGSIZE: return _("Message too long.");
#endif
#ifdef WSAEPROTOTYPE
	case WSAEPROTOTYPE: return _("Protocol wrong type for socket.");
#endif
#ifdef WSAENOPROTOOPT
	case WSAENOPROTOOPT: return _("Bad protocol option.");
#endif
#ifdef WSAEPROTONOSUPPORT
	case WSAEPROTONOSUPPORT: return _("Protocol not supported.");
#endif
#ifdef WSAESOCKTNOSUPPORT
	case WSAESOCKTNOSUPPORT: return _("Socket type not supported.");
#endif
#ifdef WSAEOPNOTSUPP
	case WSAEOPNOTSUPP: return _("Operation not supported.");
#endif
#ifdef WSAEPFNOSUPPORT
	case WSAEPFNOSUPPORT: return _("Protocol family not supported.");
#endif
#ifdef WSAEAFNOSUPPORT
	case WSAEAFNOSUPPORT: return _("Address family not supported by protocol family.");
#endif
#ifdef WSAEADDRINUSE
	case WSAEADDRINUSE: return _("Address already in use.");
#endif
#ifdef WSAEADDRNOTAVAIL
	case WSAEADDRNOTAVAIL: return _("Cannot assign requested address.");
#endif
#ifdef WSAENETDOWN
	case WSAENETDOWN: return _("Network is down.");
#endif
#ifdef WSAENETUNREACH
	case WSAENETUNREACH: return _("Network is unreachable.");
#endif
#ifdef WSAENETRESET
	case WSAENETRESET: return _("Network dropped connection on reset.");
#endif
#ifdef WSAECONNABORTED
	case WSAECONNABORTED: return _("Software caused connection abort.");
#endif
#ifdef WSAECONNRESET
	case WSAECONNRESET: return _("Connection reset by peer.");
#endif
#ifdef WSAENOBUFS
	case WSAENOBUFS: return _("No buffer space available.");
#endif
#ifdef WSAEISCONN
	case WSAEISCONN: return _("Socket is already connected.");
#endif
#ifdef WSAENOTCONN
	case WSAENOTCONN: return _("Socket is not connected.");
#endif
#ifdef WSAESHUTDOWN
	case WSAESHUTDOWN: return _("Cannot send after socket shutdown.");
#endif
#ifdef WSAETOOMANYREFS
	case WSAETOOMANYREFS: return _("Too many references.");
#endif
#ifdef WSAETIMEDOUT
	case WSAETIMEDOUT: return _("Connection timed out.");
#endif
#ifdef WSAECONNREFUSED
	case WSAECONNREFUSED: return _("Connection refused.");
#endif
#ifdef WSAELOOP
	case WSAELOOP: return _("Cannot translate name.");
#endif
#ifdef WSAENAMETOOLONG
	case WSAENAMETOOLONG: return _("Name too long.");
#endif
#ifdef WSAEHOSTDOWN
	case WSAEHOSTDOWN: return _("Host is down.");
#endif
#ifdef WSAEHOSTUNREACH
	case WSAEHOSTUNREACH: return _("No route to host.");
#endif
#ifdef WSAENOTEMPTY
	case WSAENOTEMPTY: return _("Directory not empty.");
#endif
#ifdef WSAEPROCLIM
	case WSAEPROCLIM: return _("Too many processes.");
#endif
#ifdef WSAEUSERS
	case WSAEUSERS: return _("User quota exceeded.");
#endif
#ifdef WSAEDQUOT
	case WSAEDQUOT: return _("Disk quota exceeded.");
#endif
#ifdef WSAESTALE
	case WSAESTALE: return _("Stale file handle reference.");
#endif
#ifdef WSAEREMOTE
	case WSAEREMOTE: return _("Item is remote.");
#endif
#ifdef WSASYSNOTREADY
	case WSASYSNOTREADY: return _("Network subsystem is unavailable.");
#endif
#ifdef WSAVERNOTSUPPORTED
	case WSAVERNOTSUPPORTED: return _("Winsock.dll version out of range.");
#endif
#ifdef WSANOTINITIALISED
	case WSANOTINITIALISED: return _("Successful WSAStartup not yet performed.");
#endif
#ifdef WSAEDISCON
	case WSAEDISCON: return _("Graceful shutdown in progress.");
#endif
#ifdef WSAENOMORE
	case WSAENOMORE: return _("No more results.");
#endif
#ifdef WSAECANCELLED
	case WSAECANCELLED: return _("Call has been canceled.");
#endif
#ifdef WSAEINVALIDPROCTABLE
	case WSAEINVALIDPROCTABLE: return _("Procedure call table is invalid.");
#endif
#ifdef WSAEINVALIDPROVIDER
	case WSAEINVALIDPROVIDER: return _("Service provider is invalid.");
#endif
#ifdef WSAEPROVIDERFAILEDINIT
	case WSAEPROVIDERFAILEDINIT: return _("Service provider failed to initialize.");
#endif
#ifdef WSASYSCALLFAILURE
	case WSASYSCALLFAILURE: return _("System call failure.");
#endif
#ifdef WSASERVICE_NOT_FOUND
	case WSASERVICE_NOT_FOUND: return _("Service not found.");
#endif
#ifdef WSATYPE_NOT_FOUND
	case WSATYPE_NOT_FOUND: return _("Class type not found.");
#endif
#ifdef WSA_E_NO_MORE
	case WSA_E_NO_MORE: return _("No more results.");
#endif
#ifdef WSA_E_CANCELLED
	case WSA_E_CANCELLED: return _("Call was canceled.");
#endif
#ifdef WSAEREFUSED
	case WSAEREFUSED: return _("Database query was refused.");
#endif
#ifdef WSAHOST_NOT_FOUND
	case WSAHOST_NOT_FOUND: return _("Host not found.");
#endif
#ifdef WSATRY_AGAIN
	case WSATRY_AGAIN: return _("Nonauthoritative host not found.");
#endif
#ifdef WSANO_RECOVERY
	case WSANO_RECOVERY: return _("This is a nonrecoverable error.");
#endif
#ifdef WSANO_DATA
	case WSANO_DATA: return _("Valid name, no data record of requested type.");
#endif
#ifdef WSA_QOS_RECEIVERS
	case WSA_QOS_RECEIVERS: return _("QOS receivers.");
#endif
#ifdef WSA_QOS_SENDERS
	case WSA_QOS_SENDERS: return _("QOS senders.");
#endif
#ifdef WSA_QOS_NO_SENDERS
	case WSA_QOS_NO_SENDERS: return _("No QOS senders.");
#endif
#ifdef WSA_QOS_NO_RECEIVERS
	case WSA_QOS_NO_RECEIVERS: return _("QOS no receivers.");
#endif
#ifdef WSA_QOS_REQUEST_CONFIRMED
	case WSA_QOS_REQUEST_CONFIRMED: return _("QOS request confirmed.");
#endif
#ifdef WSA_QOS_ADMISSION_FAILURE
	case WSA_QOS_ADMISSION_FAILURE: return _("QOS admission error.");
#endif
#ifdef WSA_QOS_POLICY_FAILURE
	case WSA_QOS_POLICY_FAILURE: return _("QOS policy failure.");
#endif
#ifdef WSA_QOS_BAD_STYLE
	case WSA_QOS_BAD_STYLE: return _("QOS bad style.");
#endif
#ifdef WSA_QOS_BAD_OBJECT
	case WSA_QOS_BAD_OBJECT: return _("QOS bad object.");
#endif
#ifdef WSA_QOS_TRAFFIC_CTRL_ERROR
	case WSA_QOS_TRAFFIC_CTRL_ERROR: return _("QOS traffic control error.");
#endif
#ifdef WSA_QOS_GENERIC_ERROR
	case WSA_QOS_GENERIC_ERROR: return _("QOS generic error.");
#endif
#ifdef WSA_QOS_ESERVICETYPE
	case WSA_QOS_ESERVICETYPE: return _("QOS service type error.");
#endif
#ifdef WSA_QOS_EFLOWSPEC
	case WSA_QOS_EFLOWSPEC: return _("QOS flowspec error.");
#endif
#ifdef WSA_QOS_EPROVSPECBUF
	case WSA_QOS_EPROVSPECBUF: return _("Invalid QOS provider buffer.");
#endif
#ifdef WSA_QOS_EFILTERSTYLE
	case WSA_QOS_EFILTERSTYLE: return _("Invalid QOS filter style.");
#endif
#ifdef WSA_QOS_EFILTERTYPE
	case WSA_QOS_EFILTERTYPE: return _("Invalid QOS filter type.");
#endif
#ifdef WSA_QOS_EFILTERCOUNT
	case WSA_QOS_EFILTERCOUNT: return _("Incorrect QOS filter count.");
#endif
#ifdef WSA_QOS_EOBJLENGTH
	case WSA_QOS_EOBJLENGTH: return _("Invalid QOS object length.");
#endif
#ifdef WSA_QOS_EFLOWCOUNT
	case WSA_QOS_EFLOWCOUNT: return _("Incorrect QOS flow count.");
#endif
#ifdef WSA_QOS_EUNKOWNPSOBJ
	case WSA_QOS_EUNKOWNPSOBJ: return _("Unrecognized QOS object.");
#endif
#ifdef WSA_QOS_EPOLICYOBJ
	case WSA_QOS_EPOLICYOBJ: return _("Invalid QOS policy object.");
#endif
#ifdef WSA_QOS_EFLOWDESC
	case WSA_QOS_EFLOWDESC: return _("Invalid QOS flow descriptor.");
#endif
#ifdef WSA_QOS_EPSFLOWSPEC
	case WSA_QOS_EPSFLOWSPEC: return _("Invalid QOS provider-specific flowspec.");
#endif
#ifdef WSA_QOS_EPSFILTERSPEC
	case WSA_QOS_EPSFILTERSPEC: return _("Invalid QOS provider-specific filterspec.");
#endif
#ifdef WSA_QOS_ESDMODEOBJ
	case WSA_QOS_ESDMODEOBJ: return _("Invalid QOS shape discard mode object.");
#endif
#ifdef WSA_QOS_ESHAPERATEOBJ
	case WSA_QOS_ESHAPERATEOBJ: return _("Invalid QOS shaping rate object.");
#endif
#ifdef WSA_QOS_RESERVED_PETYPE
	case WSA_QOS_RESERVED_PETYPE: return _("Reserved policy QOS element type.");
#endif
	default: return _("Unknown.");
	}
}

char*
pgm_adapter_strerror (
	const int	adapter_errno
	)
{
	switch (adapter_errno) {
#ifdef ERROR_ADDRESS_NOT_ASSOCIATED
	case ERROR_ADDRESS_NOT_ASSOCIATED: return _("DHCP lease information was available.");
#endif
#ifdef ERROR_BUFFER_OVERFLOW
	case ERROR_BUFFER_OVERFLOW: return _("The buffer to receive the adapter information is too small.");
#endif
#ifdef ERROR_INVALID_DATA
	case ERROR_INVALID_DATA: return _("Invalid adapter information was retrieved.");
#endif
#ifdef ERROR_INVALID_PARAMETER
	case ERROR_INVALID_PARAMETER: return _("One of the parameters is invalid.");
#endif
#ifdef ERROR_NOT_ENOUGH_MEMORY
	case ERROR_NOT_ENOUGH_MEMORY: return _("Insufficient memory resources are available to complete the operation.");
#endif
#ifdef ERROR_NO_DATA
	case ERROR_NO_DATA: return _("No adapter information exists for the local computer.");
#endif
#ifdef ERROR_NOT_SUPPORTED
	case ERROR_NOT_SUPPORTED: return _("The GetAdaptersInfo function is not supported by the operating system running on the local computer..");
#endif
	default: return _("Other.");
	}
}

char*
pgm_win_strerror (
	char*		buf,
	size_t		buflen,
	const int	win_errno
	)
{
	const DWORD nSize = (DWORD)buflen;
	FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
		       NULL,		/* source */
		       win_errno,	/* message id */
		       MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),	/* language id */
		       (LPTSTR)buf,
		       nSize,
		       NULL);		/* arguments */
	return buf;
}
#endif /* _WIN32 */

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/hashtable.c.c89.patch0000644000175000017500000000430611640407354021345 0ustar  locallocal--- hashtable.c	2011-03-12 10:12:12.000000000 +0800
+++ hashtable.c89.c	2011-03-12 10:39:28.000000000 +0800
@@ -71,6 +71,7 @@
 	pgm_return_val_if_fail (NULL != hash_func, NULL);
 	pgm_return_val_if_fail (NULL != key_equal_func, NULL);
 
+	{
 	pgm_hashtable_t *hash_table;
   
 	hash_table = pgm_new (pgm_hashtable_t, 1);
@@ -81,6 +82,7 @@
 	hash_table->nodes              = pgm_new0 (pgm_hashnode_t*, hash_table->size);
   
 	return hash_table;
+	}
 }
 
 PGM_GNUC_INTERNAL
@@ -91,8 +93,11 @@
 {
 	pgm_return_if_fail (hash_table != NULL);
 
-	for (unsigned i = 0; i < hash_table->size; i++)
+	{
+	unsigned i;
+	for (i = 0;i < hash_table->size; i++)
 		pgm_hash_nodes_destroy (hash_table->nodes[i]);
+	}
 	pgm_free (hash_table->nodes);
 	pgm_free (hash_table);
 }
@@ -141,8 +146,10 @@
 {
 	pgm_return_val_if_fail (hash_table != NULL, NULL);
   
+	{
 	const pgm_hashnode_t* node = *pgm_hashtable_lookup_node (hash_table, key, NULL);
 	return node ? node->value : NULL;
+	}
 }
 
 PGM_GNUC_INTERNAL
@@ -155,8 +162,10 @@
 {
 	pgm_return_val_if_fail (hash_table != NULL, NULL);
   
+	{
 	const pgm_hashnode_t* node = *pgm_hashtable_lookup_node (hash_table, key, hash_return);
 	return node ? node->value : NULL;
+	}
 }
 
 PGM_GNUC_INTERNAL
@@ -212,11 +221,14 @@
 {
 	pgm_return_if_fail (hash_table != NULL);
 
-	for (unsigned i = 0; i < hash_table->size; i++)
+	{
+	unsigned i;
+	for (i = 0; i < hash_table->size; i++)
 	{
 		pgm_hash_nodes_destroy (hash_table->nodes[i]);
 		hash_table->nodes[i] = NULL;
 	}
+	}
 	hash_table->nnodes = 0;
 	PGM_HASHTABLE_RESIZE (hash_table);
 }
@@ -231,14 +243,22 @@
 					 HASHTABLE_MIN_SIZE, HASHTABLE_MAX_SIZE);
 	pgm_hashnode_t** new_nodes = pgm_new0 (pgm_hashnode_t*, new_size);
   
-	for (unsigned i = 0; i < hash_table->size; i++)
-		for (pgm_hashnode_t *node = hash_table->nodes[i], *next; node; node = next)
+	{
+	unsigned i;
+	for (i = 0; i < hash_table->size; i++)
+	{
+		pgm_hashnode_t *node, *next;
+		for (node = hash_table->nodes[i]; node; node = next)
 		{
 			next = node->next;
+			{
 			const pgm_hash_t hash_val = node->key_hash % new_size;
 			node->next = new_nodes[hash_val];
 			new_nodes[hash_val] = node;
+			}
 		}
+	}
+	}
   
 	pgm_free (hash_table->nodes);
 	hash_table->nodes = new_nodes;
libpgm-5.1.118-1~dfsg/openpgm/pgm/mibs/0000755000175000017500000000000011640407424016473 5ustar  locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/mibs/PGM-MIB-petrova-01.txt0000644000175000017500000046572111640407351022176 0ustar  locallocal----------------------------------------------------------------
--
-- Pragmatic General Multicast (PGM) MIB
--
----------------------------------------------------------------
--
--
-- Full MIB for the PGM protocol incorporating Network Element 
-- (router), source, receiver and DLR functionality
--
-- extracted from draft-petrova-pgmmib-01.txt

PGM-MIB DEFINITIONS ::= BEGIN
IMPORTS
   OBJECT-TYPE, Counter32, Integer32, Unsigned32, NOTIFICATION-TYPE,
   MODULE-IDENTITY, IpAddress, TimeTicks, experimental, BITS
     FROM SNMPv2-SMI
   MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
     FROM SNMPv2-CONF
   InterfaceIndex
     FROM IF-MIB;

pgmMIB MODULE-IDENTITY
    LAST-UPDATED "200205010000Z"
    ORGANIZATION 
        "Cisco Systems + Tibco Software Inc + Nortel Networks"
    CONTACT-INFO
        "   Richard Edmonstone
            redmonst@cisco.com
            +44 131 561 3621
            Cisco Systems, Inc.
            170 West Tasman Drive,
            San Jose, CA 95134
            USA
            
            Rajiv Raghunarayan
            raraghun@cisco.com 
            +91 80 532 1300
            Cisco Systems, Inc.
            170 West Tasman Drive,
            San Jose, CA 95134
            USA
            
            Devendra Raut
            draut@nortelnetworks.com
            (408)495-2859
            Nortel Networks
            4401 Great America Parkway,
            Santa Clara, CA 95052

            Moses Sun
            mosun@nortelnetworks.com
            (979)694-7156
            Nortel Networks
            4401 Great America Parkway
            Santa Clara, CA, 
            USA

            Todd L. Montgomery
            tmontgomery@tibco.com
            (304)291-5972
            Tibco Software Inc.
            29W110 Butterfield Rd, Suite 205
            Warrenville, IL 60555
            USA

            Michael Garwood
            mgarwood@tibco.com
            (630)393-7363 ext.275
            Tibco Software Inc.
            29W110 Butterfield Rd, Suite 205
            Warrenville, IL 60555 
            USA

            Luna Petrova
            lpetrova@tibco.com
            (630)393-7363 ext.330
            Tibco Software Inc.
            29W110 Butterfield Rd, Suite 205
            Warrenville, IL 60555 
            USA"
    DESCRIPTION
        "The MIB module for managing PGM implementations."
    REVISION "200205010000Z"
    DESCRIPTION
        "Rev 2.0: SNMP Notifications added to the MIB."
  ::= { experimental 112 } -- assigned by IANA.

pgm                    OBJECT IDENTIFIER ::= { pgmMIB 1 }
pgmNetworkElement      OBJECT IDENTIFIER ::= { pgm 1 }
pgmSource              OBJECT IDENTIFIER ::= { pgm 2 }
pgmReceiver            OBJECT IDENTIFIER ::= { pgm 3 }
pgmDLR                 OBJECT IDENTIFIER ::= { pgm 4 }
pgmNotificationPrefix  OBJECT IDENTIFIER ::= { pgmMIB 2 }

-- PGM Network Element

pgmNeEnable OBJECT-TYPE
    SYNTAX  INTEGER {
            enable(1),
            disable(2)
            }
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
            "Enable/Disable Parameter indicates whether
             this PGM operation is enabled or disabled."
    DEFVAL  { enable }
    ::= { pgmNetworkElement 1 }

pgmNeSessionLifeTime  OBJECT-TYPE
    SYNTAX     Unsigned32(0..2147483647) 
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current 
    DESCRIPTION
            "The length of the idle time (seconds) following
             which a PGM session will be aged out. An idle PGM
             session means there is no SPM message received
             from the upstream.
             Value of 0 indicates no timeout."
    DEFVAL  { 300 }
    ::= { pgmNetworkElement 2 }

pgmNeMaxReXmitStates OBJECT-TYPE
    SYNTAX     Integer32(-2..2147483647)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The Maximum number of retransmission state entries.
             The value of -1 means network element has no
             limitation.
             The value of -2 means not supported by this
             implementation."
    ::= { pgmNetworkElement 3 }

pgmNeMaxSessions OBJECT-TYPE
    SYNTAX     Integer32(-2..2147483647)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The maximum number of state sessions supported.
             The value of -1 means network element has no
             limitation.
             The value of -2 means not supported by this
             implementation."
    ::= { pgmNetworkElement 4 }

-- The PGM NE Network Interface 

-- The PGM NE Network Interface tables contain 
-- per-interface information about the PGM protocol. 
-- The information is grouped into three major categories: 
-- fault, configuration and performance management.

pgmNeInterface OBJECT IDENTIFIER ::= { pgmNetworkElement 100 }

pgmNeTotalInterfacesNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of entries in the PGM Interface 
             table."
    ::= { pgmNeInterface 1 }

-- The PGM NE Network Interface configuration table  

pgmNeIfConfigTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeIfConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per interface configuration 
             information relating to PGM Network Element
             operation."
    ::= {pgmNeInterface 3}

pgmNeIfConfigEntry OBJECT-TYPE
    SYNTAX     PgmNeIfConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per Interface Configuration Information."
    INDEX   { pgmNeIfConfigIndex }
    ::= { pgmNeIfConfigTable 1 }

PgmNeIfConfigEntry ::= SEQUENCE {
    pgmNeIfConfigIndex
        InterfaceIndex,
    pgmNeIfPgmEnable
        INTEGER,
    pgmNeIfNakRptInterval
        Unsigned32,
    pgmNeIfNakRptRate
        Unsigned32,
    pgmNeIfNakRdataInterval
        Unsigned32,
    pgmNeIfNakEliminateInterval
        Unsigned32
    }

pgmNeIfConfigIndex OBJECT-TYPE
    SYNTAX     InterfaceIndex
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "A unique value for each interface. Its value
             ranges between 1 and the value of ifNumber. The
             value for each interface must remain constant at 
             least from one re-initialization of the entity's 
             network management system to the next
             re-initialization."
    ::= { pgmNeIfConfigEntry 1 }

pgmNeIfPgmEnable OBJECT-TYPE
    SYNTAX     INTEGER {
                 enable(1),
                 disable(2)
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Allows PGM to be enabled and disabled per
             Network Interface.

             PGM can be enabled or disabled per Network
             Interface, only if PGM is enabled for this
             Network Element."
    ::= { pgmNeIfConfigEntry 2 }

pgmNeIfNakRptInterval  OBJECT-TYPE
    SYNTAX     Unsigned32(1..4294967295)
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The length of time (milliseconds) for which a
             network element will repeat a NAK while waiting
             for a corresponding NCF. This interval is counted
             down from the transmission of a NAK."
    DEFVAL  { 100 }
    ::= { pgmNeIfConfigEntry 3 }

pgmNeIfNakRptRate  OBJECT-TYPE
    SYNTAX     Unsigned32(1..4294967295)
    UNITS      "number of NAKs per second"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The rate at which NAKs are repeated."
    DEFVAL  { 2  }
    ::= { pgmNeIfConfigEntry 4 }

pgmNeIfNakRdataInterval  OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The length of time (milliseconds) for which
             a network element will wait for the
             corresponding RDATA. This interval is counted
             down from the time a matching NCF is received.
             This value must be greater than the 
             pgmNeIfNakEliminateInterval."
    DEFVAL  { 10000 }
    ::= { pgmNeIfConfigEntry 5 }

pgmNeIfNakEliminateInterval OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The length of time (milliseconds) for which
             a network element will eliminate NAKs for 
             a specific TSI/SQN.  This interval is counted 
             down from the time the first NAK is 
             established. This value must 
             be smaller than pgmNeIfNakRdataInterval."
    DEFVAL  { 5000 }
    ::= { pgmNeIfConfigEntry 6 }
    
-- The PGM NE Interface performance table.
-- This is primarily statistical information 
-- about packets received and sent on the interface

pgmNeIfPerformanceTable OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeIfPerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per interface performance 
             information related to PGM Network Element
             operation."
    ::= {pgmNeInterface 4}

pgmNeIfPerformanceEntry OBJECT-TYPE
    SYNTAX     PgmNeIfPerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per Interface Information for Network Elements."
    INDEX   { pgmNeIfPerformanceIndex }
    ::= { pgmNeIfPerformanceTable 1 }

PgmNeIfPerformanceEntry ::= SEQUENCE {
    pgmNeIfPerformanceIndex
        InterfaceIndex,
    pgmNeIfReXmitStates
        Counter32,
    pgmNeIfReXmitTimedOut
        Counter32,
    pgmNeIfInSpms
        Counter32,
    pgmNeIfOutSpms
        Counter32,
    pgmNeIfInParitySpms
        Counter32,
    pgmNeIfOutParitySpms
        Counter32,
    pgmNeIfInRdata
        Counter32,
    pgmNeIfOutRdata
        Counter32,
    pgmNeIfInParityRdata
        Counter32,
    pgmNeIfOutParityRdata
        Counter32,
    pgmNeIfInRdataNoSessionErrors
        Counter32,
    pgmNeIfUniqueNaks
        Counter32,
    pgmNeIfInNaks
        Counter32,
    pgmNeIfOutNaks
        Counter32,
    pgmNeIfUniqueParityNaks
        Counter32,
    pgmNeIfInParityNaks
        Counter32,
    pgmNeIfOutParityNaks
        Counter32,
    pgmNeIfInNakNoSessionErrors
        Counter32,
    pgmNeIfInNakSeqErrors
        Counter32,
    pgmNeIfInParityNakTgErrors
        Counter32,
    pgmNeIfInNnaks
        Counter32,
    pgmNeIfOutNnaks
        Counter32,
    pgmNeIfInParityNnaks
        Counter32,
    pgmNeIfOutParityNnaks
        Counter32,
    pgmNeIfInNnakNoSessionErrors
        Counter32,
    pgmNeIfInNcfs
        Counter32,
    pgmNeIfOutNcfs
        Counter32,
    pgmNeIfInParityNcfs
        Counter32,
    pgmNeIfOutParityNcfs
        Counter32,
    pgmNeIfInNcfNoSessionErrors
        Counter32,
    pgmNeIfInRedirectNcfs
        Counter32,
    pgmNeIfMalformed
        Counter32,
    pgmNeIfSpmFromSource
        Counter32,
    pgmNeIfSpmBadSqn
        Counter32,
    pgmNeIfSpmError
        Counter32,
    pgmNeIfPollRandomIgnore
        Counter32,
    pgmNeIfPollTsiStateError
        Counter32,
    pgmNeIfPollParentError
        Counter32,
    pgmNeIfPollTypeError
        Counter32,
    pgmNeIfPollError
        Counter32,
    pgmNeIfPollSuccess
        Counter32,
    pgmNeIfPollOriginated
        Counter32,
    pgmNeIfPolrNoState
        Counter32,
    pgmNeIfPolrError
        Counter32,
    pgmNeIfPolrParityError
        Counter32,
    pgmNeIfPolrSuccess
        Counter32,
    pgmNeIfPolrOriginated
        Counter32,
    pgmNeIfNcfError
        Counter32,
    pgmNeIfNcfParityError
        Counter32,
    pgmNeIfNcfPartialParity
        Counter32,
    pgmNeIfNcfReceived
        Counter32,
    pgmNeIfNcfAnticipated
        Counter32,
    pgmNeIfNcfRedirecting
        Counter32,
    pgmNeIfNakEliminated
        Counter32,
    pgmNeIfNakError
        Counter32,
    pgmNeIfNakParityError
        Counter32,
    pgmNeIfNNakEliminated
        Counter32,
    pgmNeIfNNakError
        Counter32,
    pgmNeIfNNakParityError
        Counter32,
    pgmNeIfNNakCongestionReports
        Counter32,
    pgmNeIfNakRetryExpired
        Counter32,
    pgmNeIfNakRetryExpiredDLR
        Counter32,
    pgmNeIfNakForwardedDLR
        Counter32,
    pgmNeIfNakRetransmitted
        Counter32,
    pgmNeIfRdataEliminatedOIF
        Counter32,
    pgmNeIfRdataEliminatedSqn
        Counter32,
    pgmNeIfInRdataFragments
        Counter32,
    pgmNeIfRdataFragmentsNoSessionErrors
        Counter32,
    pgmNeIfRdataFragmentsEliminatedOIF
        Counter32,
    pgmNeIfRdataFragmentsEliminatedSqn
        Counter32,
    pgmNeIfOutRdataFragments
        Counter32
}

pgmNeIfPerformanceIndex OBJECT-TYPE
    SYNTAX     InterfaceIndex
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "A unique value for each interface. Its value
             ranges between 1 and the value of ifNumber.  
             The value for each interface must remain 
             constant at least from one re-initialization 
             of the entity's network management system
             to the next re-initialization."
    ::= { pgmNeIfPerformanceEntry 1 }

pgmNeIfReXmitStates OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total retransmit state entries for this
             interface."
    ::= { pgmNeIfPerformanceEntry 2 }
 
pgmNeIfReXmitTimedOut OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of timed-out retransmit state
             entries for this interface."
    ::= { pgmNeIfPerformanceEntry 3 }

pgmNeIfInSpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of SPMs received  on the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 4 }

pgmNeIfOutSpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of SPMs sent out from the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 5 }

pgmNeIfInParitySpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity SPMs received on the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 6 }

pgmNeIfOutParitySpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity SPMs sent out from the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 7 }

pgmNeIfInRdata OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of RDATA received on the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 8 }

pgmNeIfOutRdata OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of RDATA sent out from the 
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 9 }

pgmNeIfInParityRdata OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity RDATA received on the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 10 }

pgmNeIfOutParityRdata OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity RDATA sent out from 
             the PGM interface."
    ::= { pgmNeIfPerformanceEntry 11 }

pgmNeIfInRdataNoSessionErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of received RDATA discarded because
             of no session."
    ::= { pgmNeIfPerformanceEntry 12 }

pgmNeIfUniqueNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of unique NAKs received on 
             this interface."
    ::= { pgmNeIfPerformanceEntry 13 }

pgmNeIfInNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NAKs received on the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 14 }

pgmNeIfOutNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NAKs sent out from the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 15 }

pgmNeIfUniqueParityNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of unique parity NAKs received
             on this interface."
    ::= { pgmNeIfPerformanceEntry 16 }

pgmNeIfInParityNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NAKs received on the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 17 }

pgmNeIfOutParityNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NAKs sent out from
             the PGM interface."
    ::= { pgmNeIfPerformanceEntry 18 }

pgmNeIfInNakNoSessionErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of received NAKs discarded because of
             no session."
    ::= { pgmNeIfPerformanceEntry 19 }

pgmNeIfInNakSeqErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of received NAKs discarded because
             of out of sequence (out of retransmit window)."
    ::= { pgmNeIfPerformanceEntry 20 }

pgmNeIfInParityNakTgErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of received parity NAKs discarded 
             because out of parity TG window."
    ::= { pgmNeIfPerformanceEntry 21 }

pgmNeIfInNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NNAKs received on the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 22 }

pgmNeIfOutNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NNAKs sent out from the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 23 }

pgmNeIfInParityNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NNAKs received on
             the PGM interface."
    ::= { pgmNeIfPerformanceEntry 24 }

pgmNeIfOutParityNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NNAKs sent out from
             the PGM interface."
    ::= { pgmNeIfPerformanceEntry 25 }

pgmNeIfInNnakNoSessionErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of received NNAKs discarded because 
             of no session."
    ::= { pgmNeIfPerformanceEntry 26 }

pgmNeIfInNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NCFs received on the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 27 }

pgmNeIfOutNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NCFs sent out from the PGM
             interface."
    ::= { pgmNeIfPerformanceEntry 28 }

pgmNeIfInParityNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NCFs received on the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 29 }

pgmNeIfOutParityNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NCFs sent out from 
             the PGM interface."
    ::= { pgmNeIfPerformanceEntry 30 }

pgmNeIfInNcfNoSessionErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of received NCFs discarded because
             of no session."
    ::= { pgmNeIfPerformanceEntry 31 }

pgmNeIfInRedirectNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of redirected NCFs received on the
             PGM interface."
    ::= { pgmNeIfPerformanceEntry 32 }

pgmNeIfMalformed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed PGM packets."
    ::= { pgmNeIfPerformanceEntry 33 }

pgmNeIfSpmFromSource OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of SPM packets received from source."
    ::= { pgmNeIfPerformanceEntry 34 }

pgmNeIfSpmBadSqn OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of SPM packets discarded due to bad
             SQN."
    ::= { pgmNeIfPerformanceEntry 35 }

pgmNeIfSpmError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of SPM packets discarded due to 
             operational error. Some examples of operational
             errors are failure to create TSI state for SPM,
             parity SPM for a TSI with no parity."
    ::= { pgmNeIfPerformanceEntry 36 }

pgmNeIfPollRandomIgnore OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLL packets not replied due to random
             condition failing."
    ::= { pgmNeIfPerformanceEntry 37 }

pgmNeIfPollTsiStateError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLL packets discarded due to no 
             matching TSI state."
    ::= { pgmNeIfPerformanceEntry 38 }

pgmNeIfPollParentError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLL packets discarded due to
             unknown parent."
    ::= { pgmNeIfPerformanceEntry 39 }

pgmNeIfPollTypeError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLL packets discarded due to failed
             type matching."
    ::= { pgmNeIfPerformanceEntry 40 }

pgmNeIfPollError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLL packets discarded due to
             operational error."
    ::= { pgmNeIfPerformanceEntry 41 }

pgmNeIfPollSuccess OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of successfully scheduled POLRs."
    ::= { pgmNeIfPerformanceEntry 42 }

pgmNeIfPollOriginated OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of polls originated on this interface."
    ::= { pgmNeIfPerformanceEntry 43 }

pgmNeIfPolrNoState OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLRs discarded due to no matching
             state."
    ::= { pgmNeIfPerformanceEntry 44 }

pgmNeIfPolrError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLRs discarded due to operational 
             error."
    ::= { pgmNeIfPerformanceEntry 45 }

pgmNeIfPolrParityError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity POLRs received for non-parity
             TSI."
    ::= { pgmNeIfPerformanceEntry 46 }

pgmNeIfPolrSuccess OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLRs recorded successfully."
    ::= { pgmNeIfPerformanceEntry 47 }

pgmNeIfPolrOriginated OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of POLRs originated by this interface."
    ::= { pgmNeIfPerformanceEntry 48 }

pgmNeIfNcfError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NCFs ignored due to no packet memory,
             due to packet processing errors."
    ::= { pgmNeIfPerformanceEntry 49 }

pgmNeIfNcfParityError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NCFs ignored. Incremented when a parity
             NCF is received on a session for which no parity 
             capability has been advertised in the session's 
             SPMs."
    ::= { pgmNeIfPerformanceEntry 50 }

pgmNeIfNcfPartialParity OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NCFs ignored due to not enough parity 
             blocks acknowledged."
    ::= { pgmNeIfPerformanceEntry 51 }

pgmNeIfNcfReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NCFs that confirm an outstanding NAK."
    ::= { pgmNeIfPerformanceEntry 52 }

pgmNeIfNcfAnticipated OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NCFs that cause NAK anticipation."
    ::= { pgmNeIfPerformanceEntry 53 }

pgmNeIfNcfRedirecting OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NCFs received as consequence of 
             redirected NAK."
    ::= { pgmNeIfPerformanceEntry 54 }

pgmNeIfNakEliminated OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs eliminated by retransmission 
             state."
    ::= { pgmNeIfPerformanceEntry 55 }

pgmNeIfNakError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of errors creating retransmission state
             or NAK, due to NAK packet processing."
    ::= { pgmNeIfPerformanceEntry 56 }

pgmNeIfNakParityError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs ignored, due to no parity
             available. Incremented when parity NAK is 
             received on this session, for which no parity
             capability has been advartised."
    ::= { pgmNeIfPerformanceEntry 57 }

pgmNeIfNNakEliminated OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NNAKs eliminated by retransmission 
             state."
    ::= { pgmNeIfPerformanceEntry 58 }

pgmNeIfNNakError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of errors encountered creating 
             retransmission state OR nak."
    ::= { pgmNeIfPerformanceEntry 59 }

pgmNeIfNNakParityError OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Null NAKs ignored, due to no parity
             available. Incremented when parity NNAK is 
             received on this session, for which no parity
             capability has been advartised."
    ::= { pgmNeIfPerformanceEntry 60 }

pgmNeIfNNakCongestionReports OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs forwarded as NNAK as congestion
             report only."
    ::= { pgmNeIfPerformanceEntry 61 }

pgmNeIfNakRetryExpired OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NAKs timed out after
             retrying."
    ::= { pgmNeIfPerformanceEntry 62 }

pgmNeIfNakRetryExpiredDLR OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs unconfirmed by DLR."
    ::= { pgmNeIfPerformanceEntry 63 }

pgmNeIfNakForwardedDLR OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs forwarded out this i/f to DLR
             with retransmission state."
    ::= { pgmNeIfPerformanceEntry 64 }

pgmNeIfNakRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Total number of NAKs retransmitted out this i/f."
    ::= { pgmNeIfPerformanceEntry 65 }

pgmNeIfRdataEliminatedOIF OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of RDATA packets eliminated by lack of
             OIF's."
    ::= { pgmNeIfPerformanceEntry 66 }

pgmNeIfRdataEliminatedSqn OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of RDATA packets eliminated by lack of
             SQN."
    ::= { pgmNeIfPerformanceEntry 67 }

pgmNeIfInRdataFragments OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Total number of RDATA fragments received."
    ::= { pgmNeIfPerformanceEntry 68 }

pgmNeIfRdataFragmentsNoSessionErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of RDATA fragments eliminated by lack of
             GSI."
    ::= { pgmNeIfPerformanceEntry 69 }

pgmNeIfRdataFragmentsEliminatedOIF OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of RDATA fragments eliminated by lack of
             OIFs."
    ::= { pgmNeIfPerformanceEntry 70 }

pgmNeIfRdataFragmentsEliminatedSqn OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of RDATA fragments eliminated by lack of
             SQN."
    ::= { pgmNeIfPerformanceEntry 71 }

pgmNeIfOutRdataFragments OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Total number of RDATA fragments forwarded."
    ::= { pgmNeIfPerformanceEntry 72 }

--
-- PGM Network Element Transport Session Identifier
--     
pgmNeTsi OBJECT IDENTIFIER ::= { pgmNetworkElement 101 }

pgmNeTotalTsiNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of sessions in the PGM NE TSI
             table."
    ::= { pgmNeTsi 1 }

-- The PGM Transport Session Identifier (TSI) table
-- The TSI information is grouped into three major categories:
-- fault, configuration and performance management.

-- The PGM NE TSI fault management table 
-- This table contains state and some general
-- per TSI information

pgmNeTsiTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeTsiEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per-tsi state information."
    ::= {pgmNeTsi 2}

pgmNeTsiEntry OBJECT-TYPE
    SYNTAX     PgmNeTsiEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Transport Session is identified by Global ID and
             Source Port."
    INDEX   { pgmNeTsiGlobalId, pgmNeTsiDataSourcePort }
    ::= { pgmNeTsiTable 1 }

PgmNeTsiEntry ::= SEQUENCE {
    pgmNeTsiGlobalId
        OCTET STRING,
    pgmNeTsiDataSourcePort
        Unsigned32,
    pgmNeTsiStateBits
        BITS,
    pgmNeTsiDataDestinationPort
        Unsigned32,
    pgmNeTsiSourceAddress
        IpAddress,
    pgmNeTsiGroupAddress
        IpAddress,
    pgmNeTsiUpstreamAddress
        IpAddress,
    pgmNeTsiUpstreamIfIndex
        InterfaceIndex,
    pgmNeTsiDlrAddress
        IpAddress
   }

pgmNeTsiGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The Globally unique source identifier for this
             transport session."
    ::= {pgmNeTsiEntry 1 }

pgmNeTsiDataSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32 (0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Data source port."
    ::= {pgmNeTsiEntry 2}

pgmNeTsiStateBits OBJECT-TYPE
    SYNTAX     BITS { initialising(0), 
                      spmSqnStateValid(1), 
                      dlrCanProvideParity(2) }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "State associated with the TSI."
    ::= {pgmNeTsiEntry 3 }

pgmNeTsiDataDestinationPort OBJECT-TYPE
    SYNTAX     Unsigned32 (0..65535)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Data destination port."
    ::= {pgmNeTsiEntry 4 }

pgmNeTsiSourceAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "IP address of the source."
    ::= {pgmNeTsiEntry 5 }

pgmNeTsiGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Multicast group destination address."
    ::= {pgmNeTsiEntry 6 }

pgmNeTsiUpstreamAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The IP address of the upstream PGM neighbouring
             element for this TSI."
    ::= { pgmNeTsiEntry 7 }

pgmNeTsiUpstreamIfIndex OBJECT-TYPE
    SYNTAX     InterfaceIndex
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The index of the upstream PGM element for the
             entry."
    ::= { pgmNeTsiEntry 8 }

pgmNeTsiDlrAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "IP Address of a known DLR that will be used if
             required."
    ::= {pgmNeTsiEntry 9 }


-- PGM Network Element TSI Configuration Management Table
-- Since the Network Element cannot be configured 
-- per TSI, configuration table is not implemented


-- PGM Network Element TSI Performance Management Table

pgmNeTsiPerformanceTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeTsiPerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding details of every transport 
             flow known by the Network Element."
    ::= {pgmNeTsi 4}

pgmNeTsiPerformanceEntry OBJECT-TYPE
    SYNTAX     PgmNeTsiPerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Transport session description."
    INDEX   { pgmNeTsiPerformanceGlobalId, 
              pgmNeTsiPerformanceDataSourcePort }
    ::= { pgmNeTsiPerformanceTable 1 }

PgmNeTsiPerformanceEntry ::= SEQUENCE {
    pgmNeTsiPerformanceGlobalId
        OCTET STRING,
    pgmNeTsiPerformanceDataSourcePort
        Unsigned32,
    pgmNeTsiSessionTrailEdgeSeq
        Counter32,
    pgmNeTsiSessionIncrSeq
        Counter32,
    pgmNeTsiLeadEdgeSeq
        Counter32,
    pgmNeTsiInSpms
        Counter32,
    pgmNeTsiOutSpms
        Counter32,
    pgmNeTsiInParitySpms
        Counter32,
    pgmNeTsiOutParitySpms
        Counter32,
    pgmNeTsiTotalReXmitStates
        Counter32,
    pgmNeTsiTotalReXmitTimedOut
        Counter32,
    pgmNeTsiInRdata
        Counter32,
    pgmNeTsiOutRdata
        Counter32,
    pgmNeTsiInParityRdata
        Counter32,
    pgmNeTsiOutParityRdata
        Counter32,
    pgmNeTsiInRdataNoStateErrors
        Counter32,
    pgmNeTsiUniqueNaks
        Counter32,
    pgmNeTsiInNaks
        Counter32,
    pgmNeTsiOutNaks
        Counter32,
    pgmNeTsiUniqueParityNaks
        Counter32,
    pgmNeTsiInParityNaks
        Counter32,
    pgmNeTsiOutParityNaks
        Counter32,
    pgmNeTsiInNakSeqErrors
        Counter32,
    pgmNeTsiInNnaks
        Counter32,
    pgmNeTsiOutNnaks
        Counter32,
    pgmNeTsiInParityNnaks
        Counter32,
    pgmNeTsiOutParityNnaks
        Counter32,
    pgmNeTsiInNcfs
        Counter32,
    pgmNeTsiOutNcfs
        Counter32,
    pgmNeTsiInParityNcfs
        Counter32,
    pgmNeTsiOutParityNcfs
        Counter32,
    pgmNeTsiSpmSequenceNumber
        Unsigned32,
    pgmNeTsiTransmissionGroupSize
        Unsigned32,
    pgmNeTsiTimeout
        TimeTicks,
    pgmNeTsiLastTtl
        Unsigned32,
    pgmNeTsiLinkLossRate
        Unsigned32,
    pgmNeTsiPathLossRate
        Unsigned32,
    pgmNeTsiReceiverLossRate
        Unsigned32,
    pgmNeTsiCongestionReportLead
        Unsigned32,
    pgmNeTsiCongestionReportWorstReceiver
        IpAddress
}

pgmNeTsiPerformanceGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The Globally unique source identifier for this
             transport session."
    ::= {pgmNeTsiPerformanceEntry 1 }

pgmNeTsiPerformanceDataSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32 (0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Data source port."
    ::= {pgmNeTsiPerformanceEntry 2}

pgmNeTsiSessionTrailEdgeSeq OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The trailing edge sequence of the transmit 
             window."
    ::= { pgmNeTsiPerformanceEntry 3 }

pgmNeTsiSessionIncrSeq OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The sequence number defining the leading edge of
             the increment window."
    ::= { pgmNeTsiPerformanceEntry 4 }

pgmNeTsiLeadEdgeSeq OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The leading edge sequence of the transmit 
             window."
    ::= { pgmNeTsiPerformanceEntry 5 }

pgmNeTsiInSpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of SPMs received for this
             session."
    ::= { pgmNeTsiPerformanceEntry 6 }
 
pgmNeTsiOutSpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of SPMs sent out for this
             session."
    ::= { pgmNeTsiPerformanceEntry 7 }

pgmNeTsiInParitySpms OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of Parity SPMs received for 
             this session."
    ::= { pgmNeTsiPerformanceEntry 8 }

pgmNeTsiOutParitySpms OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of Parity SPMs sent out for
             this session."
    ::= { pgmNeTsiPerformanceEntry 9 }

pgmNeTsiTotalReXmitStates OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total retransmit states for this session."
    ::= { pgmNeTsiPerformanceEntry 10 }

pgmNeTsiTotalReXmitTimedOut OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total timed-out retransmit state entries for 
             this session."
    ::= { pgmNeTsiPerformanceEntry 11 }

pgmNeTsiInRdata OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of RDATAs received for this
             session."
    ::= { pgmNeTsiPerformanceEntry 12 }

pgmNeTsiOutRdata OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of RDATAs sent out from this
             session."
    ::= { pgmNeTsiPerformanceEntry 13 }

pgmNeTsiInParityRdata OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity RDATAs received for
             this session."
    ::= { pgmNeTsiPerformanceEntry 14 }

pgmNeTsiOutParityRdata OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity RDATAs sent out from
             this session."
    ::= { pgmNeTsiPerformanceEntry 15 }

pgmNeTsiInRdataNoStateErrors OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of received RDATA discarded 
             due to no retransmit state."
    ::= { pgmNeTsiPerformanceEntry 16 }

pgmNeTsiUniqueNaks OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of unique NAKs received for 
             this session."
    ::= { pgmNeTsiPerformanceEntry 17 }

pgmNeTsiInNaks OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NAKs received for this
             session."
    ::= { pgmNeTsiPerformanceEntry 18 }

pgmNeTsiOutNaks OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NAKs sent out from this
             session."
    ::= { pgmNeTsiPerformanceEntry 19 }

pgmNeTsiUniqueParityNaks OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of unique parity NAKs received 
             for this session."
    ::= { pgmNeTsiPerformanceEntry 20 }

pgmNeTsiInParityNaks OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NAKs received for
             this session."
    ::= { pgmNeTsiPerformanceEntry 21 }

pgmNeTsiOutParityNaks OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NAKs sent out from 
             this session."
    ::= { pgmNeTsiPerformanceEntry 22 }

pgmNeTsiInNakSeqErrors OBJECT-TYPE
    SYNTAX     Counter32 
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of received NAKs discarded 
             because of out of sequence (out of retransmit
             window)."
    ::= { pgmNeTsiPerformanceEntry 23 }

pgmNeTsiInNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NNAKs received for this
             session."
    ::= { pgmNeTsiPerformanceEntry 24 }

pgmNeTsiOutNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NNAKs sent out from this
             session."
    ::= { pgmNeTsiPerformanceEntry 25 }

pgmNeTsiInParityNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NNAKs received for
             this session."
    ::= { pgmNeTsiPerformanceEntry 26 }

pgmNeTsiOutParityNnaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NNAKs sent out from
             this session."
    ::= { pgmNeTsiPerformanceEntry 27 }

pgmNeTsiInNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NCFs received for this
             session."
    ::= { pgmNeTsiPerformanceEntry 28 }

pgmNeTsiOutNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of NCFs sent out from this
             session."
    ::= { pgmNeTsiPerformanceEntry 29 }

pgmNeTsiInParityNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of parity NCFs received for
             this session."
    ::= { pgmNeTsiPerformanceEntry 30 }

pgmNeTsiOutParityNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of Parity NCFs sent out from
             this session."
    ::= { pgmNeTsiPerformanceEntry 31 }

pgmNeTsiSpmSequenceNumber OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Sequence number of the last seen SPM."
    ::= {pgmNeTsiPerformanceEntry 32 }

pgmNeTsiTransmissionGroupSize OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Advertised size of the transmission group for
             this transport session."
    ::= {pgmNeTsiPerformanceEntry 33 }

pgmNeTsiTimeout OBJECT-TYPE
    SYNTAX     TimeTicks
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Time left for this entry to expire."
    ::= {pgmNeTsiPerformanceEntry 34 }

pgmNeTsiLastTtl OBJECT-TYPE
    SYNTAX     Unsigned32(1..255)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "IP TTL of last seen valid SPM."
    ::= {pgmNeTsiPerformanceEntry 35 }

pgmNeTsiLinkLossRate OBJECT-TYPE
    SYNTAX     Unsigned32(0..100)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Worst reported link loss rate for congestion
             control. This is reported as a percentage."
    ::= {pgmNeTsiPerformanceEntry 36 }

pgmNeTsiPathLossRate OBJECT-TYPE
    SYNTAX     Unsigned32 (0..100)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Worst reported path loss rate for congestion
             control. This is reported as a percentage."
    ::= {pgmNeTsiPerformanceEntry 37 }

pgmNeTsiReceiverLossRate OBJECT-TYPE
    SYNTAX     Unsigned32 (0..100)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Worst reported receiver loss rate for congestion
             control. This is reported as a percentage."
    ::= {pgmNeTsiPerformanceEntry 38 }

pgmNeTsiCongestionReportLead OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Data lead sequence number associated with the
              worst reported receiver loss rate."
    ::= {pgmNeTsiPerformanceEntry 39 }

pgmNeTsiCongestionReportWorstReceiver OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "IP address of the receiver that reported the
             worst receiver loss rate."
    ::= {pgmNeTsiPerformanceEntry 40 }

-- The PGM Retransmission table

-- The PGM Retransmission table contains 
-- information about current retransmission requests.
-- This information is held per sequence number, or in 
-- the case of FEC, every transmission group, for which
-- retransmission has been requested.

pgmNeTsiRtxNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of entries in the retransmission table."
    ::= { pgmNeTsi 5 }

pgmNeTsiRtxTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeTsiRtxEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding information for every sequence
             number, or in the case of FEC,  every 
             transmission group, for which retransmission has 
             been requested."
    ::= {pgmNeTsi 6 }

pgmNeTsiRtxEntry OBJECT-TYPE
    SYNTAX     PgmNeTsiRtxEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per sequence number / transmission group
             information."
    INDEX   { pgmNeTsiGlobalId,
              pgmNeTsiDataSourcePort,
              pgmNeTsiRtxSequenceNumber,
              pgmNeTsiRtxSequenceNumberType }
    ::= { pgmNeTsiRtxTable 1 }

PgmNeTsiRtxEntry ::= SEQUENCE {
    pgmNeTsiRtxSequenceNumber
        Unsigned32,
    pgmNeTsiRtxSequenceNumberType
        INTEGER,
    pgmNeTsiRtxReqParityTgCount
        Counter32,
    pgmNeTsiRtxTimeout
        TimeTicks,
    pgmNeTsiRtxStateBits
        BITS
}

pgmNeTsiRtxSequenceNumber OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "For non-parity retransmission, a sequence number.
             For parity retransmission, a transmission group
             and packet count."
    ::= {pgmNeTsiRtxEntry 1 }

pgmNeTsiRtxSequenceNumberType OBJECT-TYPE
    SYNTAX     INTEGER {
                 selective(1),
                  tg(2)
               }
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Selective Sequence Number and TG Sequence
             Number."
    ::= {pgmNeTsiRtxEntry 2 }

pgmNeTsiRtxReqParityTgCount OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The Requested number of missing parity packets
             of specific Tg. The largest counter of the 
             received NAK will be stored in this mib. This 
             variable is valid for parity packets only."
    ::= { pgmNeTsiRtxEntry 4 }

pgmNeTsiRtxTimeout OBJECT-TYPE
    SYNTAX     TimeTicks
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "When this state will expire."
    ::= {pgmNeTsiRtxEntry 5 }

pgmNeTsiRtxStateBits OBJECT-TYPE
    SYNTAX     BITS {
                    initialising(0),
                    eliminating(1),
                    redirecting(2),
                    stateCreatedByNullNAK(3),
                    listNAKentry(4),
                    parityState(5)
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "State associated with retransmission entry."
    ::= {pgmNeTsiRtxEntry 6 }

-- The PGM Retransmission interfaces table

-- The PGM Retransmission interfaces table contains 
-- information about what interfaces will be sent 
-- retransmitted data for a particular
-- retransmission entry

pgmNeTsiRtxIfNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of entries in the retransmission 
             interfaces table."
    ::= { pgmNeTsi 7 }

pgmNeTsiRtxIfTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeTsiRtxIfEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding information of every 
             interface for which retransmit state for 
             a particular sequence number or transmission 
             group has to be sent."
    ::= {pgmNeTsi 8}

pgmNeTsiRtxIfEntry OBJECT-TYPE
    SYNTAX     PgmNeTsiRtxIfEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Destination interfaces for a particular 
             retransmit state."
    INDEX   { pgmNeTsiGlobalId,
              pgmNeTsiDataSourcePort,
              pgmNeTsiRtxSequenceNumber,
              pgmNeTsiRtxSequenceNumberType,
              pgmNeTsiRtxIfIndex } 
    ::= { pgmNeTsiRtxIfTable 1 }

PgmNeTsiRtxIfEntry ::= SEQUENCE {
    pgmNeTsiRtxIfIndex
        InterfaceIndex,
    pgmNeTsiRtxIfPacketCount
        Counter32
}

pgmNeTsiRtxIfIndex OBJECT-TYPE
    SYNTAX     InterfaceIndex
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "A unique value for each interface. Its value
             ranges between 1 and the value of ifNumber. 
             The value for each interface must remain 
             constant at least from one re-initialization
             of the entity's network management system to
             the next re-initialization."
    ::= { pgmNeTsiRtxIfEntry 1 }

pgmNeTsiRtxIfPacketCount OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of repair data packets still to be 
             retransmitted on this interface. For non-parity 
             retransmission this will never have a value 
             greater than 1. For parity retransmission, 
             any number can be present."
    ::= { pgmNeTsiRtxIfEntry 2 }

-- The PGM Poll Response table

-- The PGM Poll Response table contains information 
-- about PGM parent's of this network element who are 
-- currently polling it.

pgmNeTsiPolrNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of entries in the poll response table."
    ::= { pgmNeTsi 9 }

pgmNeTsiPolrTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeTsiPolrEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding state information about what
             PGM parents are polling this Network Element."
    ::= { pgmNeTsi 10 }

pgmNeTsiPolrEntry OBJECT-TYPE
    SYNTAX     PgmNeTsiPolrEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "State information for a Network Element that 
             is being polled by its parents"
    INDEX   { pgmNeTsiGlobalId,
              pgmNeTsiDataSourcePort,
              pgmNeTsiPolrSource }
    ::= { pgmNeTsiPolrTable 1 }

PgmNeTsiPolrEntry ::= SEQUENCE {
    pgmNeTsiPolrSource
        IpAddress,
    pgmNeTsiPolrSequenceNumber
        Unsigned32
}

pgmNeTsiPolrSource OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "IP Address of parent who is polling this 
             device."
    ::= { pgmNeTsiPolrEntry 1 }

pgmNeTsiPolrSequenceNumber OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Sequence number of last POLR from the source."
    ::= { pgmNeTsiPolrEntry 2 }

-- The PGM Poll table

-- The PGM Poll table contains information related to
-- polling that this Network Element is doing for 
-- its children

pgmNeTsiPollNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of entries in the poll table."
    ::= { pgmNeTsi 11 }

pgmNeTsiPollTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmNeTsiPollEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding state information related 
             to polling that this Network Element is doing 
             for its children."
    ::= { pgmNeTsi 12 }

pgmNeTsiPollEntry OBJECT-TYPE
    SYNTAX     PgmNeTsiPollEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "State information for a Network Element that
             is polling its children."
    INDEX   { pgmNeTsiGlobalId,
              pgmNeTsiDataSourcePort,
              pgmNeTsiPollType }
    ::= { pgmNeTsiPollTable 1 }

PgmNeTsiPollEntry ::= SEQUENCE {
    pgmNeTsiPollType
        INTEGER,
    pgmNeTsiPollSequence
        Unsigned32,
    pgmNeTsiPollChildBackoff
        Unsigned32,
    pgmNeTsiPollMask
        Unsigned32,
    pgmNeTsiPollPeriod
        Unsigned32,
    pgmNeTsiPollCount
        Counter32,
    pgmNeTsiPollTimeout
        TimeTicks
}

pgmNeTsiPollType OBJECT-TYPE
    SYNTAX     INTEGER { 
                  general(1), 
                  dlr(2) 
               }
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Type of Poll."
    ::= { pgmNeTsiPollEntry 1 }

pgmNeTsiPollSequence OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Sequence number of the most recent POLL packet
             that we sent."
    ::= { pgmNeTsiPollEntry 2 }

pgmNeTsiPollChildBackoff OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Backoff advertised to be used by child of poll."
    ::= { pgmNeTsiPollEntry 3 }

pgmNeTsiPollMask OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Mask being used in poll."
    ::= { pgmNeTsiPollEntry 4 }

pgmNeTsiPollPeriod OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Period of poll."
    ::= { pgmNeTsiPollEntry 5 }

pgmNeTsiPollCount OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Poll responses (POLRs) received."
    ::= { pgmNeTsiPollEntry 6 }

pgmNeTsiPollTimeout OBJECT-TYPE
    SYNTAX     TimeTicks
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Remaining Time Ticks to next poll."
    ::= { pgmNeTsiPollEntry 7 }


--
-- PGM Source 
-- 

-- PGM Source general management information


pgmSourceSaveDefaults  OBJECT-TYPE
    SYNTAX     INTEGER { initial (1),
                         save (2), 
                         pending (3),
                         success (4),
                         failure (5) }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag used to initiate the storing 
             of all default variable values to 
             non-volatile storage and to report the 
             result of the operation.
             The following values can only be read,
             never written :
             initial(1) - returned prior to any requests
             for saving the default configuration
             pending(3) - saving in progress
             success(4) - returned when a save(2) request
             is successful
             failure(5) - returned when a save(2) request
             is unsuccessful

             The following values can only be written,
             never read :
             save(2) - to indicate that the default
             configuration should be saved."
    ::= { pgmSource 1 }

pgmSourceLastUpdateTime OBJECT-TYPE
    SYNTAX     TimeTicks
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of TimeTicks since the last update
             of the non-volatile storage." 
    ::= { pgmSource 2 }

pgmSourceDefaultTtl OBJECT-TYPE
    SYNTAX     Unsigned32(1..255)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Default TTL used by the PGM Source."
    ::= { pgmSource 3 }

pgmSourceDefaultAdvMode OBJECT-TYPE
    SYNTAX     INTEGER { data(1), 
                         time(2),
                         applctrl(3),
                         other(4) }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag to indicate that the transmit window is
             advanced with data, by time, under application
             control, or any other method."
    ::= { pgmSource 4 }

pgmSourceDefaultLateJoin OBJECT-TYPE
    SYNTAX     INTEGER { 
                  enable(1), 
                  disable(2) 
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not the sender will
             accept late joiners."
    ::= { pgmSource 5 }

pgmSourceDefaultTxwMaxRte OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Maximum transmit rate in bytes/second."
    ::= { pgmSource 6 }

pgmSourceDefaultTxwSecs OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Transmit window size in seconds."
    ::= { pgmSource 7 }

pgmSourceDefaultTxwAdvSecs OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Transmit window advance in seconds. This value
             should always be set to a value smaller than
             the pgmSourceTxwSecs."
    ::= { pgmSource 8 }

pgmSourceDefaultAdvIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Advance interval in milliseconds. Always a
             valid parameter when advancing with time.
             Valid only in cases of absence of lost data
             when advancing with data."
    ::= { pgmSource 9 }

pgmSourceDefaultSpmIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "SPM interval in milliseconds."
    ::= { pgmSource 10 }

pgmSourceDefaultSpmHeartBeatIvlMin OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "SPM heartbeat interval in milliseconds."
    ::= { pgmSource 11 }

pgmSourceDefaultSpmHeartBeatIvlMax OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Maximum SPM heartbeat interval in milliseconds."
    ::= { pgmSource 12 }

pgmSourceDefaultRdataBackoffIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "RDATA backoff interval in milliseconds."
    ::= { pgmSource 13 }

pgmSourceDefaultFECProactiveParitySize OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Number of proactive parity messages per FEC
             block."
    ::= { pgmSource 14 }

pgmSourceDefaultGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The default IP Multicast group address 
             used by the sender."
    ::= { pgmSource 15 }

pgmSourceUpdateSinceLastSave OBJECT-TYPE
    SYNTAX     INTEGER
               {
                   notUpdated(1),
                   updated(2)
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Specifies if any of the Source Default
             variables have been updated or not,
             since the last successful pgmSourceSaveDefaults.
             notUpdated - none of the default Source
                          variables were set after the last
                          successful save to a non-volatile
                          storage.
             updated - at least one of the default Source
                          variables were set after the last
                          successful save to a non-volatile
                          storage."
    ::= { pgmSource 16 }

-- PGM Source per TSI management information

pgmSourceTsi OBJECT IDENTIFIER ::= { pgmSource 100 }

pgmSourceNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of PGM Source sessions."
    ::= { pgmSourceTsi 1 }

-- PGM Source Fault Management Table

pgmSourceTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmSourceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI fault
             management and general information
             related to PGM Source."
    ::= {pgmSourceTsi 2}

pgmSourceEntry OBJECT-TYPE
    SYNTAX     PgmSourceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM sender information."
    INDEX   { pgmSourceGlobalId,
              pgmSourceSourcePort }
    ::= { pgmSourceTable 1 }

PgmSourceEntry ::= SEQUENCE {
    pgmSourceGlobalId
        OCTET STRING,
    pgmSourceSourcePort
        Unsigned32,
    pgmSourceSourceAddress
        IpAddress,
    pgmSourceGroupAddress
        IpAddress,
    pgmSourceDestPort
        Unsigned32,
    pgmSourceSourceGsi
        OCTET STRING,
    pgmSourceSourcePortNumber
        Unsigned32
    }

pgmSourceGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique session identifier (GSI)."
    ::= { pgmSourceEntry 1 }

pgmSourceSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmSourceEntry 2 }

pgmSourceSourceAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Source IP address."
    ::= { pgmSourceEntry 3 }

pgmSourceGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "IP Multicast group address used by the
             sender."
    ::= { pgmSourceEntry 4 }

pgmSourceDestPort OBJECT-TYPE
    SYNTAX     Unsigned32 (0..65535)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Destination port number."
    ::= { pgmSourceEntry 5 }

pgmSourceSourceGsi OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Globally unique session identifier (GSI)."
    ::= { pgmSourceEntry 6 }

pgmSourceSourcePortNumber OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmSourceEntry 7 }


-- PGM Source Configuration Management Table

pgmSourceConfigTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmSourceConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI 
             configuration information
             related to the PGM Source."
    ::= {pgmSourceTsi 3}

pgmSourceConfigEntry OBJECT-TYPE
    SYNTAX     PgmSourceConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM sender information."
    INDEX   { pgmSourceConfigGlobalId,
              pgmSourceConfigSourcePort }
    ::= { pgmSourceConfigTable 1 }

PgmSourceConfigEntry ::= SEQUENCE {
    pgmSourceConfigGlobalId
        OCTET STRING,
    pgmSourceConfigSourcePort
        Unsigned32,
    pgmSourceTtl
        Unsigned32,
    pgmSourceAdvMode
        INTEGER,
    pgmSourceLateJoin
        INTEGER,
    pgmSourceTxwMaxRte
        Unsigned32,
    pgmSourceTxwSecs
        Unsigned32,
    pgmSourceTxwAdvSecs
        Unsigned32,
    pgmSourceAdvIvl
        Unsigned32,
    pgmSourceSpmIvl
        Unsigned32,
    pgmSourceSpmHeartBeatIvlMin
        Unsigned32,
    pgmSourceSpmHeartBeatIvlMax
        Unsigned32,
    pgmSourceRdataBackoffIvl
        Unsigned32,
    pgmSourceFEC
        INTEGER,
    pgmSourceFECTransmissionGrpSize
        Unsigned32,
    pgmSourceFECProactiveParitySize
        Unsigned32,
    pgmSourceSpmPathAddress
        IpAddress
    }

pgmSourceConfigGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique session identifier (GSI)."
    ::= { pgmSourceConfigEntry 1 }

pgmSourceConfigSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmSourceConfigEntry 2 }

pgmSourceTtl OBJECT-TYPE
    SYNTAX     Unsigned32(1..255)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "TTL used by sender."
    ::= { pgmSourceConfigEntry 3 }

pgmSourceAdvMode OBJECT-TYPE
    SYNTAX     INTEGER { data(1), 
                         time(2),
                        applctrl(3),
                        other(4) }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag to indicate that the transmit window is
             advanced with data, by time, under application
             control, or any other method."
    ::= { pgmSourceConfigEntry 4 }

pgmSourceLateJoin OBJECT-TYPE
    SYNTAX     INTEGER { 
                  enable(1), 
                  disable(2) 
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not the sender will
             accept late joiners."
    ::= { pgmSourceConfigEntry 5 }

pgmSourceTxwMaxRte OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Maximum transmit rate in bytes/second."
    ::= { pgmSourceConfigEntry 6 }

pgmSourceTxwSecs OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Transmit window size in seconds."
    ::= { pgmSourceConfigEntry 7 }

pgmSourceTxwAdvSecs OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Transmit window advance in seconds. This value
             should always be set to a value smaller than
             the pgmSourceTxwSecs."
    ::= { pgmSourceConfigEntry 8 }

pgmSourceAdvIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Advance interval in milliseconds. Always a
             valid parameter when advancing with time.
             Valid only in cases of absence of lost data
             when advancing with data."
    ::= { pgmSourceConfigEntry 9 }

pgmSourceSpmIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "SPM interval in milliseconds."
    ::= { pgmSourceConfigEntry 10 }

pgmSourceSpmHeartBeatIvlMin OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "SPM heartbeat interval in milliseconds."
    ::= { pgmSourceConfigEntry 11 }

pgmSourceSpmHeartBeatIvlMax OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Maximum SPM heartbeat interval in milliseconds."
    ::= { pgmSourceConfigEntry 12 }

pgmSourceRdataBackoffIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "RDATA backoff interval in milliseconds."
    ::= { pgmSourceConfigEntry 13 }

pgmSourceFEC OBJECT-TYPE
    SYNTAX     INTEGER { disabled(1),
                         enabledFixedPacketSize(2),
                         enabledVariablePacketSize(3) }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not FEC is enabled
             and whether it supports variable or fixed size
             messages."
    ::= { pgmSourceConfigEntry 14 }

pgmSourceFECTransmissionGrpSize OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "FEC transmission group size."
    ::= { pgmSourceConfigEntry 15 }

pgmSourceFECProactiveParitySize OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Number of proactive parity messages per FEC
             block."
    ::= { pgmSourceConfigEntry 16 }

pgmSourceSpmPathAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Ip Address for the NAKs to be sent,
             in case that NE is not set."
    ::= { pgmSourceConfigEntry 17 }

-- PGM Source Performance Management Table

pgmSourcePerformanceTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmSourcePerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI performance 
             information related to the PGM Source."
    ::= {pgmSourceTsi 4}

pgmSourcePerformanceEntry OBJECT-TYPE
    SYNTAX     PgmSourcePerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM sender information."
    INDEX   { pgmSourcePerformanceGlobalId,
              pgmSourcePerformanceSourcePort }
    ::= { pgmSourcePerformanceTable 1 }

PgmSourcePerformanceEntry ::= SEQUENCE {
    pgmSourcePerformanceGlobalId
        OCTET STRING,
    pgmSourcePerformanceSourcePort
        Unsigned32,
    pgmSourceDataBytesSent
        Counter32,
    pgmSourceDataMsgsSent
        Counter32,
    pgmSourceBytesBuffered
        Counter32,
    pgmSourceMsgsBuffered
        Counter32,
    pgmSourceBytesRetransmitted
        Counter32,
    pgmSourceMsgsRetransmitted
        Counter32,
    pgmSourceBytesSent
        Counter32,
    pgmSourceRawNaksReceived
        Counter32,
    pgmSourceNaksIgnored
        Counter32,
    pgmSourceCksumErrors
        Counter32,
    pgmSourceMalformedNaks
        Counter32,
    pgmSourcePacketsDiscarded
        Counter32,
    pgmSourceNaksRcvd
        Counter32,
    pgmSourceParityBytesRetransmitted
        Counter32,
    pgmSourceSelectiveBytesRetransmited
	Counter32,
    pgmSourceParityMsgsRetransmitted
	Counter32,
    pgmSourceSelectiveMsgsRetransmitted
	Counter32,
    pgmSourceBytesAdmit
	Counter32,
    pgmSourceMsgsAdmit
	Counter32,
    pgmSourceParityNakPacketsReceived
	Counter32,
    pgmSourceSelectiveNakPacketsReceived
	Counter32,
    pgmSourceParityNaksReceived
	Counter32,
    pgmSourceSelectiveNaksReceived
	Counter32,
    pgmSourceParityNaksIgnored
	Counter32,
    pgmSourceSelectiveNaksIgnored
	Counter32,
    pgmSourceAckErrors
	Counter32,
    pgmSourcePgmCCAcker
	IpAddress,
    pgmSourceTransmissionCurrentRate
	Counter32,
    pgmSourceAckPacketsReceived
	Counter32,
    pgmSourceNNakPacketsReceived
	Counter32,
    pgmSourceParityNNakPacketsReceived
	Counter32,
    pgmSourceSelectiveNNakPacketsReceived
	Counter32,
    pgmSourceNNaksReceived
	Counter32,
    pgmSourceParityNNaksReceived
	Counter32,
    pgmSourceSelectiveNNaksReceived
	Counter32,
    pgmSourceNNakErrors
	Counter32
}

pgmSourcePerformanceGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmSourcePerformanceEntry 1 }

pgmSourcePerformanceSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmSourcePerformanceEntry 2 }

pgmSourceDataBytesSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of data bytes sent for this TSI."
    ::= { pgmSourcePerformanceEntry 3 }

pgmSourceDataMsgsSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of data messages sent for this TSI."
    ::= { pgmSourcePerformanceEntry 4 }

pgmSourceBytesBuffered OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes currently buffered for this 
             TSI."
    ::= { pgmSourcePerformanceEntry 5 }

pgmSourceMsgsBuffered OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of messages currently buffered for 
             this TSI."
    ::= { pgmSourcePerformanceEntry 6 }

pgmSourceBytesRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes retransmitted for this TSI."
    ::= { pgmSourcePerformanceEntry 7 }

pgmSourceMsgsRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of messages retransmitted for this TSI."
    ::= { pgmSourcePerformanceEntry 8 }

pgmSourceBytesSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of bytes send for this TSI. Includes
             IP header and non-data messages."
    ::= { pgmSourcePerformanceEntry 9 }

pgmSourceRawNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Raw number of NAK packets received."
    ::= { pgmSourcePerformanceEntry 10 }

pgmSourceNaksIgnored OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of ignored Naks for this TSI, due to
             duplicate NAKs reception."
    ::= { pgmSourcePerformanceEntry 11 }

pgmSourceCksumErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of checksum errors for this TSI."
    ::= { pgmSourcePerformanceEntry 12 }

pgmSourceMalformedNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed NAK packets."
    ::= { pgmSourcePerformanceEntry 13 }

pgmSourcePacketsDiscarded OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of discarded data packets. This counter
             is used to count all discarded incoming packets
             per TSI in cases of duplicates, header and
             packet errors, etc." 
    ::= { pgmSourcePerformanceEntry 14 }

pgmSourceNaksRcvd OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Sequence Numbers NAKed."
    ::= { pgmSourcePerformanceEntry 15 }

pgmSourceParityBytesRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes sent in parity retransmissions."
    ::= { pgmSourcePerformanceEntry 16 }

pgmSourceSelectiveBytesRetransmited OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes sent in selective retransmissions."
    ::= { pgmSourcePerformanceEntry 17 }

pgmSourceParityMsgsRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity retransmissions sent."
    ::= { pgmSourcePerformanceEntry 18 }

pgmSourceSelectiveMsgsRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective retransmissions sent."
    ::= { pgmSourcePerformanceEntry 19 }

pgmSourceBytesAdmit OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes currently in the rate controled
             admit queue. Includes IP header, UDP header if
             encapsulated, PGM header, and data."
    ::= { pgmSourcePerformanceEntry 20 }

pgmSourceMsgsAdmit OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of messages currently in the rate controled
             admit queue. Includes data messages, retransmissions,
             and SPMs."
    ::= { pgmSourcePerformanceEntry 21 }

pgmSourceParityNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity NAK packets received."
    ::= { pgmSourcePerformanceEntry 22 }

pgmSourceSelectiveNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective NAK packets received."
    ::= { pgmSourcePerformanceEntry 23 }

pgmSourceParityNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs received."
    ::= { pgmSourcePerformanceEntry 24 }

pgmSourceSelectiveNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs received."
    ::= { pgmSourcePerformanceEntry 25 }

pgmSourceParityNaksIgnored OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs ignored."
    ::= { pgmSourcePerformanceEntry 26 }

pgmSourceSelectiveNaksIgnored OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs ignored."
    ::= { pgmSourcePerformanceEntry 27 }

pgmSourceAckErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of ACK packets received with error in
             them, different than checksum error."
    ::= { pgmSourcePerformanceEntry 28 }

pgmSourcePgmCCAcker OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Ip Address of the currently designated pgm
             congestion control ACKER."
    ::= { pgmSourcePerformanceEntry 29 }

pgmSourceTransmissionCurrentRate OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Current transmission rate."
    ::= { pgmSourcePerformanceEntry 30 }

pgmSourceAckPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of ACK packets received."
    ::= { pgmSourcePerformanceEntry 31 }

pgmSourceNNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Null NAKs received."
    ::= { pgmSourcePerformanceEntry 32 }

pgmSourceParityNNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity Null NAK packets received."
    ::= { pgmSourcePerformanceEntry 33 }

pgmSourceSelectiveNNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective Null NAK packets received."
    ::= { pgmSourcePerformanceEntry 34 }

pgmSourceNNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs, received in Null
             NAK packets."
    ::= { pgmSourcePerformanceEntry 35 }

pgmSourceParityNNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs, 
             received in Null NAK packets."
    ::= { pgmSourcePerformanceEntry 36 }

pgmSourceSelectiveNNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual  NAKs, 
             received in Null NAK packets."
    ::= { pgmSourcePerformanceEntry 37 }

pgmSourceNNakErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Null NAK packets received that contain
             error, different than checksum error."
    ::= { pgmSourcePerformanceEntry 38 }

--
-- PGM Receiver 
--

-- PGM Receiver general management information

pgmReceiverSaveDefaults OBJECT-TYPE
    SYNTAX     INTEGER { initial (1),
                         save (2), 
                         pending (3),
                         success (4),
                         failure (5) }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag used to initiate the storing 
             of all default variable values to 
             non-volatile storage and to report the 
             result of the operation.
             The following values can only be read,
             never written :
             initial(1) - returned prior to any requests
             for saving the default configuration
             pending(3) - saving in progress
             success(4) - returned when a save(2) request
             is successful
             failure(5) - returned when a save(2) request
             is unsuccessful

             The following values can only be written,
             never read :
             save(2) - to indicate that the default
             configuration should be saved."
    ::= { pgmReceiver 1 }

pgmReceiverLastUpdateTime OBJECT-TYPE
    SYNTAX     TimeTicks
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of TimeTicks since the last update
             of the non-volatile storage." 
    ::= { pgmReceiver 2 }

pgmReceiverDefaultNakBackoffIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "NAK random backoff interval."
    ::= { pgmReceiver 3 }

pgmReceiverDefaultNakRepeatIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "NAK repeat interval."
    ::= { pgmReceiver 4 }

pgmReceiverDefaultNakNcfRetries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Max NAK retries while witing for matching NCF."
    ::= { pgmReceiver 5 }

pgmReceiverDefaultNakRdataIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Default NAK RDATA interval, i.e the amount of
             time to cease NAKs for a particular piece of
             data after a corresponding NCF has been received."
    ::= { pgmReceiver 6 }

pgmReceiverDefaultNakDataRetries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Max NAK retries while waiting for missing data."
    ::= { pgmReceiver 7 }

pgmReceiverDefaultSendNaks OBJECT-TYPE
    SYNTAX     INTEGER { 
                        enabled(1), 
                        disabled(2) 
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not receiver should
             send NAKs or be totally passive."
    ::= { pgmReceiver 8 }

pgmReceiverDefaultLateJoin OBJECT-TYPE
    SYNTAX     INTEGER { 
                        enabled(1), 
                        disabled(2) 
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not the receiver
             should wait for a OPT_JOIN SPM before 
             attempting to late join."
    ::= { pgmReceiver 9 }

pgmReceiverDefaultNakTtl OBJECT-TYPE
    SYNTAX     Unsigned32(1..255)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "TTL on NAK packets sent for loss."
    ::= { pgmReceiver 10 }

pgmReceiverDefaultDeliveryOrder OBJECT-TYPE
    SYNTAX     INTEGER {
                        unordered(1),
                        ordered(2)
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Packet Delivery Order for the receiving 
             application."
    ::= { pgmReceiver 11 }

pgmReceiverDefaultNextPgmHop OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Next hop PGM router address. This option
             sets the default address to send NAKs to,
             instead of sending to the last hop address." 
    ::= { pgmReceiver 12 }

pgmReceiverDefaultGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Default IP Multicast group address 
             used by the sender."
    ::= { pgmReceiver 13 }

pgmReceiverUpdateSinceLastSave OBJECT-TYPE
    SYNTAX     INTEGER
               {
                   notUpdated(1),
                   updated(2)
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Specifies if any of the Receiver Default
             variables have been updated or not,
             since the last successful pgmSourceSaveDefaults.
             notUpdated - none of the default Receiver
                          variables were set after the last
                          successful save to a non-volatile
                          storage.
             updated - at least one of the default Receiver
                          variables were set after the last
                          successful save to a non-volatile
                          storage."
    ::= { pgmReceiver 14 }

pgmReceiverDefaultNakFailureThresholdTimer OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Timer that defines the default 
             interval of time during which unrecoverable
             lost packets are monitored
             for purposes of SNMP trap generation."
    ::= { pgmReceiver 15 }

pgmReceiverDefaultNakFailureThreshold OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The default number of unrecoverable 
             lost packets within the defined interval
             after which an SNMP trap is generated."
    ::= { pgmReceiver 16 }


-- PGM Receiver per Receiver management information

pgmReceiverTsi OBJECT IDENTIFIER ::= { pgmReceiver 100 }

pgmReceiverNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of PGM Receivers."
    ::= { pgmReceiverTsi 1 }

-- PGM Receiver Fault Management Table

pgmReceiverTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmReceiverEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI fault 
             management and general information 
             related to the PGM Receiver."
    ::= {pgmReceiverTsi 2}

pgmReceiverEntry OBJECT-TYPE
    SYNTAX     PgmReceiverEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM receiver fault management
             and general information."
    INDEX   { pgmReceiverGlobalId,
              pgmReceiverSourcePort,
              pgmReceiverInstance }
    ::= { pgmReceiverTable 1 }

PgmReceiverEntry ::= SEQUENCE {
    pgmReceiverGlobalId
        OCTET STRING,
    pgmReceiverSourcePort
        Unsigned32,
    pgmReceiverInstance
        Unsigned32,
    pgmReceiverGroupAddress
        IpAddress,
    pgmReceiverDestPort
        Unsigned32,
    pgmReceiverSourceAddress
        IpAddress,
    pgmReceiverLastHop
        IpAddress,
    pgmReceiverSourceGsi
        OCTET STRING,
    pgmReceiverSourcePortNumber
        Unsigned32,
    pgmReceiverUniqueInstance
        Unsigned32
    }

pgmReceiverGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmReceiverEntry 1 }

pgmReceiverSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmReceiverEntry 2 }

pgmReceiverInstance OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Positive number, uniquely identifying 
             a Receiver."
    ::= { pgmReceiverEntry 3 }

pgmReceiverGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "IP Multicast group address used by the sender."
    ::= { pgmReceiverEntry 4 }

pgmReceiverDestPort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Destination port number."
    ::= { pgmReceiverEntry 5 }

pgmReceiverSourceAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Source IP address number."
    ::= { pgmReceiverEntry 6 }

pgmReceiverLastHop OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Last hop PGM router address."
    ::= { pgmReceiverEntry 7 }

pgmReceiverSourceGsi OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmReceiverEntry 8 }

pgmReceiverSourcePortNumber OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmReceiverEntry 9 }

pgmReceiverUniqueInstance OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Positive number, uniquely identifying 
             a Receiver."
    ::= { pgmReceiverEntry 10 }

-- PGM Receiver Configuration Management Table

pgmReceiverConfigTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmReceiverConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI configuration 
             management information related 
             to the PGM Receiver."
    ::= {pgmReceiverTsi 3 }

pgmReceiverConfigEntry OBJECT-TYPE
    SYNTAX     PgmReceiverConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM receiver configuration management
             information."
    INDEX   { pgmReceiverConfigGlobalId,
              pgmReceiverConfigSourcePort,
              pgmReceiverConfigInstance }
    ::= { pgmReceiverConfigTable 1 }

PgmReceiverConfigEntry ::= SEQUENCE {
    pgmReceiverConfigGlobalId
        OCTET STRING,
    pgmReceiverConfigSourcePort
        Unsigned32,
    pgmReceiverConfigInstance
        Unsigned32,
    pgmReceiverNakBackoffIvl
        Unsigned32,
    pgmReceiverNakRepeatIvl
        Unsigned32,
    pgmReceiverNakNcfRetries
        Unsigned32,
    pgmReceiverNakRdataIvl
        Unsigned32,
    pgmReceiverNakDataRetries
        Unsigned32,
    pgmReceiverSendNaks
        INTEGER,
    pgmReceiverLateJoin
        INTEGER,
    pgmReceiverNakTtl
        Unsigned32,
    pgmReceiverDeliveryOrder
        INTEGER,
    pgmReceiverMcastNaks
        INTEGER,
    pgmReceiverNakFailureThresholdTimer
        Unsigned32,
    pgmReceiverNakFailureThreshold
        Unsigned32
    }

pgmReceiverConfigGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmReceiverConfigEntry 1 }

pgmReceiverConfigSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmReceiverConfigEntry 2 }

pgmReceiverConfigInstance OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Positive number, uniquely identifying 
             a Receiver."
    ::= { pgmReceiverConfigEntry 3 }

pgmReceiverNakBackoffIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "NAK random backoff interval."
    ::= { pgmReceiverConfigEntry 4 }

pgmReceiverNakRepeatIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "NAK repeat interval."
    ::= { pgmReceiverConfigEntry 5 }

pgmReceiverNakNcfRetries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Max NAK retries while witing for matching NCF."
    ::= { pgmReceiverConfigEntry 6 }

pgmReceiverNakRdataIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "NAK RDATA interval."
    ::= { pgmReceiverConfigEntry 7 }

pgmReceiverNakDataRetries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Max NAK retries while waiting for missing data."
    ::= { pgmReceiverConfigEntry 8 }

pgmReceiverSendNaks OBJECT-TYPE
    SYNTAX     INTEGER { 
                        enabled(1), 
                        disabled(2) 
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not receiver should
             send NAKs or be totally passive."
    ::= { pgmReceiverConfigEntry 9 }

pgmReceiverLateJoin OBJECT-TYPE
    SYNTAX     INTEGER { 
                        enabled(1), 
                        disabled(2) 
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not the receiver
             should wait for a OPT_JOIN SPM before 
             attempting to late join."
    ::= { pgmReceiverConfigEntry 10 }

pgmReceiverNakTtl OBJECT-TYPE
    SYNTAX     Unsigned32(1..255)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "TTL on NAK packets sent for loss."
    ::= { pgmReceiverConfigEntry 11 }

pgmReceiverDeliveryOrder OBJECT-TYPE
    SYNTAX     INTEGER {
                        unordered(1),
                        ordered(2)
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Packet Delivery Order for the receiving 
             application."
    ::= { pgmReceiverConfigEntry 12 }

pgmReceiverMcastNaks OBJECT-TYPE
    SYNTAX     INTEGER { 
                        enabled(1), 
                        disabled(2) 
               }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag to indicate whether or not receiver should
             send multicast NAKs."
    ::= { pgmReceiverConfigEntry 13 }

pgmReceiverNakFailureThresholdTimer OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "seconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Timer that defines per receiver
             interval of time during which unrecoverable
             lost packets are monitored
             for purposes of SNMP trap generation."
    ::= { pgmReceiverConfigEntry 14 }

pgmReceiverNakFailureThreshold OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "The number of unrecoverable lost packets 
             within the defined interval
             after which an SNMP trap is generated."
    ::= { pgmReceiverConfigEntry 15 }


-- PGM Receiver Performance Management Table

pgmReceiverPerformanceTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmReceiverPerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI
             performance management information 
             related to the PGM Receiver."
    ::= {pgmReceiverTsi 4}

pgmReceiverPerformanceEntry OBJECT-TYPE
    SYNTAX     PgmReceiverPerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM Receiver session performance 
             management information."
    INDEX   { pgmReceiverPerformanceGlobalId,
              pgmReceiverPerformanceSourcePort,
              pgmReceiverPerformanceInstance }
    ::= { pgmReceiverPerformanceTable 1 }

PgmReceiverPerformanceEntry ::= SEQUENCE {
    pgmReceiverPerformanceGlobalId
        OCTET STRING,
    pgmReceiverPerformanceSourcePort
        Unsigned32,
    pgmReceiverPerformanceInstance
        Unsigned32,
    pgmReceiverDataBytesReceived
        Counter32,
    pgmReceiverDataMsgsReceived
        Counter32,
    pgmReceiverNaksSent
        Counter32,
    pgmReceiverNaksRetransmitted
        Counter32,
    pgmReceiverNakFailures
        Counter32,
    pgmReceiverBytesReceived
        Counter32,
    pgmReceiverNaksSuppressed
        Counter32,
    pgmReceiverCksumErrors
        Counter32,
    pgmReceiverMalformedSpms
        Counter32,
    pgmReceiverMalformedOdata
        Counter32,
    pgmReceiverMalformedRdata
        Counter32,
    pgmReceiverMalformedNcfs
        Counter32,
    pgmReceiverPacketsDiscarded
        Counter32,
    pgmReceiverLosses
        Counter32,
    pgmReceiverBytesDeliveredToApp
        Counter32,
    pgmReceiverMsgsDeliveredToApp
        Counter32,
    pgmReceiverDupSpms
        Counter32,
    pgmReceiverDupDatas
        Counter32,
    pgmReceiverDupParities
        Counter32,
    pgmReceiverNakPacketsSent
        Counter32,
    pgmReceiverParityNakPacketsSent
        Counter32,
    pgmReceiverSelectiveNakPacketsSent
        Counter32,
    pgmReceiverParityNaksSent
        Counter32,
    pgmReceiverSelectiveNaksSent
        Counter32,
    pgmReceiverParityNaksRetransmitted
        Counter32,
    pgmReceiverSelectiveNaksRetransmitted
        Counter32,
    pgmReceiverNaksFailed
        Counter32,
    pgmReceiverParityNaksFailed
        Counter32,
    pgmReceiverSelectiveNaksFailed
        Counter32,
    pgmReceiverNaksFailedRxwAdvanced
        Counter32,
    pgmReceiverNaksFaledNcfRetriesExceeded
        Counter32,
    pgmReceiverNaksFailedDataRetriesExceeded
        Counter32,
    pgmReceiverNaksFailedGenExpired
        Counter32,
    pgmReceiverNakFailuresDelivered
        Counter32,
    pgmReceiverParityNaksSuppressed
        Counter32,
    pgmReceiverSelectiveNaksSuppressed
        Counter32,
    pgmReceiverNakErrors
        Counter32,
    pgmReceiverOutstandingParityNaks
        Counter32,
    pgmReceiverOutstandingSelectiveNaks
        Counter32,
    pgmReceiverLastActivity
        Counter32,
    pgmReceiverNakSvcTimeMin
        Counter32,
    pgmReceiverNakSvcTimeMean
        Counter32,
    pgmReceiverNakSvcTimeMax
        Counter32,
    pgmReceiverNakFailTimeMin
        Counter32,
    pgmReceiverNakFailTimeMean
        Counter32,
    pgmReceiverNakFailTimeMax
        Counter32,
    pgmReceiverNakTransmitMin
        Counter32,
    pgmReceiverNakTransmitMean
        Counter32,
    pgmReceiverNakTransmitMax
        Counter32,
    pgmReceiverAcksSent
        Counter32,
    pgmReceiverRxwTrail
        Counter32,
    pgmReceiverRxwLead
        Counter32,
    pgmReceiverNakFailuresLastInterval
        Counter32,
    pgmReceiverLastIntervalNakFailures
        Counter32
}

pgmReceiverPerformanceGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmReceiverPerformanceEntry 1 }

pgmReceiverPerformanceSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmReceiverPerformanceEntry 2 }

pgmReceiverPerformanceInstance OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Positive number, uniquely identifying 
             a Receiver."
    ::= { pgmReceiverPerformanceEntry 3 }

pgmReceiverDataBytesReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of data bytes received for this PGM
             Receiver session."
    ::= { pgmReceiverPerformanceEntry 4 }

pgmReceiverDataMsgsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of data messages received for this
             PGM Receiver session."
    ::= { pgmReceiverPerformanceEntry 5 }

pgmReceiverNaksSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs sent for this session."
    ::= { pgmReceiverPerformanceEntry 6 }

pgmReceiverNaksRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs retransmitted for this 
             session."
    ::= { pgmReceiverPerformanceEntry 7 }

pgmReceiverNakFailures OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAK failures for this session.
             This counter represents the number of
             unrecoverable/unrepairable data packets."
    ::= { pgmReceiverPerformanceEntry 8 }

pgmReceiverBytesReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes received for this session.
             It counts all bytes received, including IP 
             and PGM header and non-data messages."
    ::= { pgmReceiverPerformanceEntry 9 }

pgmReceiverNaksSuppressed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of suppressed NAKs."
    ::= { pgmReceiverPerformanceEntry 10 }

pgmReceiverCksumErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of checksum errors for this session."
    ::= { pgmReceiverPerformanceEntry 11 }

pgmReceiverMalformedSpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed SPMs for this session."
    ::= { pgmReceiverPerformanceEntry 12 }

pgmReceiverMalformedOdata OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed ODATA packets for this
             session."
    ::= { pgmReceiverPerformanceEntry 13 }

pgmReceiverMalformedRdata OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed RDATA packets for this
             session."
    ::= { pgmReceiverPerformanceEntry 14 }

pgmReceiverMalformedNcfs OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed NCF packets for this
             session."
    ::= { pgmReceiverPerformanceEntry 15 }

pgmReceiverPacketsDiscarded OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of discarded packets for this
             session."
    ::= { pgmReceiverPerformanceEntry 16 }

pgmReceiverLosses OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of detected missed packets for 
             this session. This counter is incremented
             every time a Receiver detects a missing 
             packet."
    ::= { pgmReceiverPerformanceEntry 17 }

pgmReceiverBytesDeliveredToApp OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes, delivered to the
             application."
    ::= { pgmReceiverPerformanceEntry 18 }

pgmReceiverMsgsDeliveredToApp OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of messages, delivered to the
             application."
    ::= { pgmReceiverPerformanceEntry 19 }

pgmReceiverDupSpms OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of duplicate SPMs."
    ::= { pgmReceiverPerformanceEntry 20 }

pgmReceiverDupDatas OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of duplicate RDATA/ODATA."
    ::= { pgmReceiverPerformanceEntry 21 }

pgmReceiverDupParities OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of duplicate parities seen."
    ::= { pgmReceiverPerformanceEntry 22 }

pgmReceiverNakPacketsSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAK packets sent.
             Includes parity and selective."
    ::= { pgmReceiverPerformanceEntry 23 }

pgmReceiverParityNakPacketsSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity NAK packets sent."
    ::= { pgmReceiverPerformanceEntry 24 }

pgmReceiverSelectiveNakPacketsSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective NAK packets sent."
    ::= { pgmReceiverPerformanceEntry 25 }

pgmReceiverParityNaksSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAK packets sent."
    ::= { pgmReceiverPerformanceEntry 26 }

pgmReceiverSelectiveNaksSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAK packets sent."
    ::= { pgmReceiverPerformanceEntry 27 }

pgmReceiverParityNaksRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs retransmitted."
    ::= { pgmReceiverPerformanceEntry 28 }

pgmReceiverSelectiveNaksRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs retransmitted."
    ::= { pgmReceiverPerformanceEntry 29 }

pgmReceiverNaksFailed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs that failed."
    ::= { pgmReceiverPerformanceEntry 30 }

pgmReceiverParityNaksFailed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs that failed."
    ::= { pgmReceiverPerformanceEntry 31 }

pgmReceiverSelectiveNaksFailed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs that failed."
    ::= { pgmReceiverPerformanceEntry 32 }

pgmReceiverNaksFailedRxwAdvanced OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs that failed, due to the
             window being advanced over them."
    ::= { pgmReceiverPerformanceEntry 33 }

pgmReceiverNaksFaledNcfRetriesExceeded OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs that failed, due to ncf
             retry limit exceeded."
    ::= { pgmReceiverPerformanceEntry 34 }

pgmReceiverNaksFailedDataRetriesExceeded OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs that failed, due to data 
             retry limit exceeded."
    ::= { pgmReceiverPerformanceEntry 35 }

pgmReceiverNaksFailedGenExpired OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs that failed, due to NAK
             generation interval expiring before it 
             could be repaired."
    ::= { pgmReceiverPerformanceEntry 36 }

pgmReceiverNakFailuresDelivered OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAK failures delivered to application."
    ::= { pgmReceiverPerformanceEntry 37 }

pgmReceiverParityNaksSuppressed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs that were
             suppressed from being sent due to reception
             of an NCF or ODATA/RDATA for the loss."
    ::= { pgmReceiverPerformanceEntry 38 }

pgmReceiverSelectiveNaksSuppressed OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs that were
             suppressed from being sent due to reception
             of an NCF or ODATA/RDATA for the loss."
    ::= { pgmReceiverPerformanceEntry 39 }

pgmReceiverNakErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAK packets, that contained
             errors in them."
    ::= { pgmReceiverPerformanceEntry 40 }

pgmReceiverOutstandingParityNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Current number of outstanding individual parity 
             NAKs that are waiting to be repaired."
    ::= { pgmReceiverPerformanceEntry 41 }

pgmReceiverOutstandingSelectiveNaks OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Current number of outstanding individual selective
             NAKs that are waiting to be repaired."
    ::= { pgmReceiverPerformanceEntry 42 }

pgmReceiverLastActivity OBJECT-TYPE
    SYNTAX  Counter32  
    UNITS      "seconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Last time activity was observed from
             the Source. In seconds since the epoch,
             January 1, 1970."
    ::= { pgmReceiverPerformanceEntry 43 }

pgmReceiverNakSvcTimeMin OBJECT-TYPE
    SYNTAX     Counter32
    UNITS      "miliseconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The min time that it took for a loss
             to be repaired."
    ::= { pgmReceiverPerformanceEntry 44 }

pgmReceiverNakSvcTimeMean OBJECT-TYPE
    SYNTAX     Counter32
    UNITS      "miliseconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The mean time that it took for all losses
             to be repaired."
    ::= { pgmReceiverPerformanceEntry 45 }

pgmReceiverNakSvcTimeMax OBJECT-TYPE
    SYNTAX     Counter32
    UNITS      "miliseconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The max time that it took for a loss
             to be repaired."
    ::= { pgmReceiverPerformanceEntry 46 }

pgmReceiverNakFailTimeMin OBJECT-TYPE
    SYNTAX     Counter32
    UNITS      "miliseconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The min time it took for a loss
             to be considered unrecoverable."
    ::= { pgmReceiverPerformanceEntry 47 }

pgmReceiverNakFailTimeMean OBJECT-TYPE
    SYNTAX     Counter32
    UNITS      "miliseconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The mean time it took for all losses
            to be considered unrecoverable."
    ::= { pgmReceiverPerformanceEntry 48 }

pgmReceiverNakFailTimeMax OBJECT-TYPE
    SYNTAX     Counter32
    UNITS      "miliseconds"
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The max time it took for a loss
             to be considered unrecoverable."
    ::= { pgmReceiverPerformanceEntry 49 }

pgmReceiverNakTransmitMin OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The min number of times an individual NAK
             needed to be retransmitted before it was repaired."
    ::= { pgmReceiverPerformanceEntry 50 }

pgmReceiverNakTransmitMean OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The mean number of times an individual NAK
             needed to be retransmitted before it was repaired."
    ::= { pgmReceiverPerformanceEntry 51 }

pgmReceiverNakTransmitMax OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The max number of times an individual NAK
             needed to be retransmitted before it was repaired."
    ::= { pgmReceiverPerformanceEntry 52 }

pgmReceiverAcksSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The number of ACKs sent from the congestion
             control operation."
    ::= { pgmReceiverPerformanceEntry 53 }

pgmReceiverRxwTrail OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Sequence number of the trailing edge of 
             the transmission window as is being advertised
             by the sender."
    ::= { pgmReceiverPerformanceEntry 54 }

pgmReceiverRxwLead OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Sequence number of the leading edge of 
             the transmission window as is being advertised
             by the sender."
    ::= { pgmReceiverPerformanceEntry 55 }

pgmReceiverNakFailuresLastInterval OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The actual number of seconds since the
             last pgmReceiverLastIntervalNakFailures
             counter reset due to number of nak failures 
             threshold exceeded."
    ::= { pgmReceiverPerformanceEntry 56 }

pgmReceiverLastIntervalNakFailures OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of actual unrecoverable failures for 
             the requested threshold interval for this session."
    ::= { pgmReceiverPerformanceEntry 57 }

--
-- Designated Local Repairer (DLR) 
--

-- Designated Local Repairer (DLR) Default Configuration

pgmDlrSaveDefaults OBJECT-TYPE
    SYNTAX     INTEGER { initial (1),
                         save (2), 
                         pending (3),
                         success (4),
                         failure (5) }
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Flag used to initiate the storing 
             of all default variable values to 
             non-volatile storage and to report the 
             result of the operation.
             The following values can only be read,
             never written :
             initial(1) - returned prior to any requests
             for saving the default configuration
             pending(3) - saving in progress
             success(4) - returned when a save(2) request
             is successful
             failure(5) - returned when a save(2) request
             is unsuccessful

             The following values can only be written,
             never read :
             save(2) - to indicate that the default
             configuration should be saved."
    ::= { pgmDLR 1 }

pgmDlrLastUpdateTime OBJECT-TYPE
    SYNTAX     TimeTicks
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of TimeTicks since the last update
             of the non-volatile storage." 
    ::= { pgmDLR 2 }

pgmDlrGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Multicast group address to listen for traffic
             on."
    ::= { pgmDLR 3 }

pgmDlrCacheRtx OBJECT-TYPE
    SYNTAX     INTEGER
               {
                   cacheOFF(1),
                   cacheON(2)
               } 
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Specifies if the NE should also cache data for
             retransmission or simply suppress duplicate 
             NAKs and forward the NAKs to it's parent NE or
             sender."  
    ::= { pgmDLR 4 }

pgmDlrActivityIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Specifies the delay between activity checks
             for specific PGM sessions."
    ::= { pgmDLR 5 }

pgmDlrMaxRate OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Specifies the maximum rate (in bps) for
             retransmissions."
    ::= { pgmDLR 6 }

pgmDlrParentNeAddr OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "Ip Address of the NE to send all NAKs to."
    ::= { pgmDLR 7 }

pgmDlrUpdateSinceLastSave OBJECT-TYPE
    SYNTAX     INTEGER
               {
                   notUpdated(1),
                   updated(2)
               }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Specifies if any of the Dlr Default
             variables have been updated or not,
             since the last successful pgmDlrSaveDefaults.
             notUpdated - none of the default Dlr
                          variables were set after the last
                          successful save to a non-volatile
                          storage.
             updated - at least one of the default Dlr
                          variables were set after the last
                          successful save to a non-volatile
                          storage."
    ::= { pgmDLR 8 }


--
-- PGM DLR Source/Re-transmitter Sessions
--
pgmDlrSource OBJECT IDENTIFIER ::= { pgmDLR 100 }

pgmDlrSourceNumberOfEntries OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The total number of PGM Source sessions for
             the PGM DLR."
    ::= { pgmDlrSource 1 }

-- PGM Dlr Source Fault Management Table

pgmDlrSourceTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmDlrSourceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI fault 
             management and general information 
             related to the PGM DLR Source sessions."
    ::= {pgmDlrSource 2}

pgmDlrSourceEntry OBJECT-TYPE
    SYNTAX     PgmDlrSourceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM DLR Source sessions fault 
             management information."
    INDEX   { pgmDlrSourceGlobalId,
              pgmDlrSourceSourcePort }
    ::= { pgmDlrSourceTable 1 }

PgmDlrSourceEntry ::= SEQUENCE {
    pgmDlrSourceGlobalId
        OCTET STRING,
    pgmDlrSourceSourcePort
        Unsigned32,
    pgmDlrSourceGroupAddress
        IpAddress,
    pgmDlrSourceSourceGsi
        OCTET STRING,
    pgmDlrSourceSourcePortNumber
        Unsigned32
    }

pgmDlrSourceGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmDlrSourceEntry 1 }

pgmDlrSourceSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmDlrSourceEntry 2 }

pgmDlrSourceGroupAddress OBJECT-TYPE
    SYNTAX     IpAddress
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Multicast group interface address 
             to send multicast packets on."
    ::= { pgmDlrSourceEntry 3 }

pgmDlrSourceSourceGsi OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmDlrSourceEntry 4 }

pgmDlrSourceSourcePortNumber OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmDlrSourceEntry 5 }

-- PGM DLR Source Configuration Management Table

pgmDlrSourceConfigTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmDlrSourceConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI configuration 
             management information related to the 
             PGM DLR Source sessions."
    ::= {pgmDlrSource 3}

pgmDlrSourceConfigEntry OBJECT-TYPE
    SYNTAX     PgmDlrSourceConfigEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM DLR Source sessions configuration 
             management information."
    INDEX   { pgmDlrSourceConfigGlobalId,
              pgmDlrSourceConfigSourcePort }
    ::= { pgmDlrSourceConfigTable 1 }

PgmDlrSourceConfigEntry ::= SEQUENCE {
    pgmDlrSourceConfigGlobalId
        OCTET STRING,
    pgmDlrSourceConfigSourcePort
        Unsigned32,
    pgmDlrSourceGroupTtl
        Unsigned32,
    pgmDlrSourceRdataBackoffIvl
        Unsigned32
    }

pgmDlrSourceConfigGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmDlrSourceConfigEntry 1 }

pgmDlrSourceConfigSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmDlrSourceConfigEntry 2 }

pgmDlrSourceGroupTtl OBJECT-TYPE
    SYNTAX     Unsigned32(1..255)
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "This option sets the default TTL to use for
             multicast packets. "
    ::= { pgmDlrSourceConfigEntry 3 }

pgmDlrSourceRdataBackoffIvl OBJECT-TYPE
    SYNTAX     Unsigned32
    UNITS      "milliseconds"
    MAX-ACCESS read-write
    STATUS     current
    DESCRIPTION
            "This option sets the default RDATA backoff
             interval. The value is expressed in milliseconds.
             The  value of 0 indicates no backoff."
    ::= { pgmDlrSourceConfigEntry 4 }


-- PGM DLR Source Performance Management Table

pgmDlrSourcePerformanceTable  OBJECT-TYPE
    SYNTAX SEQUENCE OF PgmDlrSourcePerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "The table holding per TSI performance 
             management information related to the 
             PGM DLR Source sessions."
    ::= {pgmDlrSource 4}

pgmDlrSourcePerformanceEntry OBJECT-TYPE
    SYNTAX     PgmDlrSourcePerformanceEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Per PGM DLR Source performance management
             information."
    INDEX   { pgmDlrSourcePerformanceGlobalId,
              pgmDlrSourcePerformanceSourcePort }
    ::= { pgmDlrSourcePerformanceTable 1 }

PgmDlrSourcePerformanceEntry ::= SEQUENCE {
    pgmDlrSourcePerformanceGlobalId
        OCTET STRING,
    pgmDlrSourcePerformanceSourcePort
        Unsigned32,
    pgmDlrSourceRdataMsgsSent
       Counter32,
    pgmDlrSourceRdataBytesSent
       Counter32,
    pgmDlrSourceBytesSent
       Counter32,
    pgmDlrSourceNaksRcvd
       Counter32,
    pgmDlrSourceNaksIgnored
       Counter32,
    pgmDlrSourceNakErrors
       Counter32,
    pgmDlrSourceDiscards
        Counter32,
    pgmDlrSourceCksumErrors
       Counter32,
    pgmDlrSourceNNaksSent
        Counter32,
    pgmDlrSourceBytesBuffered
        Counter32,
    pgmDlrSourceMsgsBuffered
        Counter32,
    pgmDlrSourceParityBytesRetransmitted
        Counter32,
    pgmDlrSourceSelectiveBytesRetransmited
	Counter32,
    pgmDlrSourceParityMsgsRetransmitted
	Counter32,
    pgmDlrSourceSelectiveMsgsRetransmitted
	Counter32,
    pgmDlrSourceBytesAdmit
	Counter32,
    pgmDlrSourceMsgsAdmit
	Counter32,
    pgmDlrSourceNakPacketsReceived
        Counter32,
    pgmDlrSourceParityNakPacketsReceived
	Counter32,
    pgmDlrSourceSelectiveNakPacketsReceived
	Counter32,
    pgmDlrSourceParityNaksReceived
	Counter32,
    pgmDlrSourceSelectiveNaksReceived
	Counter32,
    pgmDlrSourceParityNaksIgnored
	Counter32,
    pgmDlrSourceSelectiveNaksIgnored
	Counter32,
    pgmDlrSourceAckErrors
	Counter32,
    pgmDlrSourceNNakErrors
	Counter32,
    pgmDlrSourceAckPacketsReceived
	Counter32,
    pgmDlrSourceNNakPacketsReceived
	Counter32,
    pgmDlrSourceParityNNakPacketsReceived
	Counter32,
    pgmDlrSourceSelectiveNNakPacketsReceived
	Counter32,
    pgmDlrSourceNNaksReceived
	Counter32,
    pgmDlrSourceParityNNaksReceived
	Counter32,
    pgmDlrSourceSelectiveNNaksReceived
	Counter32
    }

pgmDlrSourcePerformanceGlobalId OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (12))
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Globally unique source identifier (GSI)."
    ::= { pgmDlrSourcePerformanceEntry 1 }

pgmDlrSourcePerformanceSourcePort OBJECT-TYPE
    SYNTAX     Unsigned32(0..65535)
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
            "Source port number."
    ::= { pgmDlrSourcePerformanceEntry 2 }

pgmDlrSourceRdataMsgsSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Repair Data (RDATA) packets sent for
             this PGM DLR."
    ::= { pgmDlrSourcePerformanceEntry 3 }

pgmDlrSourceRdataBytesSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of RDATA bytes sent."
    ::= { pgmDlrSourcePerformanceEntry 4 }

pgmDlrSourceBytesSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes sent. This includes IP and
             PGM header and non-data msgs."
    ::= { pgmDlrSourcePerformanceEntry 5 }

pgmDlrSourceNaksRcvd OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs received on this TSI."
    ::= { pgmDlrSourcePerformanceEntry 6 }

pgmDlrSourceNaksIgnored OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAKs ignored on this TSI, due to
             duplicates."
    ::= { pgmDlrSourcePerformanceEntry 7 }

pgmDlrSourceNakErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of malformed NAKs on this TSI."
    ::= { pgmDlrSourcePerformanceEntry 8 }

pgmDlrSourceDiscards OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of discarded packets on this TSI.
             This counter is used to count all discarded
             incoming packets per TSI in cases of 
             duplicates, header and packet errors, etc." 
    ::= { pgmDlrSourcePerformanceEntry 9 }

pgmDlrSourceCksumErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of checksum errors on this TSI."
    ::= { pgmDlrSourcePerformanceEntry 10 }

pgmDlrSourceNNaksSent OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Null NAKs (in number of packets) 
             sent by this PGM DLR session."
    ::= { pgmDlrSourcePerformanceEntry 11 }

pgmDlrSourceBytesBuffered OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes currently buffered for this
             TSI."
    ::= { pgmDlrSourcePerformanceEntry 12 }

pgmDlrSourceMsgsBuffered OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of messages currently buffered for
             this TSI."
    ::= { pgmDlrSourcePerformanceEntry 13 }

pgmDlrSourceParityBytesRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes sent in parity retransmissions."
    ::= { pgmDlrSourcePerformanceEntry 14 }

pgmDlrSourceSelectiveBytesRetransmited OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes sent in selective retransmissions."
    ::= { pgmDlrSourcePerformanceEntry 15 }

pgmDlrSourceParityMsgsRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity retransmissions sent."
    ::= { pgmDlrSourcePerformanceEntry 16 }

pgmDlrSourceSelectiveMsgsRetransmitted OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective retransmissions sent."
    ::= { pgmDlrSourcePerformanceEntry 17 }

pgmDlrSourceBytesAdmit OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of bytes currently in the rate controled
             admit queue. Includes IP header, UDP header if
             encapsulated, PGM header, and data."
    ::= { pgmDlrSourcePerformanceEntry 18 }

pgmDlrSourceMsgsAdmit OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of messages currently in the rate controled
             admit queue. Includes data messages, retransmissions,
             and SPMs."
    ::= { pgmDlrSourcePerformanceEntry 19 }

pgmDlrSourceNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of NAK packets received."
    ::= { pgmDlrSourcePerformanceEntry 20 }

pgmDlrSourceParityNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity NAK packets received."
    ::= { pgmDlrSourcePerformanceEntry 21 }

pgmDlrSourceSelectiveNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective NAK packets received."
    ::= { pgmDlrSourcePerformanceEntry 22 }

pgmDlrSourceParityNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs received."
    ::= { pgmDlrSourcePerformanceEntry 23 }

pgmDlrSourceSelectiveNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs received."
    ::= { pgmDlrSourcePerformanceEntry 24 }

pgmDlrSourceParityNaksIgnored OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs ignored."
    ::= { pgmDlrSourcePerformanceEntry 25 }

pgmDlrSourceSelectiveNaksIgnored OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual selective NAKs ignored."
    ::= { pgmDlrSourcePerformanceEntry 26 }

pgmDlrSourceAckErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of ACK packets received with error in
             them, different than checksum error."
    ::= { pgmDlrSourcePerformanceEntry 27 }

pgmDlrSourceNNakErrors OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Null NAK packets received that contain
             error, rSifferent than checksum error."
    ::= { pgmDlrSourcePerformanceEntry 28 }

pgmDlrSourceAckPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of ACK packets received."
    ::= { pgmDlrSourcePerformanceEntry 29 }

pgmDlrSourceNNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of Null NAKs received."
    ::= { pgmDlrSourcePerformanceEntry 30 }

pgmDlrSourceParityNNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of parity Null NAK packets received."
    ::= { pgmDlrSourcePerformanceEntry 31 }

pgmDlrSourceSelectiveNNakPacketsReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of selective Null NAK packets received."
    ::= { pgmDlrSourcePerformanceEntry 32 }

pgmDlrSourceNNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual NAKs, received in Null
             NAK packets."
    ::= { pgmDlrSourcePerformanceEntry 33 }

pgmDlrSourceParityNNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual parity NAKs,
             received in Null NAK packets."
    ::= { pgmDlrSourcePerformanceEntry 34 }

pgmDlrSourceSelectiveNNaksReceived OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "Number of individual  NAKs,
             received in Null NAK packets."
    ::= { pgmDlrSourcePerformanceEntry 35 }

-- Notifications

pgmNotifications       OBJECT IDENTIFIER ::= 
                       { pgmNotificationPrefix 0 }

pgmStart NOTIFICATION-TYPE
    STATUS      current
    DESCRIPTION
        "This trap is sent when the pgm snmp agent starts"
    ::= { pgmNotifications 1 }

pgmStop NOTIFICATION-TYPE
    STATUS      current
    DESCRIPTION
        "This trap is sent when the pgm snmp agent terminates"
    ::= { pgmNotifications 2 }

-- PGM Source Specific Traps

pgmNewSourceTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmSourceSourceGsi,
             pgmSourceSourcePortNumber
            }
    STATUS   current    
    DESCRIPTION
            "New Source Session created."
    ::= { pgmNotifications 3 }

pgmClosedSourceTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmSourceSourceGsi,
             pgmSourceSourcePortNumber
            }
    STATUS   current    
    DESCRIPTION
            "Source Session closed."
    ::= { pgmNotifications 4 }

-- PGM Receiver Specific Traps

pgmNewReceiverTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmReceiverSourceGsi,
             pgmReceiverSourcePortNumber,
             pgmReceiverUniqueInstance
            }
    STATUS   current    
    DESCRIPTION
            "New Receiver Session created.
             This trap is optional."
    ::= { pgmNotifications 5 }

pgmClosedReceiverTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmReceiverSourceGsi,
             pgmReceiverSourcePortNumber,
             pgmReceiverUniqueInstance
            }
    STATUS   current    
    DESCRIPTION
            "Receiver Session closed.
             This trap is optional."
    ::= { pgmNotifications 6 }

pgmNakFailuresTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmReceiverSourceGsi,
             pgmReceiverSourcePortNumber,
             pgmReceiverUniqueInstance,
             pgmReceiverNakFailureThresholdTimer,
             pgmReceiverNakFailureThreshold,
             pgmReceiverNakFailuresLastInterval,
             pgmReceiverLastIntervalNakFailures
            }
    STATUS   current    
    DESCRIPTION
            "The number of unrecovered lost packets
             exceeded the threshold limit for the 
             corresponding threshold interval."
    ::= { pgmNotifications 7 }

-- PGM Dlr Source Specific Traps

pgmNewDlrSourceTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmDlrSourceSourceGsi,
             pgmDlrSourceSourcePortNumber
            }
    STATUS   current    
    DESCRIPTION
            "New Dlr Source Session created."
    ::= { pgmNotifications 8 }

pgmClosedDlrSourceTrap NOTIFICATION-TYPE
    OBJECTS { 
             pgmDlrSourceSourceGsi,
             pgmDlrSourceSourcePortNumber
            }
    STATUS   current    
    DESCRIPTION
            "Dlr Source Session closed."
    ::= { pgmNotifications 9 }

-- Conformance information

pgmMIBConformance OBJECT IDENTIFIER ::= { pgmMIB 3 }
pgmMIBCompliances OBJECT IDENTIFIER ::= { pgmMIBConformance 1 }
pgmMIBGroups      OBJECT IDENTIFIER ::= { pgmMIBConformance 2 }

-- Compliance statements

pgmNetworkElementMIBCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
            "The compliance statement for devices running as PGM 
             Network Elements."
    MODULE  -- this module
      MANDATORY-GROUPS { pgmNetworkElementMIBGroup }

    ::= { pgmMIBCompliances 1 }

pgmSourceMIBCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
            "The compliance statement for devices running as PGM
             sources."
    MODULE  -- this module
      MANDATORY-GROUPS { pgmSourceMIBGroup }

    ::= { pgmMIBCompliances 2 }

pgmReceiverMIBCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
            "The compliance statement for devices running as PGM
             receivers."
    MODULE  -- this module
      MANDATORY-GROUPS { pgmReceiverMIBGroup }

    ::= { pgmMIBCompliances 3 }

pgmDLRMIBCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
            "The compliance statement for devices running as PGM
             designated local repairers (DLR)."
    MODULE  -- this module
      MANDATORY-GROUPS { pgmDLRMIBGroup,
                         pgmReceiverMIBGroup }

    ::= { pgmMIBCompliances 4 }

pgmTrapsMIBCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
            "The compliance statement for PGM traps."
    MODULE  -- this module
      MANDATORY-GROUPS { pgmTrapsMIBGroup, 
                         pgmTrapsSourceMIBGroup,
                         pgmTrapsReceiverMIBGroup,
                         pgmTrapsDlrSourceMIBGroup }
    ::= { pgmMIBCompliances 5 }

-- Units of conformance

pgmNetworkElementMIBGroup OBJECT-GROUP
    OBJECTS { pgmNeEnable, 
              pgmNeSessionLifeTime, 
              pgmNeMaxReXmitStates,
              pgmNeMaxSessions, 
              pgmNeTotalInterfacesNumberOfEntries, 
              pgmNeIfPgmEnable, 
              pgmNeIfNakRptInterval,
              pgmNeIfNakRptRate,
              pgmNeIfNakRdataInterval,
              pgmNeIfNakEliminateInterval,
              pgmNeIfReXmitStates, 
              pgmNeIfReXmitTimedOut,
              pgmNeIfInSpms, 
              pgmNeIfOutSpms, 
              pgmNeIfInParitySpms,
              pgmNeIfOutParitySpms, 
              pgmNeIfInRdata, 
              pgmNeIfOutRdata,
              pgmNeIfInParityRdata, 
              pgmNeIfOutParityRdata,
              pgmNeIfInRdataNoSessionErrors, 
              pgmNeIfUniqueNaks,
              pgmNeIfInNaks, 
              pgmNeIfOutNaks, 
              pgmNeIfUniqueParityNaks, 
              pgmNeIfInParityNaks, 
              pgmNeIfOutParityNaks,
              pgmNeIfInNakNoSessionErrors, 
              pgmNeIfInNakSeqErrors,
              pgmNeIfInParityNakTgErrors, 
              pgmNeIfInNnaks,
              pgmNeIfOutNnaks, 
              pgmNeIfInParityNnaks,
              pgmNeIfOutParityNnaks, 
              pgmNeIfInNnakNoSessionErrors, 
              pgmNeIfInNcfs, 
              pgmNeIfOutNcfs, 
              pgmNeIfInParityNcfs, 
              pgmNeIfOutParityNcfs, 
              pgmNeIfInNcfNoSessionErrors, 
              pgmNeIfInRedirectNcfs, 
              pgmNeIfMalformed,
              pgmNeIfSpmFromSource, 
              pgmNeIfSpmBadSqn, 
              pgmNeIfSpmError, 
              pgmNeIfPollRandomIgnore, 
              pgmNeIfPollTsiStateError,
              pgmNeIfPollParentError, 
              pgmNeIfPollTypeError,
              pgmNeIfPollError, 
              pgmNeIfPollSuccess,
              pgmNeIfPollOriginated, 
              pgmNeIfPolrNoState,
              pgmNeIfPolrError, 
              pgmNeIfPolrParityError,
              pgmNeIfPolrSuccess, 
              pgmNeIfPolrOriginated,
              pgmNeIfNcfError, 
              pgmNeIfNcfParityError, 
              pgmNeIfNcfPartialParity, 
              pgmNeIfNcfReceived, 
              pgmNeIfNcfAnticipated,
              pgmNeIfNcfRedirecting, 
              pgmNeIfNakEliminated,
              pgmNeIfNakError, 
              pgmNeIfNakParityError, 
              pgmNeIfNNakEliminated, 
              pgmNeIfNNakError,
              pgmNeIfNNakParityError,
              pgmNeIfNNakCongestionReports, 
              pgmNeIfNakRetryExpired,
              pgmNeIfNakRetryExpiredDLR, 
              pgmNeIfNakForwardedDLR, 
              pgmNeIfNakRetransmitted,
              pgmNeIfRdataEliminatedOIF,
              pgmNeIfRdataEliminatedSqn, 
              pgmNeIfInRdataFragments,
              pgmNeIfRdataFragmentsNoSessionErrors,
              pgmNeIfRdataFragmentsEliminatedOIF,
              pgmNeIfRdataFragmentsEliminatedSqn,
              pgmNeIfOutRdataFragments, 
              pgmNeTotalTsiNumberOfEntries,
              pgmNeTsiStateBits,
              pgmNeTsiDataDestinationPort, 
              pgmNeTsiSourceAddress,
              pgmNeTsiGroupAddress, 
              pgmNeTsiUpstreamAddress,
              pgmNeTsiUpstreamIfIndex, 
              pgmNeTsiDlrAddress,
              pgmNeTsiSessionTrailEdgeSeq, 
              pgmNeTsiSessionIncrSeq,
              pgmNeTsiLeadEdgeSeq, 
              pgmNeTsiInSpms, 
              pgmNeTsiOutSpms,
              pgmNeTsiInParitySpms, 
              pgmNeTsiOutParitySpms,
              pgmNeTsiTotalReXmitStates, 
              pgmNeTsiTotalReXmitTimedOut,
              pgmNeTsiInRdata, 
              pgmNeTsiOutRdata,
              pgmNeTsiInParityRdata, 
              pgmNeTsiOutParityRdata,
              pgmNeTsiInRdataNoStateErrors, 
              pgmNeTsiUniqueNaks,
              pgmNeTsiInNaks, 
              pgmNeTsiOutNaks,
              pgmNeTsiUniqueParityNaks, 
              pgmNeTsiInParityNaks,
              pgmNeTsiOutParityNaks, 
              pgmNeTsiInNakSeqErrors,
              pgmNeTsiInNnaks, 
              pgmNeTsiOutNnaks,
              pgmNeTsiInParityNnaks, 
              pgmNeTsiOutParityNnaks,
              pgmNeTsiInNcfs, 
              pgmNeTsiOutNcfs, 
              pgmNeTsiInParityNcfs,
              pgmNeTsiOutParityNcfs, 
              pgmNeTsiSpmSequenceNumber,
              pgmNeTsiTransmissionGroupSize, 
              pgmNeTsiTimeout,
              pgmNeTsiLastTtl, 
              pgmNeTsiLinkLossRate,
              pgmNeTsiPathLossRate, 
              pgmNeTsiReceiverLossRate,
              pgmNeTsiCongestionReportLead,
              pgmNeTsiCongestionReportWorstReceiver,
              pgmNeTsiRtxNumberOfEntries,
              pgmNeTsiRtxReqParityTgCount,
              pgmNeTsiRtxTimeout, 
              pgmNeTsiRtxStateBits,
              pgmNeTsiRtxIfNumberOfEntries,
              pgmNeTsiRtxIfPacketCount, 
              pgmNeTsiPolrNumberOfEntries,
              pgmNeTsiPolrSequenceNumber,
              pgmNeTsiPollNumberOfEntries, 
              pgmNeTsiPollSequence, 
              pgmNeTsiPollChildBackoff,
              pgmNeTsiPollMask, 
              pgmNeTsiPollPeriod, 
              pgmNeTsiPollCount,
              pgmNeTsiPollTimeout }
    STATUS  current
    DESCRIPTION
         "A collection of objects to support 
          management of PGM Network Elements."
    ::= { pgmMIBGroups 1 }

pgmSourceMIBGroup OBJECT-GROUP
    OBJECTS { pgmSourceSaveDefaults,
              pgmSourceLastUpdateTime,
              pgmSourceDefaultTtl,
              pgmSourceDefaultAdvMode,
              pgmSourceDefaultLateJoin,
              pgmSourceDefaultTxwMaxRte,
              pgmSourceDefaultTxwSecs,
              pgmSourceDefaultTxwAdvSecs,
              pgmSourceDefaultAdvIvl,
              pgmSourceDefaultSpmIvl,
              pgmSourceDefaultSpmHeartBeatIvlMin,
              pgmSourceDefaultSpmHeartBeatIvlMax,
              pgmSourceDefaultRdataBackoffIvl,
              pgmSourceDefaultFECProactiveParitySize,
              pgmSourceDefaultGroupAddress,
              pgmSourceUpdateSinceLastSave,
              pgmSourceNumberOfEntries,
              pgmSourceSourceAddress,
              pgmSourceGroupAddress, 
              pgmSourceDestPort,
              pgmSourceSourceGsi,
              pgmSourceSourcePortNumber, 
              pgmSourceTtl, 
              pgmSourceAdvMode, 
              pgmSourceLateJoin,
              pgmSourceTxwMaxRte, 
              pgmSourceTxwSecs,
              pgmSourceTxwAdvSecs, 
              pgmSourceAdvIvl,
              pgmSourceSpmIvl,
              pgmSourceSpmHeartBeatIvlMin,
              pgmSourceSpmHeartBeatIvlMax, 
              pgmSourceRdataBackoffIvl,
              pgmSourceFEC, 
              pgmSourceFECTransmissionGrpSize, 
              pgmSourceFECProactiveParitySize, 
              pgmSourceSpmPathAddress,
              pgmSourceDataBytesSent,
              pgmSourceDataMsgsSent, 
              pgmSourceBytesBuffered,
              pgmSourceMsgsBuffered, 
              pgmSourceBytesRetransmitted,
              pgmSourceMsgsRetransmitted, 
              pgmSourceBytesSent,
              pgmSourceRawNaksReceived, 
              pgmSourceNaksIgnored,
              pgmSourceCksumErrors, 
              pgmSourceMalformedNaks,
              pgmSourcePacketsDiscarded, 
              pgmSourceNaksRcvd,
              pgmSourceParityBytesRetransmitted,
              pgmSourceSelectiveBytesRetransmited,
              pgmSourceParityMsgsRetransmitted,
              pgmSourceSelectiveMsgsRetransmitted,
              pgmSourceBytesAdmit,
              pgmSourceMsgsAdmit,
              pgmSourceParityNakPacketsReceived,
              pgmSourceSelectiveNakPacketsReceived,
              pgmSourceParityNaksReceived,
              pgmSourceSelectiveNaksReceived,
              pgmSourceParityNaksIgnored,
              pgmSourceSelectiveNaksIgnored,
              pgmSourceAckErrors,
              pgmSourcePgmCCAcker,
              pgmSourceTransmissionCurrentRate,
              pgmSourceAckPacketsReceived,
              pgmSourceNNakPacketsReceived,
              pgmSourceParityNNakPacketsReceived,
              pgmSourceSelectiveNNakPacketsReceived,
              pgmSourceNNaksReceived,
              pgmSourceParityNNaksReceived,
              pgmSourceSelectiveNNaksReceived,
              pgmSourceNNakErrors }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support management of
             PGM sources."
    ::= { pgmMIBGroups 2 }

pgmReceiverMIBGroup OBJECT-GROUP
    OBJECTS { pgmReceiverSaveDefaults,
              pgmReceiverLastUpdateTime,
              pgmReceiverDefaultNakBackoffIvl,
              pgmReceiverDefaultNakRepeatIvl,
              pgmReceiverDefaultNakNcfRetries,
              pgmReceiverDefaultNakRdataIvl,
              pgmReceiverDefaultNakDataRetries,
              pgmReceiverDefaultSendNaks,
              pgmReceiverDefaultLateJoin,
              pgmReceiverDefaultNakTtl,
              pgmReceiverDefaultDeliveryOrder,
              pgmReceiverDefaultNextPgmHop,
              pgmReceiverDefaultGroupAddress,
              pgmReceiverUpdateSinceLastSave,
              pgmReceiverDefaultNakFailureThresholdTimer,
              pgmReceiverDefaultNakFailureThreshold,
              pgmReceiverNumberOfEntries, 
              pgmReceiverGroupAddress,
              pgmReceiverDestPort, 
              pgmReceiverSourceAddress, 
              pgmReceiverLastHop, 
              pgmReceiverSourceGsi,
              pgmReceiverSourcePortNumber,
              pgmReceiverUniqueInstance,
              pgmReceiverNakBackoffIvl,
              pgmReceiverNakRepeatIvl, 
              pgmReceiverNakNcfRetries,
              pgmReceiverNakRdataIvl, 
              pgmReceiverNakDataRetries,
              pgmReceiverSendNaks, 
              pgmReceiverLateJoin,
              pgmReceiverNakTtl, 
              pgmReceiverDeliveryOrder,
              pgmReceiverMcastNaks,
              pgmReceiverNakFailureThresholdTimer,
              pgmReceiverNakFailureThreshold,
              pgmReceiverDataBytesReceived, 
              pgmReceiverDataMsgsReceived,
              pgmReceiverNaksSent, 
              pgmReceiverNaksRetransmitted,
              pgmReceiverNakFailures, 
              pgmReceiverBytesReceived,
              pgmReceiverNaksSuppressed, 
              pgmReceiverCksumErrors,
              pgmReceiverMalformedSpms, 
              pgmReceiverMalformedOdata,
              pgmReceiverMalformedRdata, 
              pgmReceiverMalformedNcfs,
              pgmReceiverPacketsDiscarded, 
              pgmReceiverLosses,
              pgmReceiverBytesDeliveredToApp,
              pgmReceiverMsgsDeliveredToApp, 
              pgmReceiverDupSpms,
              pgmReceiverDupDatas, 
              pgmReceiverDupParities,
              pgmReceiverNakPacketsSent,
              pgmReceiverParityNakPacketsSent,
              pgmReceiverSelectiveNakPacketsSent,
              pgmReceiverParityNaksSent,
              pgmReceiverSelectiveNaksSent,
              pgmReceiverParityNaksRetransmitted,
              pgmReceiverSelectiveNaksRetransmitted,
              pgmReceiverNaksFailed,
              pgmReceiverParityNaksFailed,
              pgmReceiverSelectiveNaksFailed,
              pgmReceiverNaksFailedRxwAdvanced,
              pgmReceiverNaksFaledNcfRetriesExceeded,
              pgmReceiverNaksFailedDataRetriesExceeded,
              pgmReceiverNaksFailedGenExpired,
              pgmReceiverNakFailuresDelivered,
              pgmReceiverParityNaksSuppressed,
              pgmReceiverSelectiveNaksSuppressed,
              pgmReceiverNakErrors,
              pgmReceiverOutstandingParityNaks,
              pgmReceiverOutstandingSelectiveNaks,
              pgmReceiverLastActivity,
              pgmReceiverNakSvcTimeMin,
              pgmReceiverNakSvcTimeMean,
              pgmReceiverNakSvcTimeMax,
              pgmReceiverNakFailTimeMin,
              pgmReceiverNakFailTimeMean,
              pgmReceiverNakFailTimeMax,
              pgmReceiverNakTransmitMin,
              pgmReceiverNakTransmitMean,
              pgmReceiverNakTransmitMax,
              pgmReceiverAcksSent,
              pgmReceiverRxwTrail,
              pgmReceiverRxwLead,
              pgmReceiverNakFailuresLastInterval,
              pgmReceiverLastIntervalNakFailures }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support management of
             PGM receivers."
    ::= { pgmMIBGroups 3 }

pgmDLRMIBGroup OBJECT-GROUP
    OBJECTS { pgmDlrSaveDefaults, 
              pgmDlrLastUpdateTime,
              pgmDlrGroupAddress, 
              pgmDlrCacheRtx,
              pgmDlrActivityIvl, 
              pgmDlrMaxRate, 
              pgmDlrParentNeAddr, 
              pgmDlrUpdateSinceLastSave,
              pgmDlrSourceNumberOfEntries,
              pgmDlrSourceGroupAddress, 
              pgmDlrSourceSourceGsi,
              pgmDlrSourceSourcePortNumber, 
              pgmDlrSourceGroupTtl,
              pgmDlrSourceRdataBackoffIvl,
              pgmDlrSourceRdataMsgsSent, 
              pgmDlrSourceRdataBytesSent,
              pgmDlrSourceBytesSent,
              pgmDlrSourceNaksRcvd, 
              pgmDlrSourceNaksIgnored,
              pgmDlrSourceNakErrors, 
              pgmDlrSourceDiscards,
              pgmDlrSourceCksumErrors,
              pgmDlrSourceNNaksSent,
              pgmDlrSourceBytesBuffered,
              pgmDlrSourceMsgsBuffered,
              pgmDlrSourceParityBytesRetransmitted,
              pgmDlrSourceSelectiveBytesRetransmited,
              pgmDlrSourceParityMsgsRetransmitted,
              pgmDlrSourceSelectiveMsgsRetransmitted,
              pgmDlrSourceBytesAdmit,
              pgmDlrSourceMsgsAdmit,
              pgmDlrSourceNakPacketsReceived,
              pgmDlrSourceParityNakPacketsReceived,
              pgmDlrSourceSelectiveNakPacketsReceived,
              pgmDlrSourceParityNaksReceived,
              pgmDlrSourceSelectiveNaksReceived,
              pgmDlrSourceParityNaksIgnored,
              pgmDlrSourceSelectiveNaksIgnored,
              pgmDlrSourceAckErrors,
              pgmDlrSourceNNakErrors,
              pgmDlrSourceAckPacketsReceived,
              pgmDlrSourceNNakPacketsReceived,
              pgmDlrSourceParityNNakPacketsReceived,
              pgmDlrSourceSelectiveNNakPacketsReceived,
              pgmDlrSourceNNaksReceived,
              pgmDlrSourceParityNNaksReceived,
              pgmDlrSourceSelectiveNNaksReceived }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support management of 
             PGM designated local repairers (DLR)."
    ::= { pgmMIBGroups 4 }

pgmTrapsMIBGroup NOTIFICATION-GROUP
    NOTIFICATIONS { pgmStart,
                    pgmStop }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support pgm 
             specific traps."
    ::= { pgmMIBGroups 5 }

pgmTrapsSourceMIBGroup NOTIFICATION-GROUP
    NOTIFICATIONS { pgmNewSourceTrap,
                    pgmClosedSourceTrap }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support pgm 
             source specific traps."
    ::= { pgmMIBGroups 6 }

pgmTrapsReceiverMIBGroup NOTIFICATION-GROUP
    NOTIFICATIONS { pgmNewReceiverTrap,
                    pgmClosedReceiverTrap,
                    pgmNakFailuresTrap }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support pgm 
             receiver specific traps."
    ::= { pgmMIBGroups 7 }

pgmTrapsDlrSourceMIBGroup NOTIFICATION-GROUP
    NOTIFICATIONS { pgmNewDlrSourceTrap,
                    pgmClosedDlrSourceTrap }
    STATUS  current
    DESCRIPTION
            "A collection of objects to support pgm 
             dlr source specific traps."
    ::= { pgmMIBGroups 8 }


END

libpgm-5.1.118-1~dfsg/openpgm/pgm/mld-semantics.txt0000644000175000017500000000460311640407354021047 0ustar  locallocal  previous request		following request		return
  -----------------		-----------------		-----------
  MCAST_JOIN_GROUP		MCAST_JOIN_GROUP		EADDRINUSE
  MCAST_JOIN_GROUP		MCAST_LEAVE_GROUP		0
  MCAST_JOIN_GROUP		MCAST_JOIN_SOURCE_GROUP		EINVAL
  MCAST_JOIN_GROUP		MCAST_LEAVE_SOURCE_GROUP	EINVAL
  MCAST_JOIN_GROUP		MCAST_BLOCK_SOURCE		0
  MCAST_JOIN_SOURCE_GROUP	MCAST_JOIN_GROUP		EADDRINUSE
  MCAST_JOIN_SOURCE_GROUP	MCAST_LEAVE_GROUP		0
  MCAST_JOIN_SOURCE_GROUP	MCAST_JOIN_SOURCE_GROUP		(*1)
  MCAST_JOIN_SOURCE_GROUP	MCAST_LEAVE_SOURCE_GROUP	(*2)
  MCAST_JOIN_SOURCE_GROUP	MCAST_BLOCK_SOURCE		EINVAL
  MCAST_JOIN_SOURCE_GROUP	MCAST_UNBLOCK_SOURCE		EINVAL
  MCAST_BLOCK_SOURCE		MCAST_JOIN_GROUP		EADDRINUSE
  MCAST_BLOCK_SOURCE		MCAST_LEAVE_GROUP		0
  MCAST_BLOCK_SOURCE		MCAST_JOIN_SOURCE_GROUP		EINVAL
  MCAST_BLOCK_SOURCE		MCAST_LEAVE_SOURCE_GROUP	EINVAL
  MCAST_BLOCK_SOURCE		MCAST_BLOCK_SOURCE		(*1)
  MCAST_BLOCK_SOURCE		MCAST_UNBLOCK_SOURCE		(*2)

(*1) EADDRNOTAVAIL if source address is same of filtered one. Otherwise 0.
(*2) EADDRNOTAVAIL if source address is not same of filtered one. Otherwise 0.


http://planete.inria.fr/Hitoshi.Asaeda/mldv2/README.txt


The following steps apply for any-source applications:

    Use MCAST_JOIN_GROUP to join a group.
    Use MCAST_BLOCK_SOURCE to turn off a given source, if required.
    Use MCAST_UNBLOCK_SOURCE to re-allow a blocked source, if required.
    Use MCAST_LEAVE_GROUP to leave the group.

The following steps apply for controlled-source applications:

    Use MCAST_JOIN_SOURCE_GROUP to join each group/source pair.
    Use MCAST_LEAVE_SOURCE_GROUP to leave each group/source, or use MCAST_LEAVE_GROUP to leave all sources, if the same group address is used by all sources.

The following steps apply for any-source applications:

    Use IP_ADD_MEMBERSHIP to join a group (IPV6_ADD_MEMBERSHIP for IPv6).
    Use IP_BLOCK_SOURCE to turn off a given source, if required.
    Use IP_UNBLOCK_SOURCE to re-allow a blocked source, if required.
    Use IP_DROP_MEMBERSHIP to leave the group (IPV6_DROP_MEMBERSHIP for IPv6).

The following steps apply for controlled-source applications:

    Use IP_ADD_SOURCE_MEMBERSHIP to join each group/source pair.
    Use IP_DROP_SOURCE_MEMBERSHIP to leave each group/source, or use IP_DROP_MEMBERSHIP to leave all sources, if the same group address is used by all sources. 

http://msdn.microsoft.com/en-us/library/ms738558(VS.85).aspx
libpgm-5.1.118-1~dfsg/openpgm/pgm/timer_unittest.c0000644000175000017500000001574011640407354020775 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * unit tests for PGM timer thread.
 *
 * Copyright (c) 2009-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


#include 
#include 
#include 
#include 
#include 

#ifdef _WIN32
#	define PGM_CHECK_NOFORK		1
#endif


/* mock state */


#define g_main_context_new		mock_g_main_context_new
#define g_main_context_unref		mock_g_main_context_unref
#define g_main_loop_new			mock_g_main_loop_new
#define g_main_loop_run			mock_g_main_loop_run
#define g_main_loop_unref		mock_g_main_loop_unref
#define g_source_new			mock_g_source_new
#define g_source_set_priority		mock_g_source_set_priority
#define g_source_attach			mock_g_source_attach
#define g_source_unref			mock_g_source_unref
#define pgm_time_now			mock_pgm_time_now
#define pgm_time_update_now		mock_pgm_time_update_now
#define pgm_min_receiver_expiry		mock_pgm_min_receiver_expiry
#define pgm_check_peer_state		mock_pgm_check_peer_state
#define pgm_send_spm			mock_pgm_send_spm


#define TIMER_DEBUG
#include "timer.c"

static pgm_time_t _mock_pgm_time_update_now(void);
pgm_time_update_func mock_pgm_time_update_now = _mock_pgm_time_update_now;
static pgm_time_t mock_pgm_time_now = 0x1;


static
pgm_sock_t*
generate_sock (void)
{
	pgm_sock_t* sock = g_new0 (pgm_sock_t, 1);
	return sock;
}


/* mock functions for external references */

size_t
pgm_pkt_offset (
	const bool		can_fragment,
	const sa_family_t	pgmcc_family	/* 0 = disable */
	)
{
	return 0;
}

PGM_GNUC_INTERNAL
int
pgm_get_nprocs (void)
{
	return 1;
}

/** GLib */
static
GMainContext*
mock_g_main_context_new (void)
{
	GMainContext* context = g_malloc0 (sizeof(gpointer));
	return context;
}

static
GMainLoop*
mock_g_main_loop_new (
	GMainContext*		context,
	gboolean		is_running
	)
{
	g_assert (NULL != context);
	GMainLoop* loop = g_malloc0 (sizeof(gpointer));
	return loop;
}

static
void
mock_g_main_loop_run (
	GMainLoop*		loop
	)
{
	g_assert (NULL != loop);
}

static
void
mock_g_main_loop_unref (
	GMainLoop*		loop
	)
{
	g_assert (NULL != loop);
	g_free (loop);
}

static
void
mock_g_main_context_unref (
	GMainContext*		context
	)
{
	g_assert (NULL != context);
	g_free (context);
}

static
GSource*
mock_g_source_new (
	GSourceFuncs*		source_funcs,
	guint			struct_size
	)
{
	g_assert (struct_size > 0);
	GSource* source = g_malloc0 (struct_size);
	return source;
}

static
void
mock_g_source_set_priority (
	GSource*		source,
	gint			priority
	)
{
	g_assert (NULL != source);
}

static
guint
mock_g_source_attach (
	GSource*		source,
	GMainContext*		context
	)
{
	g_assert (NULL != source);
	return 1;
}

static
void
mock_g_source_unref (
	GSource*		source
	)
{
	g_assert (NULL != source);
	g_free (source);
}

/** time module */
static
pgm_time_t
_mock_pgm_time_update_now (void)
{
	return mock_pgm_time_now;
}

/** receiver module */
PGM_GNUC_INTERNAL
pgm_time_t
mock_pgm_min_receiver_expiry (
	pgm_sock_t*		sock,
	pgm_time_t		expiration
	)
{
	g_assert (NULL != sock);
	return 0x1;
}

PGM_GNUC_INTERNAL
bool
mock_pgm_check_peer_state (
	pgm_sock_t*		sock,
	pgm_time_t		now
	)
{
	g_assert (NULL != sock);
	return TRUE;
}

/** source module */
PGM_GNUC_INTERNAL
bool
mock_pgm_send_spm (
	pgm_sock_t*		sock,
	int			flags
	)
{
	g_assert (NULL != sock);
	return TRUE;
}


/* target:
 *	bool
 *	pgm_timer_prepare (
 *		pgm_sock_t*	sock
 *	)
 */

START_TEST (test_prepare_pass_001)
{
	pgm_sock_t* sock = generate_sock ();
	fail_if (NULL == sock, "generate_sock failed");
	sock->can_send_data = TRUE;
	sock->next_ambient_spm = mock_pgm_time_now + pgm_secs(10);
	fail_unless (FALSE == pgm_timer_prepare (sock), "prepare failed");
}
END_TEST

START_TEST (test_prepare_fail_001)
{
	gboolean expired = pgm_timer_prepare (NULL);
	fail ("reached");
}
END_TEST

/* target:
 *	bool
 *	pgm_timer_check (
 *		pgm_sock_t*	sock
 *	)
 */

START_TEST (test_check_pass_001)
{
	pgm_sock_t* sock = generate_sock ();
	fail_if (NULL == sock, "generate_sock failed");
	fail_unless (TRUE == pgm_timer_check (sock), "check failed");
}
END_TEST

START_TEST (test_check_fail_001)
{
	gboolean expired = pgm_timer_check (NULL);
	fail ("reached");
}
END_TEST

/* target:
 *	pgm_time_t
 *	pgm_timer_expiration (
 *		pgm_sock_t*	sock
 *	)
 */

START_TEST (test_expiration_pass_001)
{
	pgm_sock_t* sock = generate_sock ();
	fail_if (NULL == sock, "generate_sock failed");
	sock->next_poll = mock_pgm_time_now + pgm_secs(300);
	fail_unless (pgm_secs(300) == pgm_timer_expiration (sock), "expiration failed");
}
END_TEST

START_TEST (test_expiration_fail_001)
{
	long expiration = pgm_timer_expiration (NULL);
	fail ("reached");
}
END_TEST

/* target:
 *	void
 *	pgm_timer_dispatch (
 *		pgm_sock_t*	sock
 *	)
 */

START_TEST (test_dispatch_pass_001)
{
	pgm_sock_t* sock = generate_sock ();
	fail_if (NULL == sock, "generate_sock failed");
	pgm_timer_dispatch (sock);
}
END_TEST

START_TEST (test_dispatch_fail_001)
{
	pgm_timer_dispatch (NULL);
	fail ("reached");
}
END_TEST


static
Suite*
make_test_suite (void)
{
	Suite* s;

	s = suite_create (__FILE__);

	TCase* tc_prepare = tcase_create ("prepare");
	suite_add_tcase (s, tc_prepare);
	tcase_add_test (tc_prepare, test_prepare_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_prepare, test_prepare_fail_001, SIGABRT);
#endif

	TCase* tc_check = tcase_create ("check");
	suite_add_tcase (s, tc_check);
	tcase_add_test (tc_check, test_check_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_check, test_check_fail_001, SIGABRT);
#endif

	TCase* tc_expiration = tcase_create ("expiration");
	suite_add_tcase (s, tc_expiration);
	tcase_add_test (tc_expiration, test_expiration_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_expiration, test_expiration_fail_001, SIGABRT);
#endif

	TCase* tc_dispatch = tcase_create ("dispatch");
	suite_add_tcase (s, tc_dispatch);
	tcase_add_test (tc_dispatch, test_dispatch_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_dispatch, test_dispatch_fail_001, SIGABRT);
#endif
	return s;
}

static
Suite*
make_master_suite (void)
{
	Suite* s = suite_create ("Master");
	return s;
}

int
main (void)
{
	SRunner* sr = srunner_create (make_master_suite ());
	srunner_add_suite (sr, make_test_suite ());
	srunner_run_all (sr, CK_ENV);
	int number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/win/0000755000175000017500000000000011640407424016336 5ustar  locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/win/mingw32-runtime_3.13-1openpgm3.diff0000644000175000017500000001055011640407352024413 0ustar  locallocaldiff -urN include-original/mswsock.h include/mswsock.h
--- include-original/mswsock.h	2009-08-21 22:41:22.000000000 +0800
+++ include/mswsock.h	2010-01-21 17:31:14.662159471 +0800
@@ -83,23 +83,19 @@
 } WSAMSG, *PWSAMSG, *LPWSAMSG;
 
 
-/* According to MSDN docs, the WSAMSG.Control buffer starts with a
-   cmsghdr header of the following form.  See also RFC 2292. */
-
-typedef struct wsacmsghdr {
-	UINT	cmsg_len;
-	INT	cmsg_level;
- 	INT	cmsg_type;
-	/* followed by UCHAR cmsg_data[]; */
-} WSACMSGHDR;
-
-/* TODO: Standard Posix.1g macros as per RFC 2292, with WSA_uglification. */
-#if 0
-#define WSA_CMSG_FIRSTHDR(mhdr)
-#define WSA_CMSG_NXTHDR(mhdr, cmsg)
-#define WSA_CMSG_SPACE(length)
-#define WSA_CMSG_LEN(length)
-#endif
+ typedef struct _WSACMSGHDR {
+    SIZE_T cmsg_len;
+    INT cmsg_level;
+    INT cmsg_type;
+  } WSACMSGHDR,*PWSACMSGHDR,*LPWSACMSGHDR;
+
+#define WSA_CMSGHDR_ALIGN(length) (((length) + TYPE_ALIGNMENT(WSACMSGHDR)-1) & (~(TYPE_ALIGNMENT(WSACMSGHDR)-1)))
+#define WSA_CMSGDATA_ALIGN(length) (((length) + MAX_NATURAL_ALIGNMENT-1) & (~(MAX_NATURAL_ALIGNMENT-1)))
+#define WSA_CMSG_FIRSTHDR(msg) (((msg)->Control.len >= sizeof(WSACMSGHDR)) ? (LPWSACMSGHDR)(msg)->Control.buf : (LPWSACMSGHDR)NULL)
+#define WSA_CMSG_NXTHDR(msg,cmsg) ((!(cmsg)) ? WSA_CMSG_FIRSTHDR(msg) : ((((u_char *)(cmsg) + WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len) + sizeof(WSACMSGHDR)) > (u_char *)((msg)->Control.buf) + (msg)->Control.len) ? (LPWSACMSGHDR)NULL : (LPWSACMSGHDR)((u_char *)(cmsg) + WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len))))
+#define WSA_CMSG_DATA(cmsg) ((u_char *)(cmsg) + WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)))
+#define WSA_CMSG_SPACE(length) (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR) + WSA_CMSGHDR_ALIGN(length)))
+#define WSA_CMSG_LEN(length) (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)) + length)
+
+typedef INT  (WINAPI * LPFN_WSARECVMSG)(SOCKET, LPWSAMSG, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
+
 BOOL PASCAL DisconnectEx(SOCKET,LPOVERLAPPED,DWORD,DWORD);
 int PASCAL WSARecvMsg(SOCKET,LPWSAMSG,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
 
diff -urN include-original/ws2tcpip.h include/ws2tcpip.h
--- include-original/ws2tcpip.h	2009-08-21 22:41:42.000000000 +0800
+++ include/ws2tcpip.h	2009-08-21 22:42:15.000000000 +0800
@@ -78,6 +78,18 @@
 
 #define UDP_NOCHECKSUM 1
 
+/* RFC 3768 */
+#define MCAST_JOIN_GROUP	41
+#define MCAST_LEAVE_GROUP	42
+#define MCAST_BLOCK_SOURCE	43
+#define MCAST_UNBLOCK_SOURCE	44
+#define MCAST_JOIN_SOURCE_GROUP	45
+#define MCAST_LEAVE_SOURCE_GROUP	46
+#define MCAST_MSFILTER		47
+
+#define MCAST_EXCLUDE   0
+#define MCAST_INCLUDE   1
+
 /* INTERFACE_INFO iiFlags */
 #define IFF_UP  1
 #define IFF_BROADCAST   2
@@ -104,6 +116,7 @@
 #define AI_PASSIVE	1
 #define AI_CANONNAME	2
 #define AI_NUMERICHOST	4
+#define AI_ADDRCONFIG	0x20
 
 /* getaddrinfo error codes */
 #define EAI_AGAIN	WSATRY_AGAIN
@@ -132,6 +145,25 @@
 	struct in_addr	imr_interface;
 };
 
+struct group_req {
+	u_long		gr_interface;
+	struct sockaddr_storage gr_group;
+};
+
+struct group_source_req {
+	u_long		gsr_interface;
+	struct sockaddr_storage	gsr_group;
+	struct sockaddr_storage gsr_source;
+};
+
+struct group_filter {
+	u_long		gf_interface;
+	struct sockaddr_storage	gf_group;
+	u_long		gf_fmode;
+	u_long		gf_numsrc;
+	struct sockaddr_storage	gf_slist[1];
+};
+
 struct ip_msfilter {
 	struct in_addr	imsf_multiaddr;
 	struct in_addr	imsf_interface;
@@ -356,6 +388,13 @@
 	sockaddr_gen	iiNetmask;
 } INTERFACE_INFO, *LPINTERFACE_INFO;
 
+typedef struct _INTERFACE_INFO_EX {
+	u_long		iiFlags;
+	SOCKET_ADDRESS	iiAddress;
+	SOCKET_ADDRESS	iiBroadcastAddress;
+	SOCKET_ADDRESS	iiNetmask;
+} INTERFACE_INFO_EX, *_LPINTERFACE_INFO_EX;
+
 /*
    The definition above can cause problems on NT4,prior to sp4.
    To workaround, include the following struct and typedef and
--- include-original/winnt.h	2009-08-21 22:41:42.000000000 +0800
+++ include/winnt.h	2010-01-21 17:33:56.366162880 +0800
@@ -43,6 +43,20 @@
 #define UNALIGNED
 #endif
 
+#ifdef _WIN64
+#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
+#define MEMORY_ALLOCATION_ALIGNMENT 16
+#else
+#define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
+#define MEMORY_ALLOCATION_ALIGNMENT 8
+#endif
+
+#ifdef __cplusplus
+#define TYPE_ALIGNMENT(t) __alignof__ (t)
+#else
+#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; },test)
+#endif
+
 #ifndef DECLSPEC_ALIGN
 #ifdef __GNUC__
 #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
libpgm-5.1.118-1~dfsg/openpgm/pgm/win/mingw32-runtime_3.15.2-0openpgm1.diff0000644000175000017500000001074411640407352024557 0ustar  locallocaldiff -urN include-original/mswsock.h include/mswsock.h
--- include-original/mswsock.h	2009-06-30 16:32:31.000000000 +0800
+++ include/mswsock.h	2010-03-23 20:34:12.000000000 +0800
@@ -83,23 +83,20 @@
 } WSAMSG, *PWSAMSG, *LPWSAMSG;
 
 
-/* According to MSDN docs, the WSAMSG.Control buffer starts with a
-   cmsghdr header of the following form.  See also RFC 2292. */
-
-typedef struct wsacmsghdr {
-	UINT	cmsg_len;
-	INT	cmsg_level;
- 	INT	cmsg_type;
-	/* followed by UCHAR cmsg_data[]; */
-} WSACMSGHDR;
-
-/* TODO: Standard Posix.1g macros as per RFC 2292, with WSA_uglification. */
-#if 0
-#define WSA_CMSG_FIRSTHDR(mhdr)
-#define WSA_CMSG_NXTHDR(mhdr, cmsg)
-#define WSA_CMSG_SPACE(length)
-#define WSA_CMSG_LEN(length)
-#endif
+typedef struct _WSACMSGHDR {
+	SIZE_T cmsg_len;
+	INT cmsg_level;
+	INT cmsg_type;
+} WSACMSGHDR,*PWSACMSGHDR,*LPWSACMSGHDR;
+
+#define WSA_CMSGHDR_ALIGN(length) (((length) + TYPE_ALIGNMENT(WSACMSGHDR)-1) & (~(TYPE_ALIGNMENT(WSACMSGHDR)-1)))
+#define WSA_CMSGDATA_ALIGN(length) (((length) + MAX_NATURAL_ALIGNMENT-1) & (~(MAX_NATURAL_ALIGNMENT-1)))
+#define WSA_CMSG_FIRSTHDR(msg) (((msg)->Control.len >= sizeof(WSACMSGHDR)) ? (LPWSACMSGHDR)(msg)->Control.buf : (LPWSACMSGHDR)NULL)
+#define WSA_CMSG_NXTHDR(msg,cmsg) ((!(cmsg)) ? WSA_CMSG_FIRSTHDR(msg) : ((((u_char *)(cmsg) + WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len) + sizeof(WSACMSGHDR)) > (u_char *)((msg)->Control.buf) + (msg)->Control.len) ? (LPWSACMSGHDR)NULL : (LPWSACMSGHDR)((u_char *)(cmsg) + WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len))))
+#define WSA_CMSG_DATA(cmsg) ((u_char *)(cmsg) + WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)))
+#define WSA_CMSG_SPACE(length) (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR) + WSA_CMSGHDR_ALIGN(length)))
+#define WSA_CMSG_LEN(length) (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)) + length)
+typedef INT  (WINAPI * LPFN_WSARECVMSG)(SOCKET, LPWSAMSG, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
 
 BOOL PASCAL DisconnectEx(SOCKET,LPOVERLAPPED,DWORD,DWORD);
 int PASCAL WSARecvMsg(SOCKET,LPWSAMSG,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
diff -urN include-original/winnt.h include/winnt.h
--- include-original/winnt.h	2009-06-30 16:32:32.000000000 +0800
+++ include/winnt.h	2010-03-23 20:36:29.000000000 +0800
@@ -43,6 +43,20 @@
 #define UNALIGNED
 #endif
 
+#ifdef _WIN64
+#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
+#define MEMORY_ALLOCATION_ALIGNMENT 16
+#else
+#define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
+#define MEMORY_ALLOCATION_ALIGNMENT 8
+#endif
+
+#ifdef __cplusplus
+#define TYPE_ALIGNMENT(t) __alignof__ (t)
+#else
+#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; },test)
+#endif
+
 #ifndef DECLSPEC_ALIGN
 #ifdef __GNUC__
 #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
diff -urN include-original/ws2tcpip.h include/ws2tcpip.h
--- include-original/ws2tcpip.h	2009-06-30 16:32:32.000000000 +0800
+++ include/ws2tcpip.h	2010-03-23 20:35:59.000000000 +0800
@@ -78,6 +78,18 @@
 
 #define UDP_NOCHECKSUM 1
 
+/* RFC 3768 */
+#define MCAST_JOIN_GROUP       41
+#define MCAST_LEAVE_GROUP      42
+#define MCAST_BLOCK_SOURCE     43
+#define MCAST_UNBLOCK_SOURCE   44
+#define MCAST_JOIN_SOURCE_GROUP        45
+#define MCAST_LEAVE_SOURCE_GROUP       46
+#define MCAST_MSFILTER         47
+
+#define MCAST_EXCLUDE   0
+#define MCAST_INCLUDE   1
+
 /* INTERFACE_INFO iiFlags */
 #define IFF_UP  1
 #define IFF_BROADCAST   2
@@ -104,6 +116,7 @@
 #define AI_PASSIVE	1
 #define AI_CANONNAME	2
 #define AI_NUMERICHOST	4
+#define AI_ADDRCONFIG  0x20
 
 /* getaddrinfo error codes */
 #define EAI_AGAIN	WSATRY_AGAIN
@@ -132,6 +145,25 @@
 	struct in_addr	imr_interface;
 };
 
+struct group_req {
+	u_long          gr_interface;
+	struct sockaddr_storage gr_group;
+};
+
+struct group_source_req {
+	u_long          gsr_interface;
+	struct sockaddr_storage gsr_group;
+	struct sockaddr_storage gsr_source;
+};
+
+struct group_filter {
+	u_long          gf_interface;
+	struct sockaddr_storage gf_group;
+	u_long          gf_fmode;
+	u_long          gf_numsrc;
+	struct sockaddr_storage gf_slist[1];
+};
+
 struct ip_msfilter {
 	struct in_addr	imsf_multiaddr;
 	struct in_addr	imsf_interface;
@@ -356,6 +388,13 @@
 	sockaddr_gen	iiNetmask;
 } INTERFACE_INFO, *LPINTERFACE_INFO;
 
+typedef struct _INTERFACE_INFO_EX {
+	u_long          iiFlags;
+	SOCKET_ADDRESS  iiAddress;
+	SOCKET_ADDRESS  iiBroadcastAddress;
+	SOCKET_ADDRESS  iiNetmask;
+} INTERFACE_INFO_EX, *_LPINTERFACE_INFO_EX;
+
 /*
    The definition above can cause problems on NT4,prior to sp4.
    To workaround, include the following struct and typedef and
libpgm-5.1.118-1~dfsg/openpgm/pgm/net_unittest.c0000644000175000017500000002126311640407354020440 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * unit tests for network send wrapper.
 *
 * Copyright (c) 2009-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#else
#	include 
#	include 
#endif
#include 
#include 

#ifdef _WIN32
#	define PGM_CHECK_NOFORK		1
#endif


/* mock state */

#ifndef _WIN32
ssize_t mock_sendto (int, const void*, size_t, int, const struct sockaddr*, socklen_t);
#else
int mock_sendto (SOCKET, const char*, int, int, const struct sockaddr*, int);
int mock_select (int, fd_set*, fd_set*, fd_set*, struct timeval*);
#endif


#define pgm_rate_check		mock_pgm_rate_check
#define sendto			mock_sendto
#define poll			mock_poll
#define select			mock_select
#define fcntl			mock_fcntl

#define NET_DEBUG
#include "net.c"


static
pgm_sock_t*
generate_sock (void)
{
	pgm_sock_t* sock = g_malloc0 (sizeof(pgm_sock_t));
	return sock;
}

static
char*
flags_string (
	int		flags
	)
{
	static char s[1024];

	s[0] = '\0';
	if (flags & MSG_OOB)
		strcat (s, "MSG_OOB");
#define MSG(flag) \
	do { \
		if (flags & flag) { \
			strcat (s, s[0] ? ("|" #flag) : (#flag)); \
		} \
	} while (0)
#ifdef MSG_PEEK
	MSG(MSG_PEEK);
#endif
#ifdef MSG_DONTROUTE
	MSG(MSG_DONTROUTE);
#endif
#ifdef MSG_CTRUNC
	MSG(MSG_CTRUNC);
#endif
#ifdef MSG_PROXY
	MSG(MSG_PROXY);
#endif
#ifdef MSG_TRUNC
	MSG(MSG_TRUNC);
#endif
#ifdef MSG_DONTWAIT
	MSG(MSG_DONTWAIT);
#endif
#ifdef MSG_EOR
	MSG(MSG_EOR);
#endif
#ifdef MSG_WAITALL
	MSG(MSG_WAITALL);
#endif
#ifdef MSG_FIN
	MSG(MSG_FIN);
#endif
#ifdef MSG_SYN
	MSG(MSG_SYN);
#endif
#ifdef MSG_CONFIRM
	MSG(MSG_CONFIRM);
#endif
#ifdef MSG_RST
	MSG(MSG_RST);
#endif
#ifdef MSG_ERRQUEUE
	MSG(MSG_ERRQUEUE);
#endif
#ifdef MSG_NOSIGNAL
	MSG(MSG_NOSIGNAL);
#endif
#ifdef MSG_MORE
	MSG(MSG_MORE);
#endif
#ifdef MSG_CMSG_CLOEXEC
	MSG(MSG_CMSG_CLOEXEC);
#endif
	if (!s[0]) {
		if (flags)
			sprintf (s, "0x%x", flags);
		else
			strcpy (s, "0");
	}
	return s;
}


/* mock functions for external references */

size_t
pgm_pkt_offset (
        const bool                      can_fragment,
        const sa_family_t		pgmcc_family	/* 0 = disable */
        )
{
        return 0;
}

PGM_GNUC_INTERNAL
int
pgm_get_nprocs (void)
{
	return 1;
}

PGM_GNUC_INTERNAL
bool
mock_pgm_rate_check (
	pgm_rate_t*		bucket,
	const size_t		data_size,
	const bool		is_nonblocking
	)
{
	g_debug ("mock_pgm_rate_check (bucket:%p data-size:%" PRIzu " is-nonblocking:%s)",
		(gpointer)bucket, data_size, is_nonblocking ? "TRUE" : "FALSE");
	return TRUE;
}

#ifndef _WIN32
ssize_t
mock_sendto (
	int			s,
	const void*		buf,
	size_t			len,
	int			flags,
	const struct sockaddr*	to,
	socklen_t		tolen
	)
#else
int
mock_sendto (
	SOCKET			s,
	const char*		buf,
	int			len,
	int			flags,
	const struct sockaddr*	to,
	int			tolen
	)
#endif
{
	char saddr[INET6_ADDRSTRLEN];
	pgm_sockaddr_ntop (to, saddr, sizeof(saddr));
	g_debug ("mock_sendto (s:%i buf:%p len:%u flags:%s to:%s tolen:%d)",
		s, buf, (unsigned)len, flags_string (flags), saddr, tolen);
	return len;
}

#ifdef CONFIG_HAVE_POLL
int
mock_poll (
	struct pollfd*		fds,
	nfds_t			nfds,
	int			timeout
	)
{
	g_debug ("mock_poll (fds:%p nfds:%d timeout:%d)",
		(gpointer)fds, (int)nfds, timeout);
	return 0;
}
#else
int
mock_select (
	int			nfds,
	fd_set*			readfds,
	fd_set*			writefds,
	fd_set*			exceptfds,
	struct timeval*		timeout
	)
{
	g_debug ("mock_select (nfds:%d readfds:%p writefds:%p exceptfds:%p timeout:%p)",
		nfds, (gpointer)readfds, (gpointer)writefds, (gpointer)exceptfds, (gpointer)timeout);
	return 0;
}
#endif

/* non-blocking API */
#ifndef _WIN32
int
mock_fcntl (
	int			fd,
	int			cmd,
	...
	)
{
	long arg;
	va_list args;
	if (F_GETFL == cmd) {
		g_debug ("mock_fcntl (fd:%d cmd:F_GETFL)", fd);
		return 0;
	}
	if (F_SETFL == cmd) {
		va_start (args, cmd);
		arg = va_arg (args, long);
		va_end (args);
		g_debug ("mock_fcntl (fd:%d cmd:F_SETFL arg:%ld)", fd, arg);
		return arg;
	}
	g_assert_not_reached();
}
#else
/* ioctlsocket */
#endif


/* target:
 *	ssize_t
 *	pgm_sendto (
 *		pgm_sock_t*		sock,
 *		bool			use_rate_limit,
 *		pgm_rate_t*		minor_rate_control,
 *		bool			use_router_alert,
 *		const void*		buf,
 *		size_t			len,
 *		const struct sockaddr*	to,
 *		socklen_t		tolen
 *	)
 */

START_TEST (test_sendto_pass_001)
{
	pgm_sock_t* sock = generate_sock ();
	const char* buf = "i am not a string";
	struct sockaddr_in addr = {
		.sin_family		= AF_INET,
		.sin_addr.s_addr	= inet_addr ("172.12.90.1")
	};
	gssize len = pgm_sendto (sock, FALSE, NULL, FALSE, buf, sizeof(buf), (struct sockaddr*)&addr, sizeof(addr));
	fail_unless (sizeof(buf) == len, "sendto underrun");
}
END_TEST

START_TEST (test_sendto_fail_001)
{
	const char* buf = "i am not a string";
	struct sockaddr_in addr = {
		.sin_family		= AF_INET,
		.sin_addr.s_addr	= inet_addr ("172.12.90.1")
	};
	gssize len = pgm_sendto (NULL, FALSE, NULL, FALSE, buf, sizeof(buf), (struct sockaddr*)&addr, sizeof(addr));
	fail ("reached");
}
END_TEST

START_TEST (test_sendto_fail_002)
{
	pgm_sock_t* sock = generate_sock ();
	const char* buf = "i am not a string";
	struct sockaddr_in addr = {
		.sin_family		= AF_INET,
		.sin_addr.s_addr	= inet_addr ("172.12.90.1")
	};
	gssize len = pgm_sendto (sock, FALSE, NULL, FALSE, NULL, sizeof(buf), (struct sockaddr*)&addr, sizeof(addr));
	fail ("reached");
}
END_TEST

START_TEST (test_sendto_fail_003)
{
	pgm_sock_t* sock = generate_sock ();
	const char* buf = "i am not a string";
	struct sockaddr_in addr = {
		.sin_family		= AF_INET,
		.sin_addr.s_addr	= inet_addr ("172.12.90.1")
	};
	gssize len = pgm_sendto (sock, FALSE, NULL, FALSE, buf, 0, (struct sockaddr*)&addr, sizeof(addr));
	fail ("reached");
}
END_TEST

START_TEST (test_sendto_fail_004)
{
	pgm_sock_t* sock = generate_sock ();
	const char* buf = "i am not a string";
	struct sockaddr_in addr = {
		.sin_family		= AF_INET,
		.sin_addr.s_addr	= inet_addr ("172.12.90.1")
	};
	gssize len = pgm_sendto (sock, FALSE, NULL, FALSE, buf, sizeof(buf), NULL, sizeof(addr));
	fail ("reached");
}
END_TEST

START_TEST (test_sendto_fail_005)
{
	pgm_sock_t* sock = generate_sock ();
	const char* buf = "i am not a string";
	struct sockaddr_in addr = {
		.sin_family		= AF_INET,
		.sin_addr.s_addr	= inet_addr ("172.12.90.1")
	};
	gssize len = pgm_sendto (sock, FALSE, NULL, FALSE, buf, sizeof(buf), (struct sockaddr*)&addr, 0);
	fail ("reached");
}
END_TEST

/* target:
 * 	int
 * 	pgm_set_nonblocking (
 * 		int			filedes[2]
 * 	)
 */

START_TEST (test_set_nonblocking_pass_001)
{
	int filedes[2] = { fileno (stdout), fileno (stderr) };
	int retval = pgm_set_nonblocking (filedes);
}
END_TEST

START_TEST (test_set_nonblocking_fail_001)
{
	int filedes[2] = { 0, 0 };
	int retval = pgm_set_nonblocking (filedes);
	fail ("reached");
}
END_TEST


static
Suite*
make_test_suite (void)
{
	Suite* s;

	s = suite_create (__FILE__);

	TCase* tc_sendto = tcase_create ("sendto");
	suite_add_tcase (s, tc_sendto);
	tcase_add_test (tc_sendto, test_sendto_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_sendto, test_sendto_fail_001, SIGABRT);
	tcase_add_test_raise_signal (tc_sendto, test_sendto_fail_002, SIGABRT);
	tcase_add_test_raise_signal (tc_sendto, test_sendto_fail_003, SIGABRT);
	tcase_add_test_raise_signal (tc_sendto, test_sendto_fail_004, SIGABRT);
	tcase_add_test_raise_signal (tc_sendto, test_sendto_fail_005, SIGABRT);
#endif

	TCase* tc_set_nonblocking = tcase_create ("set-nonblocking");
	suite_add_tcase (s, tc_set_nonblocking);
	tcase_add_test (tc_set_nonblocking, test_set_nonblocking_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_set_nonblocking, test_set_nonblocking_fail_001, SIGABRT);
#endif
	return s;
}

static
Suite*
make_master_suite (void)
{
	Suite* s = suite_create ("Master");
	return s;
}

int
main (void)
{
	SRunner* sr = srunner_create (make_master_suite ());
	srunner_add_suite (sr, make_test_suite ());
	srunner_run_all (sr, CK_ENV);
	int number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/md5_unittest.c0000644000175000017500000001104311640407354020332 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * unit tests for MD5 hashing (not actual algorithm).
 *
 * Copyright (c) 2009 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#ifdef _WIN32
#	define PGM_CHECK_NOFORK		1
#endif


/* mock state */

/* mock functions for external references */

size_t
pgm_transport_pkt_offset2 (
        const bool                      can_fragment,
        const bool                      use_pgmcc
        )
{
        return 0;
}

#define MD5_DEBUG
#include "md5.c"

PGM_GNUC_INTERNAL
int
pgm_get_nprocs (void)
{
	return 1;
}

/* target:
 *	void
 *	pgm_md5_init_ctx (
 *		struct pgm_md5_t*	ctx
 *	)
 */

START_TEST (test_init_ctx_pass_001)
{
	struct pgm_md5_t ctx;
	memset (&ctx, 0, sizeof(ctx));
	pgm_md5_init_ctx (&ctx);
}
END_TEST

START_TEST (test_init_ctx_fail_001)
{
	pgm_md5_init_ctx (NULL);
	fail ("reached");
}
END_TEST

/* target:
 *	void
 *	pgm_md5_process_bytes (
 *		struct pgm_md5_t*	ctx,
 *		const void*		buffer,
 *		size_t			len
 *	)
 */

START_TEST (test_process_bytes_pass_001)
{
	const char buffer[] = "i am not a string.";
	struct pgm_md5_t ctx;
	memset (&ctx, 0, sizeof(ctx));
	pgm_md5_init_ctx (&ctx);
	pgm_md5_process_bytes (&ctx, buffer, sizeof(buffer));
}
END_TEST

START_TEST (test_process_bytes_fail_001)
{
	const char buffer[] = "i am not a string.";
	pgm_md5_process_bytes (NULL, buffer, sizeof(buffer));
}
END_TEST

/* target:
 *	void*	
 *	pgm_md5_finish_ctx (
 *		struct pgm_md5_t*	ctx,
 *		void*			resbuf
 *	)
 */

START_TEST (test_finish_ctx_pass_001)
{
	const char* buffer = "i am not a string.";
	const char* answer = "ef71-1617-4eef-9737-5e2b-5d7a-d015-b064";

	char md5[1024];
	char resblock[16];
	struct pgm_md5_t ctx;
	memset (&ctx, 0, sizeof(ctx));
	memset (resblock, 0, sizeof(resblock));
	pgm_md5_init_ctx (&ctx);
	pgm_md5_process_bytes (&ctx, buffer, strlen(buffer)+1);
	pgm_md5_finish_ctx (&ctx, resblock);
	sprintf (md5, "%2.2hhx%2.2hhx-%2.2hhx%2.2hhx-%2.2hhx%2.2hhx-%2.2hhx%2.2hhx-%2.2hhx%2.2hhx-%2.2hhx%2.2hhx-%2.2hhx%2.2hhx-%2.2hhx%2.2hhx",
		   resblock[0], resblock[1],
		   resblock[2], resblock[3],
		   resblock[4], resblock[5],
		   resblock[6], resblock[7],
		   resblock[8], resblock[9],
		   resblock[10], resblock[11],
		   resblock[12], resblock[13],
		   resblock[14], resblock[15]);
	g_message ("md5: %s", md5);

	fail_unless (0 == strcmp (md5, answer), "md5 mismatch");
}
END_TEST

START_TEST (test_finish_ctx_fail_001)
{
	char resblock[16];
	pgm_md5_finish_ctx (NULL, resblock);
	fail ("reached");
}
END_TEST


static
Suite*
make_test_suite (void)
{
	Suite* s;

	s = suite_create (__FILE__);

	TCase* tc_init_ctx = tcase_create ("init-ctx");
	suite_add_tcase (s, tc_init_ctx);
	tcase_add_test (tc_init_ctx, test_init_ctx_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_init_ctx, test_init_ctx_fail_001, SIGABRT);
#endif

	TCase* tc_process_bytes = tcase_create ("process_bytes");
	suite_add_tcase (s, tc_process_bytes);
	tcase_add_test (tc_process_bytes, test_process_bytes_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_process_bytes, test_process_bytes_fail_001, SIGABRT);
#endif

	TCase* tc_finish_ctx = tcase_create ("finish-ctx");
	suite_add_tcase (s, tc_finish_ctx);
	tcase_add_test (tc_finish_ctx, test_finish_ctx_pass_001);
#ifndef PGM_CHECK_NOFORK
	tcase_add_test_raise_signal (tc_finish_ctx, test_finish_ctx_fail_001, SIGABRT);
#endif

	return s;
}

static
Suite*
make_master_suite (void)
{
	Suite* s = suite_create ("Master");
	return s;
}

int
main (void)
{
	SRunner* sr = srunner_create (make_master_suite ());
	srunner_add_suite (sr, make_test_suite ());
	srunner_run_all (sr, CK_ENV);
	int number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/CMakeLists.txt0000755000175000017500000001440111640407354020306 0ustar  locallocal# CMake build script for OpenPGM on Windows

cmake_minimum_required (VERSION 2.8)

project (OpenPGM)

#-----------------------------------------------------------------------------
# force off-tree build

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "CMake generation is not allowed within the source directory! 
Remove the CMakeCache.txt file and try again from another folder, e.g.: 

   del CMakeCache.txt 
   mkdir cmake-make 
   cd cmake-make
   cmake ..
")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

#-----------------------------------------------------------------------------
# dependencies

find_package(PythonInterp REQUIRED)
find_package(Perl REQUIRED)
find_program(PATCH_EXECUTABLE patch)

#-----------------------------------------------------------------------------
# default to Release build

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING
      "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
endif(NOT CMAKE_BUILD_TYPE)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib)

#-----------------------------------------------------------------------------
# platform specifics

add_definitions(
	-DWIN32
	-DCONFIG_HAVE_ISO_VARARGS
	-DCONFIG_HAVE_TSC
	-DCONFIG_HAVE_WSACMSGHDR
	-DCONFIG_HAVE_DSO_VISIBILITY
	-DCONFIG_HAVE_SECURITY_ENHANCED_CRT
	-DCONFIG_BIND_INADDR_ANY
)

#-----------------------------------------------------------------------------
# source files

set(c99-sources
        thread.c
        mem.c
        string.c
        list.c
        slist
        queue.c
        hashtable.c
        messages.c
        error.c
        math.c
        packet_parse.c
        packet_test.c
        sockaddr.c
        time.c
        if.c
        getifaddrs.c
	get_nprocs.c
        getnetbyname.c
        getnodeaddr.c
        getprotobyname.c
        indextoaddr.c
        indextoname.c
        nametoindex.c
        inet_network.c
        md5.c
        rand.c
        gsi.c
        tsi.c
        txw.c
        rxw.c
        skbuff.c
        socket.c
        source.c
        receiver.c
        recv.c
        engine.c
        timer.c
        net.c
        rate_control.c
        checksum.c
        reed_solomon.c
        wsastrerror.c
        histogram.c
)

include_directories(
	include
)
set(headers
	include/pgm/atomic.h
	include/pgm/engine.h
	include/pgm/error.h
	include/pgm/gsi.h
	include/pgm/if.h
	include/pgm/in.h
	include/pgm/list.h
	include/pgm/macros.h
	include/pgm/mem.h
	include/pgm/messages.h
	include/pgm/msgv.h
	include/pgm/packet.h
	include/pgm/pgm.h
	include/pgm/skbuff.h
	include/pgm/socket.h
	include/pgm/time.h
	include/pgm/tsi.h
	include/pgm/types.h
	include/pgm/version.h
	include/pgm/winint.h
	include/pgm/wininttypes.h
	include/pgm/zinttypes.h
)

add_definitions(
	-DCONFIG_16BIT_CHECKSUM
	-DCONFIG_TICKET_SPINLOCK
	-DCONFIG_DUMB_RWSPINLOCK
	-DCONFIG_GALOIS_MUL_LUT
	-DGETTEXT_PACKAGE='"pgm"'
)

#-----------------------------------------------------------------------------
# source generators

foreach (source ${c99-sources})
	string(REGEX REPLACE "\\.c$" "" source "${source}")
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.c.c89.patch)
		add_custom_command(
			OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${source}.c89.c
			COMMAND ${CMAKE_COMMAND}
			ARGS	-E
				copy
				${CMAKE_CURRENT_SOURCE_DIR}/${source}.c
				${CMAKE_CURRENT_BINARY_DIR}/${source}.c89.c
			COMMAND ${PATCH_EXECUTABLE}
			ARGS	--binary
				-i
				${CMAKE_CURRENT_SOURCE_DIR}/${source}.c.c89.patch
				${CMAKE_CURRENT_BINARY_DIR}/${source}.c89.c
			DEPENDS ${source}.c
				${CMAKE_CURRENT_SOURCE_DIR}/${source}.c.c89.patch
		)
	else(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.c.c89.patch)
		add_custom_command(
			OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${source}.c89.c
			COMMAND ${CMAKE_COMMAND}
			ARGS	-E
				copy
				${CMAKE_CURRENT_SOURCE_DIR}/${source}.c
				${CMAKE_CURRENT_BINARY_DIR}/${source}.c89.c
			DEPENDS ${source}.c
		)
	endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.c.c89.patch)
	list(APPEND generated-results ${CMAKE_CURRENT_BINARY_DIR}/${source}.c89.c)
endforeach()

# generated galois tables
add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/galois_tables.c89.c
	COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/galois_generator.pl > ${CMAKE_CURRENT_BINARY_DIR}/galois_tables.c89.c
	DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/galois_generator.pl
)

# version stamping
add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.c89.c
	COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/version_generator.py > ${CMAKE_CURRENT_BINARY_DIR}/version.c89.c
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version_generator.py
)

set(sources
        ${CMAKE_CURRENT_BINARY_DIR}/galois_tables.c89.c
        ${CMAKE_CURRENT_BINARY_DIR}/version.c89.c
        ${generated-results}
)

#-----------------------------------------------------------------------------
# output

add_library(libpgm STATIC ${sources})

set(docs
	COPYING
	LICENSE
	README
)
file(GLOB mibs "${CMAKE_CURRENT_SOURCE_DIR}/mibs/*.txt")
set(examples
	examples/async.c
	examples/async.h
	examples/daytime.c
	examples/getopt.c
	examples/getopt.h
	examples/purinrecv.c
	examples/purinsend.c
	examples/shortcakerecv.c
)

install (TARGETS libpgm DESTINATION lib)
install (FILES ${headers} DESTINATION include/pgm)
install (FILES ${docs} DESTINATION doc)
install (FILES ${mibs} DESTINATION mibs)
install (FILES ${examples} DESTINATION examples)

include (InstallRequiredSystemLibraries)
set (CPACK_PACKAGE_VENDOR "Miru Limited")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
execute_process (COMMAND perl version.pl "%major"
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_MAJOR)
execute_process (COMMAND perl version.pl "%minor"
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_MINOR)
execute_process (COMMAND perl version.pl "%micro"
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH)
include (CPack)

# end of file
libpgm-5.1.118-1~dfsg/openpgm/pgm/pgmMIB.c0000644000175000017500000030200511640407354017022 0ustar  locallocal/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
 */

#include 
#include 
#include 

#include 
#include 
#include 
#include 

#include "pgm/snmp.h"
#include "impl/pgmMIB.h"
#include "impl/pgmMIB_columns.h"
#include "impl/pgmMIB_enums.h"


//#define PGMMIB_DEBUG


/* locals */

struct pgm_snmp_data_context_t {
	pgm_sock_t*	sock;
	pgm_peer_t*	peer;
};

typedef struct pgm_snmp_data_context_t pgm_snmp_data_context_t;

struct pgm_snmp_context_t {
	pgm_slist_t*	list;
	pgm_list_t*	node;
	int		index;		/* table index */
	unsigned 	instance;	/* unique number per node */
	pgm_snmp_data_context_t	data_context;
};

typedef struct pgm_snmp_context_t pgm_snmp_context_t;


static const oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};


/* functions */

static int initialize_table_pgmSourceTable(void);
static Netsnmp_Node_Handler pgmSourceTable_handler;
static Netsnmp_First_Data_Point pgmSourceTable_get_first_data_point;
static Netsnmp_Next_Data_Point pgmSourceTable_get_next_data_point;
static Netsnmp_Free_Loop_Context pgmSourceTable_free_loop_context;

static int initialize_table_pgmSourceConfigTable(void);
static Netsnmp_Node_Handler pgmSourceConfigTable_handler;
static Netsnmp_First_Data_Point pgmSourceConfigTable_get_first_data_point;
static Netsnmp_Next_Data_Point pgmSourceConfigTable_get_next_data_point;
static Netsnmp_Free_Loop_Context pgmSourceConfigTable_free_loop_context;

static int initialize_table_pgmSourcePerformanceTable(void);
static Netsnmp_Node_Handler pgmSourcePerformanceTable_handler;
static Netsnmp_First_Data_Point pgmSourcePerformanceTable_get_first_data_point;
static Netsnmp_Next_Data_Point pgmSourcePerformanceTable_get_next_data_point;
static Netsnmp_Free_Loop_Context pgmSourcePerformanceTable_free_loop_context;

static int initialize_table_pgmReceiverTable(void);
static Netsnmp_Node_Handler pgmReceiverTable_handler;
static Netsnmp_First_Data_Point pgmReceiverTable_get_first_data_point;
static Netsnmp_Next_Data_Point pgmReceiverTable_get_next_data_point;
static Netsnmp_Free_Loop_Context pgmReceiverTable_free_loop_context;

static int initialize_table_pgmReceiverConfigTable(void);
static Netsnmp_Node_Handler pgmReceiverConfigTable_handler;
static Netsnmp_First_Data_Point pgmReceiverConfigTable_get_first_data_point;
static Netsnmp_Next_Data_Point pgmReceiverConfigTable_get_next_data_point;
static Netsnmp_Free_Loop_Context pgmReceiverConfigTable_free_loop_context;

static int initialize_table_pgmReceiverPerformanceTable(void);
static Netsnmp_Node_Handler pgmReceiverPerformanceTable_handler;
static Netsnmp_First_Data_Point pgmReceiverPerformanceTable_get_first_data_point;
static Netsnmp_Next_Data_Point pgmReceiverPerformanceTable_get_next_data_point;
static Netsnmp_Free_Loop_Context pgmReceiverPerformanceTable_free_loop_context;

PGM_GNUC_INTERNAL
bool
pgm_mib_init (
	pgm_error_t**	error
	)
{
	if (MIB_REGISTERED_OK != initialize_table_pgmSourceTable()) {
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_SNMP,
			     PGM_ERROR_FAILED,
			     _("pgmSourceTable registration: see SNMP log for further details."));
		return FALSE;
	}
	if (MIB_REGISTERED_OK != initialize_table_pgmSourceConfigTable()) {
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_SNMP,
			     PGM_ERROR_FAILED,
			     _("pgmSourceConfigTable registration: see SNMP log for further details."));
		return FALSE;
	}
	if (MIB_REGISTERED_OK != initialize_table_pgmSourcePerformanceTable()) {
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_SNMP,
			     PGM_ERROR_FAILED,
			     _("pgmSourcePerformanceTable registration: see SNMP log for further details."));
		return FALSE;
	}
	if (MIB_REGISTERED_OK != initialize_table_pgmReceiverTable()) {
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_SNMP,
			     PGM_ERROR_FAILED,
			     _("pgmReceiverTable registration: see SNMP log for further details."));
		return FALSE;
	}
	if (MIB_REGISTERED_OK != initialize_table_pgmReceiverConfigTable()) {
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_SNMP,
			     PGM_ERROR_FAILED,
			     _("pgmReceiverConfigTable registration: see SNMP log for further details."));
		return FALSE;
	}
	if (MIB_REGISTERED_OK != initialize_table_pgmReceiverPerformanceTable()) {
		pgm_set_error (error,
			     PGM_ERROR_DOMAIN_SNMP,
			     PGM_ERROR_FAILED,
			     _("pgmReceiverPerformanceTable registration: see SNMP log for further details."));
		return FALSE;
	}

	return TRUE;
}

/*
 * pgmSourceTable
 *
 * returns MIB_REGISTERED_OK on success, failures include:
 * 	MIB_REGISTRATION_FAILED
 * 	MIB_DUPLICATE_REGISTRATION
 * 	SNMPERR_GENERR
 */

static
int
initialize_table_pgmSourceTable (void)
{
	pgm_debug ("initialize_table_pgmSourceTable ()");

	static const oid pgmSourceTable_oid[] = {1,3,6,1,3,112,1,2,100,2};
	netsnmp_table_registration_info* table_info = NULL;
	netsnmp_iterator_info* iinfo = NULL;
	netsnmp_handler_registration* reg = NULL;

	reg = netsnmp_create_handler_registration ("pgmSourceTable",	pgmSourceTable_handler,
						   pgmSourceTable_oid,	OID_LENGTH( pgmSourceTable_oid ),
						   HANDLER_CAN_RONLY);
	if (NULL == reg)
		goto error;

	table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
	if (NULL == table_info)
		goto error;

	table_info->min_column = COLUMN_PGMSOURCESOURCEADDRESS;
	table_info->max_column = COLUMN_PGMSOURCESOURCEPORTNUMBER;

	netsnmp_table_helper_add_indexes (table_info,
					  ASN_OCTET_STR,  /* index: pgmSourceGlobalId */
					  ASN_UNSIGNED,  /* index: pgmSourceSourcePort */
					  0);

	iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
	if (NULL == iinfo)
		goto error;

	iinfo->get_first_data_point 	= pgmSourceTable_get_first_data_point;
	iinfo->get_next_data_point  	= pgmSourceTable_get_next_data_point;
	iinfo->free_loop_context_at_end = pgmSourceTable_free_loop_context;
	iinfo->table_reginfo        	= table_info;

	return netsnmp_register_table_iterator (reg, iinfo);

error:
	if (table_info && table_info->indexes)		/* table_data_free_func() is internal */
		snmp_free_var (table_info->indexes);
	SNMP_FREE( table_info );
	SNMP_FREE( iinfo );
	netsnmp_handler_registration_free (reg);

	return -1;
}

/* called for first row of data in SNMP table
 *
 * goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
 * optionally returns my_data_context.
 *
 * returns answer or NULL
 */

static
netsnmp_variable_list*
pgmSourceTable_get_first_data_point(
	void**			my_loop_context,	/* valid through one query of multiple "data points" */
	void**			my_data_context,	/* answer blob which is passed to handler() */
	netsnmp_variable_list*	put_index_data,		/* answer */
	netsnmp_iterator_info*	mydata			/* iinfo on init() */
	)
{
/* pre-conditions */
	pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != my_data_context);
	pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

	pgm_debug ("pgmSourceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
		(const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_rwlock_reader_lock (&pgm_sock_list_lock);

	if (NULL == pgm_sock_list) {
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

/* create our own context for this SNMP loop */
	pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
	context->list = pgm_sock_list;
	*my_loop_context = context;

/* pass on for generic row access */
	return pgmSourceTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
}

static
netsnmp_variable_list*
pgmSourceTable_get_next_data_point(
	void**			my_loop_context,
	void**			my_data_context,
	netsnmp_variable_list*	put_index_data,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
	pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != my_data_context);
	pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

	pgm_debug ("pgmSourceTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
		(const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
	netsnmp_variable_list *idx = put_index_data;

	if (NULL == context->list)
		return NULL;

	pgm_sock_t* sock = context->list->data;

/* pgmSourceGlobalId */
	char gsi[ PGM_GSISTRLEN ];
	pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi));
	snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
	idx = idx->next_variable;

/* pgmSourceSourcePort */
	const unsigned sport = ntohs (sock->tsi.sport);
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));

	*my_data_context = sock;
	context->list = context->list->next;

	return put_index_data;
}

static
void
pgmSourceTable_free_loop_context (
	void*			my_loop_context,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
	pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != mydata);

	pgm_debug ("pgmSourceTable_free_loop_context (my_loop_context:%p mydata:%p)",
		(const void*)my_loop_context,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
	pgm_free (context);
	my_loop_context = NULL;

	pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
}

static
int
pgmSourceTable_handler (
	netsnmp_mib_handler*		handler,
	netsnmp_handler_registration*	reginfo,
	netsnmp_agent_request_info*	reqinfo,
	netsnmp_request_info*		requests
	)
{
/* pre-conditions */
	pgm_assert (NULL != handler);
	pgm_assert (NULL != reginfo);
	pgm_assert (NULL != reqinfo);
	pgm_assert (NULL != requests);

	pgm_debug ("pgmSourceTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
		(const void*)handler,
		(const void*)reginfo,
		(const void*)reqinfo,
		(const void*)requests);
	
	switch (reqinfo->mode) {

/* Read-support (also covers GetNext requests) */

	case MODE_GET:
		for (netsnmp_request_info* request = requests;
		     request;
		     request = request->next)
		{
			const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context (request);
			if (NULL == sock) {
				netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
				continue;
			}

			netsnmp_variable_list *var = request->requestvb;
			netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
			if (NULL == table_info) {
				snmp_log (LOG_ERR, "pgmSourceTable_handler: empty table request info.\n");
				continue;
			}

			switch (table_info->colnum) {

			case COLUMN_PGMSOURCESOURCEADDRESS:
				{
					struct sockaddr_in s4;
					if (AF_INET == sock->send_gsr.gsr_source.ss_family)
						memcpy (&s4, &sock->send_gsr.gsr_source, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

			case COLUMN_PGMSOURCEGROUPADDRESS:
				{
					struct sockaddr_in s4;
					if (AF_INET == sock->send_gsr.gsr_group.ss_family)
						memcpy (&s4, &sock->send_gsr.gsr_group, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

			case COLUMN_PGMSOURCEDESTPORT:
				{
					const unsigned dport = ntohs (sock->dport);
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&dport, sizeof(dport) );
				}
				break;

/* copy index[0] */
			case COLUMN_PGMSOURCESOURCEGSI:
				snmp_set_var_typed_value (var, ASN_OCTET_STR,
							  (const u_char*)table_info->indexes->val.string,
							  table_info->indexes->val_len);
				break;

/* copy index[1] */
			case COLUMN_PGMSOURCESOURCEPORTNUMBER:
				snmp_set_var_typed_value (var, ASN_UNSIGNED,
							  (const u_char*)table_info->indexes->next_variable->val.integer,
							  table_info->indexes->next_variable->val_len);
			
				break;

			default:
				snmp_log (LOG_ERR, "pgmSourceTable_handler: unknown column.\n");
				break;
			}
		}
		break;

	case MODE_SET_RESERVE1:
	default:
		snmp_log (LOG_ERR, "pgmSourceTable_handler: unsupported mode.\n");
		break;

	}

	return SNMP_ERR_NOERROR;
}

/*
 * pgmSourceConfigTable
 *
 */

static
int
initialize_table_pgmSourceConfigTable(void)
{
	pgm_debug ("initialize_table_pgmSourceConfigTable ()");

	static const oid pgmSourceConfigTable_oid[] = {1,3,6,1,3,112,1,2,100,3};
	netsnmp_table_registration_info* table_info = NULL;
	netsnmp_iterator_info* iinfo = NULL;
	netsnmp_handler_registration* reg = NULL;

	reg = netsnmp_create_handler_registration ("pgmSourceConfigTable",	pgmSourceConfigTable_handler,
						   pgmSourceConfigTable_oid,	OID_LENGTH( pgmSourceConfigTable_oid ),
						   HANDLER_CAN_RONLY);
	if (NULL == reg)
		goto error;

	table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
	if (NULL == table_info)
		goto error;

	table_info->min_column = COLUMN_PGMSOURCETTL;
	table_info->max_column = COLUMN_PGMSOURCESPMPATHADDRESS;

	netsnmp_table_helper_add_indexes (table_info,
					  ASN_OCTET_STR,  /* index: pgmSourceConfigGlobalId */
					  ASN_UNSIGNED,  /* index: pgmSourceConfigSourcePort */
					  0);

	iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
	if (NULL == iinfo)
		goto error;

	iinfo->get_first_data_point 	= pgmSourceConfigTable_get_first_data_point;
	iinfo->get_next_data_point 	= pgmSourceConfigTable_get_next_data_point;
	iinfo->free_loop_context_at_end = pgmSourceConfigTable_free_loop_context;
	iinfo->table_reginfo        	= table_info;

	return netsnmp_register_table_iterator (reg, iinfo);

error:
	if (table_info && table_info->indexes)		/* table_data_free_func() is internal */
		snmp_free_var (table_info->indexes);
	SNMP_FREE( table_info );
	SNMP_FREE( iinfo );
	netsnmp_handler_registration_free (reg);

	return -1;
}

/* called for first row of data in SNMP table
 *
 * goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
 * optionally returns my_data_context.
 *
 * returns answer or NULL
 */

static
netsnmp_variable_list*
pgmSourceConfigTable_get_first_data_point(
	void**			my_loop_context,	/* valid through one query of multiple "data points" */
	void**			my_data_context,	/* answer blob which is passed to handler() */
	netsnmp_variable_list*	put_index_data,		/* answer */
	netsnmp_iterator_info*	mydata			/* iinfo on init() */
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmSourceConfigTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_rwlock_reader_lock (&pgm_sock_list_lock);

	if (NULL == pgm_sock_list) {
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

/* create our own context for this SNMP loop */
	pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
	context->list = pgm_sock_list;
	*my_loop_context = context;

/* pass on for generic row access */
	return pgmSourceConfigTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
}

static
netsnmp_variable_list*
pgmSourceConfigTable_get_next_data_point(
	void**			my_loop_context,
	void**			my_data_context,
	netsnmp_variable_list*	put_index_data,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmSourceConfigTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
	netsnmp_variable_list *idx = put_index_data;

	if (NULL == context->list)
		return NULL;

	pgm_sock_t* sock = context->list->data;

/* pgmSourceGlobalId */
	char gsi[ PGM_GSISTRLEN ];
	pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi));
	snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
	idx = idx->next_variable;

/* pgmSourceSourcePort */
	const unsigned sport = ntohs (sock->tsi.sport);
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));

	*my_data_context = sock;
	context->list = context->list->next;

	return put_index_data;
}

static
void
pgmSourceConfigTable_free_loop_context (
	void*			my_loop_context,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmSourceConfigTable_free_loop_context (my_loop_context:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
	pgm_free (context);
	my_loop_context = NULL;

	pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
}

static
int
pgmSourceConfigTable_handler (
	netsnmp_mib_handler*		handler,
	netsnmp_handler_registration*	reginfo,
	netsnmp_agent_request_info*	reqinfo,
	netsnmp_request_info*		requests
	)
{
/* pre-conditions */
        pgm_assert (NULL != handler);
        pgm_assert (NULL != reginfo);
        pgm_assert (NULL != reqinfo);
        pgm_assert (NULL != requests);

        pgm_debug ("pgmSourceConfigTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
                (const void*)handler,
		(const void*)reginfo,
		(const void*)reqinfo,
		(const void*)requests);

	switch (reqinfo->mode) {

/* Read-support (also covers GetNext requests) */

	case MODE_GET:
		for (netsnmp_request_info* request = requests;
		     request;
		     request = request->next)
		{
			const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context (request);
			if (NULL == sock) {
				netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
				continue;
			}

			netsnmp_variable_list *var = request->requestvb;
			netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
			if (NULL == table_info) {
				snmp_log (LOG_ERR, "pgmSourceTable_handler: empty table request info.\n");
				continue;
			}

			switch (table_info->colnum) {

			case COLUMN_PGMSOURCETTL:
				{
					const unsigned hops = sock->hops;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&hops, sizeof(hops) );
				}
				break;

			case COLUMN_PGMSOURCEADVMODE:
				{
					const unsigned adv_mode = 0 == sock->adv_mode ? PGMSOURCEADVMODE_TIME : PGMSOURCEADVMODE_DATA;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&adv_mode, sizeof(adv_mode) );
				}
				break;

/* FIXED: pgmSourceLateJoin = disable(2) */
			case COLUMN_PGMSOURCELATEJOIN:
				{
					const unsigned late_join = PGMSOURCELATEJOIN_DISABLE;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&late_join, sizeof(late_join) );
				}
				break;

			case COLUMN_PGMSOURCETXWMAXRTE:
				{
					const unsigned txw_max_rte = sock->txw_max_rte;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&txw_max_rte, sizeof(txw_max_rte) );
				}
				break;

			case COLUMN_PGMSOURCETXWSECS:
				{
					const unsigned txw_secs = sock->txw_secs;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&txw_secs, sizeof(txw_secs) );
				}
				break;

/* FIXED: TXW_ADV_SECS = 0 */
			case COLUMN_PGMSOURCETXWADVSECS:
				{
					const unsigned txw_adv_secs = 0;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&txw_adv_secs, sizeof(txw_adv_secs) );
				}
				break;

/* FIXED: pgmSourceAdvIvl = TXW_ADV_SECS * 1000 = 0 */
			case COLUMN_PGMSOURCEADVIVL:
				{
					const unsigned adv_ivl = 0;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&adv_ivl, sizeof(adv_ivl) );
				}
				break;

			case COLUMN_PGMSOURCESPMIVL:
				{
					const unsigned spm_ivl = pgm_to_msecs (sock->spm_ambient_interval);
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&spm_ivl, sizeof(spm_ivl) );
				}
				break;

/* TODO: IHB_MIN */
			case COLUMN_PGMSOURCESPMHEARTBEATIVLMIN:
				{
					const unsigned ihb_min = 0;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&ihb_min, sizeof(ihb_min) );
				}
				break;

/* TODO: IHB_MAX */
			case COLUMN_PGMSOURCESPMHEARTBEATIVLMAX:
				{
					const unsigned ihb_max = 0;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&ihb_max, sizeof(ihb_max) );
				}
				break;

/* NAK_BO_IVL */
			case COLUMN_PGMSOURCERDATABACKOFFIVL:
				{
					const unsigned nak_bo_ivl = pgm_to_msecs (sock->nak_bo_ivl);
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_bo_ivl, sizeof(nak_bo_ivl) );
				}
				break;

/* FIXED: pgmSourceFEC = disabled(1) */
			case COLUMN_PGMSOURCEFEC:
				{
					const unsigned fec = (sock->use_ondemand_parity || sock->use_proactive_parity) ? 1 : 0;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&fec, sizeof(fec) );
				}
				break;

/* FIXED: pgmSourceFECTransmissionGrpSize = 0 */
			case COLUMN_PGMSOURCEFECTRANSMISSIONGRPSIZE:
				{
					const unsigned fec_tgs = sock->rs_k;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&fec_tgs, sizeof(fec_tgs) );
				}
				break;

/* FIXED: pgmSourceFECProactiveParitySize = 0 */
			case COLUMN_PGMSOURCEFECPROACTIVEPARITYSIZE:
				{
					const unsigned fec_paps = sock->rs_proactive_h;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&fec_paps, sizeof(fec_paps) );
				}
				break;

/* IPv6 not supported */
			case COLUMN_PGMSOURCESPMPATHADDRESS:
				{
					struct sockaddr_in s4;
					if (AF_INET == sock->recv_gsr[0].gsr_source.ss_family)
						memcpy (&s4, &sock->recv_gsr[0].gsr_source, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

			default:
				snmp_log (LOG_ERR, "pgmSourceConfigTable_handler: unknown column.\n");
				break;
			}
		}
		break;

	case MODE_SET_RESERVE1:
	default:
		snmp_log (LOG_ERR, "pgmSourceConfigTable_handler: unsupported mode.\n");
		break;

	}

	return SNMP_ERR_NOERROR;
}

/*
 * pgmSourcePerformanceTable
 */

static
int
initialize_table_pgmSourcePerformanceTable (void)
{
	pgm_debug ("initialize_table_pgmSourcePerformanceTable ()");

	static const oid pgmSourcePerformanceTable_oid[] = {1,3,6,1,3,112,1,2,100,4};
	netsnmp_table_registration_info* table_info = NULL;
	netsnmp_iterator_info* iinfo = NULL;
	netsnmp_handler_registration* reg = NULL;

	reg = netsnmp_create_handler_registration ("pgmSourcePerformanceTable",		pgmSourcePerformanceTable_handler,
						   pgmSourcePerformanceTable_oid,	OID_LENGTH( pgmSourcePerformanceTable_oid ),
						   HANDLER_CAN_RONLY);
	if (NULL == reg)
		goto error;

	table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
	if (NULL == table_info)
		goto error;

	table_info->min_column = COLUMN_PGMSOURCEDATABYTESSENT;
	table_info->max_column = COLUMN_PGMSOURCENNAKERRORS;

	netsnmp_table_helper_add_indexes (table_info,
					  ASN_OCTET_STR,  /* index: pgmSourceGlobalId */
					  ASN_UNSIGNED,  /* index: pgmSourceSourcePort */
					  0);

	iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
	if (NULL == iinfo)
		goto error;

	iinfo->get_first_data_point 	= pgmSourcePerformanceTable_get_first_data_point;
	iinfo->get_next_data_point  	= pgmSourcePerformanceTable_get_next_data_point;
	iinfo->free_loop_context_at_end = pgmSourcePerformanceTable_free_loop_context;
	iinfo->table_reginfo        	= table_info;

	return netsnmp_register_table_iterator (reg, iinfo);

error:
	if (table_info && table_info->indexes)		/* table_data_free_func() is internal */
		snmp_free_var (table_info->indexes);
	SNMP_FREE( table_info );
	SNMP_FREE( iinfo );
	netsnmp_handler_registration_free (reg);

	return -1;
}

/* called for first row of data in SNMP table
 *
 * goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
 * optionally returns my_data_context.
 *
 * returns answer or NULL
 */

static
netsnmp_variable_list*
pgmSourcePerformanceTable_get_first_data_point (
	void**			my_loop_context,	/* valid through one query of multiple "data points" */
	void**			my_data_context,	/* answer blob which is passed to handler() */
	netsnmp_variable_list*	put_index_data,		/* answer */
	netsnmp_iterator_info*	mydata			/* iinfo on init() */
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmSourcePerformanceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_rwlock_reader_lock (&pgm_sock_list_lock);

	if (NULL == pgm_sock_list) {
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

/* create our own context for this SNMP loop */
	pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
	context->list = pgm_sock_list;
	*my_loop_context = context;

/* pass on for generic row access */
	return pgmSourcePerformanceTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
}

static
netsnmp_variable_list*
pgmSourcePerformanceTable_get_next_data_point (
	void**			my_loop_context,
	void**			my_data_context,
	netsnmp_variable_list*	put_index_data,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmSourcePerformanceTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
	netsnmp_variable_list *idx = put_index_data;

	if (NULL == context->list)
		return NULL;

	pgm_sock_t* sock = context->list->data;

/* pgmSourceGlobalId */
	char gsi[ PGM_GSISTRLEN ];
	pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi));
	snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
	idx = idx->next_variable;

/* pgmSourceSourcePort */
	const unsigned sport = ntohs (sock->tsi.sport);
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));

	*my_data_context = sock;
	context->list = context->list->next;

	return put_index_data;
}

static
void
pgmSourcePerformanceTable_free_loop_context (
	void*			my_loop_context,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmPerformanceSourceTable_free_loop_context (my_loop_context:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)mydata);
 
	pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
	pgm_free (context);
	my_loop_context = NULL;

	pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
}

static
int
pgmSourcePerformanceTable_handler (
	netsnmp_mib_handler*		handler,
	netsnmp_handler_registration*	reginfo,
	netsnmp_agent_request_info*	reqinfo,
	netsnmp_request_info*		requests
	)
{
/* pre-conditions */
        pgm_assert (NULL != handler);
        pgm_assert (NULL != reginfo);
        pgm_assert (NULL != reqinfo);
        pgm_assert (NULL != requests);

        pgm_debug ("pgmSourcePerformanceTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
                (const void*)handler,
		(const void*)reginfo,
		(const void*)reqinfo,
		(const void*)requests);

	switch (reqinfo->mode) {

/* Read-support (also covers GetNext requests) */

	case MODE_GET:
		for (netsnmp_request_info* request = requests;
		     request;
		     request = request->next)
		{
			const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context (request);
			if (NULL == sock) {
				netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
				continue;
			}

			const pgm_txw_t* window = (const pgm_txw_t*)sock->window;

			netsnmp_variable_list *var = request->requestvb;
			netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
			if (NULL == table_info) {
				snmp_log (LOG_ERR, "pgmSourceTable_handler: empty table request info.\n");
				continue;
			}

			switch (table_info->colnum) {

			case COLUMN_PGMSOURCEDATABYTESSENT:
				{
					const unsigned data_bytes = sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&data_bytes, sizeof(data_bytes) );
				}
				break;

			case COLUMN_PGMSOURCEDATAMSGSSENT:
				{
					const unsigned data_msgs = sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&data_msgs, sizeof(data_msgs) );
				}
				break;

			case COLUMN_PGMSOURCEBYTESBUFFERED:
				{
					const unsigned bytes_buffered = sock->can_send_data ? pgm_txw_size (window) : 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&bytes_buffered, sizeof(bytes_buffered) );
				}
				break;

			case COLUMN_PGMSOURCEMSGSBUFFERED:
				{
					const unsigned msgs_buffered = sock->can_send_data ? pgm_txw_length (window) : 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&msgs_buffered, sizeof(msgs_buffered) );
				}
				break;

/* PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED + COLUMN_PGMSOURCEPARITYBYTESRETRANSMITTED */
			case COLUMN_PGMSOURCEBYTESRETRANSMITTED:
				{
					const unsigned bytes_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&bytes_resent, sizeof(bytes_resent) );
				}
				break;

/* PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED + COLUMN_PGMSOURCEPARITYMSGSRETRANSMITTED */
			case COLUMN_PGMSOURCEMSGSRETRANSMITTED:
				{
					const unsigned msgs_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&msgs_resent, sizeof(msgs_resent) );
				}
				break;

			case COLUMN_PGMSOURCEBYTESSENT:
				{
					const unsigned bytes_sent = sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&bytes_sent, sizeof(bytes_sent) );
				}
				break;

/* COLUMN_PGMSOURCEPARITYNAKPACKETSRECEIVED + COLUMN_PGMSOURCESELECTIVENAKPACKETSRECEIVED */
			case COLUMN_PGMSOURCERAWNAKSRECEIVED:
				{
					const unsigned nak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&nak_packets, sizeof(nak_packets) );
				}
				break;

/* PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED + COLUMN_PGMSOURCEPARITYNAKSIGNORED */
			case COLUMN_PGMSOURCENAKSIGNORED:
				{
					const unsigned naks_ignored = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_ignored, sizeof(naks_ignored) );
				}
				break;

			case COLUMN_PGMSOURCECKSUMERRORS:
				{
					const unsigned cksum_errors = sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&cksum_errors, sizeof(cksum_errors) );
				}
				break;

			case COLUMN_PGMSOURCEMALFORMEDNAKS:
				{
					const unsigned malformed_naks = sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_naks, sizeof(malformed_naks) );
				}
				break;

			case COLUMN_PGMSOURCEPACKETSDISCARDED:
				{
					const unsigned packets_discarded = sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&packets_discarded, sizeof(packets_discarded) );
				}
				break;

/* PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED + COLUMN_PGMSOURCEPARITYNAKSRECEIVED */
			case COLUMN_PGMSOURCENAKSRCVD:
				{
					const unsigned naks_received = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_received, sizeof(naks_received) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYBYTESRETRANSMITTED:
				{
					const unsigned parity_bytes_resent = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_bytes_resent, sizeof(parity_bytes_resent) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVEBYTESRETRANSMITED:
				{
					const unsigned selective_bytes_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_bytes_resent, sizeof(selective_bytes_resent) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYMSGSRETRANSMITTED:
				{
					const unsigned parity_msgs_resent = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_msgs_resent, sizeof(parity_msgs_resent) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVEMSGSRETRANSMITTED:
				{
					const unsigned selective_msgs_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_msgs_resent, sizeof(selective_msgs_resent) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEBYTESADMIT:
				{
					const unsigned bytes_admit = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&bytes_admit, sizeof(bytes_admit) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEMSGSADMIT:
				{
					const unsigned msgs_admit = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&msgs_admit, sizeof(msgs_admit) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYNAKPACKETSRECEIVED:
				{
					const unsigned parity_nak_packets = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_nak_packets, sizeof(parity_nak_packets) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVENAKPACKETSRECEIVED:
				{
					const unsigned selective_nak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_nak_packets, sizeof(selective_nak_packets) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYNAKSRECEIVED:
				{
					const unsigned parity_naks = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_naks, sizeof(parity_naks) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVENAKSRECEIVED:
				{
					const unsigned selective_naks = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_naks, sizeof(selective_naks) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYNAKSIGNORED:
				{
					const unsigned parity_naks_ignored = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_naks_ignored, sizeof(parity_naks_ignored) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVENAKSIGNORED:
				{
					const unsigned selective_naks_ignored = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_naks_ignored, sizeof(selective_naks_ignored) );
				}
				break;

			case COLUMN_PGMSOURCEACKERRORS:
				{
					const unsigned ack_errors = sock->cumulative_stats[PGM_PC_SOURCE_ACK_ERRORS];;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&ack_errors, sizeof(ack_errors) );
				}
				break;

			case COLUMN_PGMSOURCEPGMCCACKER:
				{
					struct sockaddr_in s4;
					if (AF_INET == sock->acker_nla.ss_family)
						memcpy (&s4, &sock->acker_nla, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

			case COLUMN_PGMSOURCETRANSMISSIONCURRENTRATE:
				{
					const unsigned tx_current_rate = sock->cumulative_stats[PGM_PC_SOURCE_TRANSMISSION_CURRENT_RATE];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&tx_current_rate, sizeof(tx_current_rate) );
				}
				break;

			case COLUMN_PGMSOURCEACKPACKETSRECEIVED:
				{
					const unsigned ack_packets = sock->cumulative_stats[PGM_PC_SOURCE_ACK_PACKETS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&ack_packets, sizeof(ack_packets) );
				}
				break;

/* COLUMN_PGMSOURCEPARITYNNAKPACKETSRECEIVED + COLUMN_PGMSOURCESELECTIVENNAKPACKETSRECEIVED */
			case COLUMN_PGMSOURCENNAKPACKETSRECEIVED:
				{
					const unsigned nnak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&nnak_packets, sizeof(nnak_packets) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYNNAKPACKETSRECEIVED:
				{
					const unsigned parity_nnak_packets = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_nnak_packets, sizeof(parity_nnak_packets) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVENNAKPACKETSRECEIVED:
				{
					const unsigned selective_nnak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_nnak_packets, sizeof(selective_nnak_packets) );
				}
				break;

/* COLUMN_PGMSOURCEPARITYNNAKSRECEIVED + COLUMN_PGMSOURCESELECTIVENNAKSRECEIVED */
			case COLUMN_PGMSOURCENNAKSRECEIVED:
				{
					const unsigned nnaks_received = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&nnaks_received, sizeof(nnaks_received) );
				}
				break;

/* FIXED: 0 */
			case COLUMN_PGMSOURCEPARITYNNAKSRECEIVED:
				{
					const unsigned parity_nnaks = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_nnaks, sizeof(parity_nnaks) );
				}
				break;

			case COLUMN_PGMSOURCESELECTIVENNAKSRECEIVED:
				{
					const unsigned selective_nnaks = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&selective_nnaks, sizeof(selective_nnaks) );
				}
				break;

			case COLUMN_PGMSOURCENNAKERRORS:
				{
					const unsigned malformed_nnaks = sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_nnaks, sizeof(malformed_nnaks) );
				}
				break;

			default:
				snmp_log (LOG_ERR, "pgmSourcePerformanceTable_handler: unknown column.\n");
				break;
			}
		}
		break;

	case MODE_SET_RESERVE1:
	default:
		snmp_log (LOG_ERR, "pgmSourcePerformanceTable_handler: unsupported mode.\n");
		break;

	}

	return SNMP_ERR_NOERROR;
}

/*
 * pgmReceiverTable
 */

static
int
initialize_table_pgmReceiverTable(void)
{
	pgm_debug ("initialize_table_pgmReceiverTable ()");

	static const oid pgmReceiverTable_oid[] = {1,3,6,1,3,112,1,3,100,2};
	netsnmp_table_registration_info* table_info = NULL;
	netsnmp_iterator_info* iinfo = NULL;
	netsnmp_handler_registration* reg = NULL;

	reg = netsnmp_create_handler_registration ("pgmReceiverTable",		pgmReceiverTable_handler,
						   pgmReceiverTable_oid,	OID_LENGTH( pgmReceiverTable_oid ),
						   HANDLER_CAN_RONLY);
	if (NULL == reg)
		goto error;

	table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
	if (NULL == table_info)
		goto error;

	table_info->min_column = COLUMN_PGMRECEIVERGROUPADDRESS;
	table_info->max_column = COLUMN_PGMRECEIVERUNIQUEINSTANCE;

	netsnmp_table_helper_add_indexes (table_info,
					  ASN_OCTET_STR,  /* index: pgmReceiverGlobalId */
					  ASN_UNSIGNED,  /* index: pgmReceiverSourcePort */
					  ASN_UNSIGNED,  /* index: pgmReceiverInstance */
					  0);

	iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
	if (NULL == iinfo)
		goto error;

	iinfo->get_first_data_point 	= pgmReceiverTable_get_first_data_point;
	iinfo->get_next_data_point  	= pgmReceiverTable_get_next_data_point;
	iinfo->free_loop_context_at_end = pgmReceiverTable_free_loop_context;
	iinfo->table_reginfo        	= table_info;

	return netsnmp_register_table_iterator (reg, iinfo);

error:
	if (table_info && table_info->indexes)		/* table_data_free_func() is internal */
		snmp_free_var (table_info->indexes);
	SNMP_FREE( table_info );
	SNMP_FREE( iinfo );
	netsnmp_handler_registration_free (reg);

	return -1;
}

/* called for first row of data in SNMP table
 *
 * goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
 * optionally returns my_data_context.
 *
 * returns answer or NULL
 */

static
netsnmp_variable_list*
pgmReceiverTable_get_first_data_point (
	void**			my_loop_context,	/* valid through one query of multiple "data points" */
	void**			my_data_context,	/* answer blob which is passed to handler() */
	netsnmp_variable_list*	put_index_data,		/* answer */
	netsnmp_iterator_info*	mydata			/* iinfo on init() */
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_rwlock_reader_lock (&pgm_sock_list_lock);

	if (NULL == pgm_sock_list) {
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

/* create our own context for this SNMP loop */
	pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);

/* hunt to find first node, through all socks */
	for (context->list = pgm_sock_list;
	     context->list;
	     context->list = context->list->next)
	{
/* and through all peers for each sock */
		pgm_sock_t* sock = (pgm_sock_t*)context->list->data;
		pgm_rwlock_reader_lock (&sock->peers_lock);
		context->node = sock->peers_list;
		if (context->node) {
/* maintain this sock's peers lock */
			break;
		}

		pgm_rwlock_reader_unlock (&sock->peers_lock);
	}

/* no node found */
	if (NULL == context->node) {
		pgm_free (context);
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

	*my_loop_context = context; 
	*my_data_context = &context->data_context;

/* pass on for generic row access */
	return pgmReceiverTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
}

static
netsnmp_variable_list*
pgmReceiverTable_get_next_data_point (
	void**			my_loop_context,
	void**			my_data_context,
	netsnmp_variable_list*	put_index_data,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
	pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)*my_data_context;
	netsnmp_variable_list *idx = put_index_data;

	if (NULL == context->list)
		return NULL;

	pgm_sock_t* sock = context->list->data;
	data_context->sock = sock;

	if (NULL == context->node)
		return NULL;

	pgm_peer_t* peer = context->node->data;
	data_context->peer = peer;

/* pgmReceiverGlobalId */
	char gsi[ PGM_GSISTRLEN ];
	pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi));
	snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
	idx = idx->next_variable;

/* pgmReceiverSourcePort */
	const unsigned sport = ntohs (peer->tsi.sport);
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
	idx = idx->next_variable;

/* pgmReceiverInstance */
	const unsigned instance = context->instance++;
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&instance, sizeof(instance));

/* hunt for next valid node */
	if (context->node->next) {
		context->node = context->node->next;
	}
	else
	{
		context->node = NULL;
		while (context->list->next) {
			pgm_rwlock_reader_unlock (&sock->peers_lock);
			context->list = context->list->next;
			sock = context->list->data;
			pgm_rwlock_reader_lock (&sock->peers_lock);
			context->node = sock->peers_list;
			if (context->node) {
/* keep lock */
				break;
			}
		}
	}

	return put_index_data;
}

static
void
pgmReceiverTable_free_loop_context (
	void*			my_loop_context,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverTable_free_loop_context (my_loop_context:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;

/* check for intra-peer state */
	if (context->list) {
		pgm_sock_t* sock = context->list->data;
		pgm_rwlock_reader_unlock (&sock->peers_lock);
	}

	pgm_free (context);
	my_loop_context = NULL;

	pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
}

static
int
pgmReceiverTable_handler (
	netsnmp_mib_handler*		handler,
	netsnmp_handler_registration*	reginfo,
	netsnmp_agent_request_info*	reqinfo,
	netsnmp_request_info*		requests
	)
{
/* pre-conditions */
        pgm_assert (NULL != handler);
        pgm_assert (NULL != reginfo);
        pgm_assert (NULL != reqinfo);
        pgm_assert (NULL != requests);

        pgm_debug ("pgmReceiverTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
                (const void*)handler,
		(const void*)reginfo,
		(const void*)reqinfo,
		(const void*)requests);

	switch (reqinfo->mode) {

/* Read-support (also covers GetNext requests) */

	case MODE_GET:
		for (netsnmp_request_info* request = requests;
		     request;
		     request = request->next)
		{
			const pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)netsnmp_extract_iterator_context (request);
			if (!data_context) {
				netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
				continue;
			}

			const pgm_sock_t* sock = data_context->sock;
			const pgm_peer_t* peer = data_context->peer;

			netsnmp_variable_list *var = request->requestvb;
			netsnmp_table_request_info* table_info = netsnmp_extract_table_info(request);

			if (table_info == NULL) {
				snmp_log (LOG_ERR, "pgmReceiverTable_handler: empty table request info.\n");
				continue;
			}

			switch (table_info->colnum) {

			case COLUMN_PGMRECEIVERGROUPADDRESS:
				{
					struct sockaddr_in s4;
					if (AF_INET == peer->group_nla.ss_family)
						memcpy (&s4, &peer->group_nla, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

/* by definition same as sock */
			case COLUMN_PGMRECEIVERDESTPORT:
				{
					const unsigned dport = ntohs (sock->dport);
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&dport, sizeof(dport) );
				}
				break;

			case COLUMN_PGMRECEIVERSOURCEADDRESS:
				{
					struct sockaddr_in s4;
					if (AF_INET == peer->nla.ss_family)
						memcpy (&s4, &peer->nla, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

			case COLUMN_PGMRECEIVERLASTHOP:
				{
					struct sockaddr_in s4;
					if (AF_INET == peer->local_nla.ss_family)
						memcpy (&s4, &peer->local_nla, sizeof(s4));
					else
						memset (&s4, 0, sizeof(s4));
					snmp_set_var_typed_value (var, ASN_IPADDRESS,
								  (const u_char*)&s4.sin_addr.s_addr,
								  sizeof(struct in_addr) );
				}
				break;

/* copy index[0] */
			case COLUMN_PGMRECEIVERSOURCEGSI:
				snmp_set_var_typed_value (var, ASN_OCTET_STR,
							  (const u_char*)table_info->indexes->val.string,
							  table_info->indexes->val_len);
				break;

/* copy index[1] */
			case COLUMN_PGMRECEIVERSOURCEPORTNUMBER:
				snmp_set_var_typed_value (var, ASN_UNSIGNED,
							  (const u_char*)table_info->indexes->next_variable->val.integer,
							  table_info->indexes->next_variable->val_len);
				break;

/* copy index[2] */
			case COLUMN_PGMRECEIVERUNIQUEINSTANCE:
				snmp_set_var_typed_value (var, ASN_UNSIGNED,
							  (const u_char*)table_info->indexes->next_variable->next_variable->val.integer,
							  table_info->indexes->next_variable->next_variable->val_len);
				break;

			default:
				snmp_log (LOG_ERR, "pgmReceiverTable_handler: unknown column.\n");
				break;
			}
		}
		break;

	case MODE_SET_RESERVE1:
	default:
		snmp_log (LOG_ERR, "pgmReceiverTable_handler: unsupported mode.\n");
		break;

	}

	return SNMP_ERR_NOERROR;
}

/*
 * pgmReceiverConfigTable
 *
 */

static
int
initialize_table_pgmReceiverConfigTable(void)
{
	pgm_debug ("initialize_table_pgmReceiverConfigTable ()");

	static const oid pgmReceiverConfigTable_oid[] = {1,3,6,1,3,112,1,3,100,3};
	netsnmp_table_registration_info* table_info = NULL;
	netsnmp_iterator_info* iinfo = NULL;
	netsnmp_handler_registration* reg = NULL;

	reg = netsnmp_create_handler_registration ("pgmReceiverConfigTable",	pgmReceiverConfigTable_handler,
						   pgmReceiverConfigTable_oid,	OID_LENGTH(pgmReceiverConfigTable_oid),
						   HANDLER_CAN_RONLY);
	if (NULL == reg)
		goto error;

	table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
	if (NULL == table_info)
		goto error;

	table_info->min_column = COLUMN_PGMRECEIVERNAKBACKOFFIVL;
	table_info->max_column = COLUMN_PGMRECEIVERNAKFAILURETHRESHOLD;

	netsnmp_table_helper_add_indexes (table_info,
					  ASN_OCTET_STR, /* index: pgmReceiverConfigGlobalId */
					  ASN_UNSIGNED,  /* index: pgmReceiverConfigSourcePort */
					  ASN_UNSIGNED,  /* index: pgmReceiverInstance */
					  0);

	iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
	if (NULL == iinfo)
		goto error;

	iinfo->get_first_data_point 	= pgmReceiverConfigTable_get_first_data_point;
	iinfo->get_next_data_point  	= pgmReceiverConfigTable_get_next_data_point;
	iinfo->free_loop_context_at_end = pgmReceiverConfigTable_free_loop_context;
	iinfo->table_reginfo        	= table_info;

	return netsnmp_register_table_iterator (reg, iinfo);

error:
	if (table_info && table_info->indexes)		/* table_data_free_func() is internal */
		snmp_free_var (table_info->indexes);
	SNMP_FREE( table_info );
	SNMP_FREE( iinfo );
	netsnmp_handler_registration_free (reg);

	return -1;
}

/* called for first row of data in SNMP table
 *
 * goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
 * optionally returns my_data_context.
 *
 * returns answer or NULL
 */

static
netsnmp_variable_list*
pgmReceiverConfigTable_get_first_data_point(
	void**			my_loop_context,	/* valid through one query of multiple "data points" */
	void**			my_data_context,	/* answer blob which is passed to handler() */
	netsnmp_variable_list*	put_index_data,		/* answer */
	netsnmp_iterator_info*	mydata			/* iinfo on init() */
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverConfigTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_rwlock_reader_lock (&pgm_sock_list_lock);

	if (NULL == pgm_sock_list) {
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

/* create our own context for this SNMP loop */
	pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);

/* hunt to find first node, through all socks */
	for (context->list = pgm_sock_list;
	     context->list;
	     context->list = context->list->next)
	{
/* and through all peers for each sock */
		pgm_sock_t* sock = (pgm_sock_t*)context->list->data;
		pgm_rwlock_reader_lock (&sock->peers_lock);
		context->node = sock->peers_list;
		if (context->node)
			break;

		pgm_rwlock_reader_unlock (&sock->peers_lock);
	}

/* no node found */
	if (NULL == context->node) {
		pgm_free (context);
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

	*my_loop_context = context; 
	*my_data_context = NULL;

/* pass on for generic row access */
	return pgmReceiverConfigTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
}

static
netsnmp_variable_list*
pgmReceiverConfigTable_get_next_data_point(
	void**			my_loop_context,
	void**			my_data_context,
	netsnmp_variable_list*	put_index_data,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverConfigTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
	netsnmp_variable_list *idx = put_index_data;

	if (NULL == context->list)
		return NULL;

	pgm_sock_t* sock = context->list->data;
	*my_data_context = sock;

	if (NULL == context->node)
		return NULL;

	pgm_peer_t* peer = context->node->data;

/* pgmReceiverGlobalId */
	char gsi[ PGM_GSISTRLEN ];
	pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi));
	snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
	idx = idx->next_variable;

/* pgmReceiverSourcePort */
	const unsigned sport = ntohs (peer->tsi.sport);
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
	idx = idx->next_variable;

/* pgmReceiverInstance */
	const unsigned instance = context->instance++;
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&instance, sizeof(instance));

/* hunt for next valid node */
	if (context->node->next) {
		context->node = context->node->next;
	}
	else
	{
		context->node = NULL;
		while (context->list->next) {
			pgm_rwlock_reader_unlock (&sock->peers_lock);
			context->list = context->list->next;
			sock = context->list->data;
			pgm_rwlock_reader_lock (&sock->peers_lock);
			context->node = sock->peers_list;
			if (context->node) {
/* keep lock */
				break;
			}
		}
	}

	return put_index_data;
}

static
void
pgmReceiverConfigTable_free_loop_context (
	void*			my_loop_context,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverConfigTable_free_loop_context (my_loop_context:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;

/* check for intra-peer state */
	if (context->list) {
		pgm_sock_t* sock = context->list->data;
		pgm_rwlock_reader_unlock (&sock->peers_lock);
	}

	pgm_free (context);
	my_loop_context = NULL;

	pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
}

static
int
pgmReceiverConfigTable_handler (
	netsnmp_mib_handler*		handler,
	netsnmp_handler_registration*	reginfo,
	netsnmp_agent_request_info*	reqinfo,
	netsnmp_request_info*		requests
	)
{
/* pre-conditions */
        pgm_assert (NULL != handler);
        pgm_assert (NULL != reginfo);
        pgm_assert (NULL != reqinfo);
        pgm_assert (NULL != requests);

        pgm_debug ("pgmReceiverConfigTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
                (const void*)handler,
		(const void*)reginfo,
		(const void*)reqinfo,
		(const void*)requests);

	switch (reqinfo->mode) {

/* Read-support (also covers GetNext requests) */

	case MODE_GET:
		for (netsnmp_request_info* request = requests;
		     request;
		     request = request->next)
		{
			const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context(request);
			if (NULL == sock) {
				netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
				continue;
			}

			netsnmp_variable_list *var = request->requestvb;
			netsnmp_table_request_info* table_info = netsnmp_extract_table_info(request);

			if (NULL == table_info) {
				snmp_log (LOG_ERR, "pgmReceiverTable_handler: empty table request info.\n");
				continue;
			}

			switch (table_info->colnum) {

/* nak_bo_ivl from sock */
			case COLUMN_PGMRECEIVERNAKBACKOFFIVL:
				{
					const unsigned nak_bo_ivl = sock->nak_bo_ivl;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_bo_ivl, sizeof(nak_bo_ivl) );
				}
				break;

/* nak_rpt_ivl from sock */
			case COLUMN_PGMRECEIVERNAKREPEATIVL:
				{
					const unsigned nak_rpt_ivl = sock->nak_rpt_ivl;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_rpt_ivl, sizeof(nak_rpt_ivl) );
				}
				break;

/* nak_ncf_retries from sock */
			case COLUMN_PGMRECEIVERNAKNCFRETRIES:
				{
					const unsigned nak_ncf_retries = sock->nak_ncf_retries;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_ncf_retries, sizeof(nak_ncf_retries) );
				}
				break;

/* nak_rdata_ivl from sock */
			case COLUMN_PGMRECEIVERNAKRDATAIVL:
				{
					const unsigned nak_rdata_ivl = sock->nak_rdata_ivl;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_rdata_ivl, sizeof(nak_rdata_ivl) );
				}
				break;

/* nak_data_retries from sock */
			case COLUMN_PGMRECEIVERNAKDATARETRIES:
				{
					const unsigned nak_data_retries = sock->nak_data_retries;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_data_retries, sizeof(nak_data_retries) );
				}
				break;

/* FIXED: pgmReceiverSendNaks = enabled(1) */
			case COLUMN_PGMRECEIVERSENDNAKS:
				{
					const unsigned send_naks = PGMRECEIVERSENDNAKS_ENABLED;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&send_naks, sizeof(send_naks) );
				}
				break;

/* FIXED: pgmReceiverLateJoin = disabled(2) */
			case COLUMN_PGMRECEIVERLATEJOIN:
				{
					const unsigned late_join = PGMRECEIVERLATEJOIN_DISABLED;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&late_join, sizeof(late_join) );
				}
				break;

/* FIXED: 1 for multicast */
			case COLUMN_PGMRECEIVERNAKTTL:
				{
					const unsigned nak_hops = 1;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&nak_hops, sizeof(nak_hops) );
				}
				break;

/* FIXED: pgmReceiverDeliveryOrder = ordered(2) */
			case COLUMN_PGMRECEIVERDELIVERYORDER:
				{
					const unsigned delivery_order = PGMRECEIVERDELIVERYORDER_ORDERED;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&delivery_order, sizeof(delivery_order) );
				}
				break;

/* FIXED: pgmReceiverMcastNaks = disabled(2) */
			case COLUMN_PGMRECEIVERMCASTNAKS:
				{
					const unsigned mcast_naks = PGMRECEIVERMCASTNAKS_DISABLED;
					snmp_set_var_typed_value (var, ASN_INTEGER,
								  (const u_char*)&mcast_naks, sizeof(mcast_naks) );
				}
				break;

/* TODO: traps */
			case COLUMN_PGMRECEIVERNAKFAILURETHRESHOLDTIMER:
			case COLUMN_PGMRECEIVERNAKFAILURETHRESHOLD:
				{
					const unsigned threshold = 0;
					snmp_set_var_typed_value (var, ASN_UNSIGNED,
								  (const u_char*)&threshold, sizeof(threshold) );
				}
				break;

			default:
				snmp_log (LOG_ERR, "pgmReceiverTable_handler: unknown column.\n");
				break;
			}
		}
		break;

	case MODE_SET_RESERVE1:
	default:
		snmp_log (LOG_ERR, "pgmReceiverTable_handler: unsupported mode.\n");
		break;

	}

	return SNMP_ERR_NOERROR;
}

/*
 * pgmReceiverPerformanceTable
 */

static
int
initialize_table_pgmReceiverPerformanceTable (void)
{
	pgm_debug ("initialize_table_pgmReceiverPerformanceTable ()");

	static const oid pgmReceiverPerformanceTable_oid[] = {1,3,6,1,3,112,1,3,100,4};
	netsnmp_table_registration_info* table_info = NULL;
	netsnmp_iterator_info* iinfo = NULL;
	netsnmp_handler_registration* reg = NULL;

	reg = netsnmp_create_handler_registration ("pgmReceiverPerformanceTable",	pgmReceiverPerformanceTable_handler,
						   pgmReceiverPerformanceTable_oid,	OID_LENGTH( pgmReceiverPerformanceTable_oid ),
						   HANDLER_CAN_RONLY);
	if (NULL == reg)
		goto error;

	table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
	if (NULL == table_info)
		goto error;

	table_info->min_column = COLUMN_PGMRECEIVERDATABYTESRECEIVED;
	table_info->max_column = COLUMN_PGMRECEIVERLASTINTERVALNAKFAILURES;

	netsnmp_table_helper_add_indexes (table_info,
					  ASN_OCTET_STR,  /* index: pgmReceiverGlobalId */
					  ASN_UNSIGNED,  /* index: pgmReceiverSourcePort */
					  ASN_UNSIGNED,  /* index: pgmReceiverInstance */
					  0);

	iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
	if (NULL == iinfo)
		goto error;

	iinfo->get_first_data_point 	= pgmReceiverPerformanceTable_get_first_data_point;
	iinfo->get_next_data_point  	= pgmReceiverPerformanceTable_get_next_data_point;
	iinfo->free_loop_context_at_end = pgmReceiverPerformanceTable_free_loop_context;
	iinfo->table_reginfo        	= table_info;

	return netsnmp_register_table_iterator (reg, iinfo);

error:
	if (table_info && table_info->indexes)		/* table_data_free_func() is internal */
		snmp_free_var (table_info->indexes);
	SNMP_FREE( table_info );
	SNMP_FREE( iinfo );
	netsnmp_handler_registration_free (reg);

	return -1;
}

/* called for first row of data in SNMP table
 *
 * goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
 * optionally returns my_data_context.
 *
 * returns answer or NULL
 */

static
netsnmp_variable_list*
pgmReceiverPerformanceTable_get_first_data_point (
	void**			my_loop_context,	/* valid through one query of multiple "data points" */
	void**			my_data_context,	/* answer blob which is passed to handler() */
	netsnmp_variable_list*	put_index_data,		/* answer */
	netsnmp_iterator_info*	mydata			/* iinfo on init() */
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverPerformanceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_rwlock_reader_lock (&pgm_sock_list_lock);

	if (NULL == pgm_sock_list) {
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

/* create our own context for this SNMP loop */
	pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);

/* hunt to find first node, through all socks */
	for (context->list = pgm_sock_list;
	     context->list;
	     context->list = context->list->next)
	{
/* and through all peers for each sock */
		pgm_sock_t* sock = (pgm_sock_t*)context->list->data;
		pgm_rwlock_reader_lock (&sock->peers_lock);
		context->node = sock->peers_list;
		if (context->node)
			break;

		pgm_rwlock_reader_unlock (&sock->peers_lock);
	}

/* no node found */
	if (NULL == context->node) {
		pgm_free (context);
		pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
		return NULL;
	}

	*my_loop_context = context; 
	*my_data_context = &context->data_context;

/* pass on for generic row access */
	return pgmReceiverPerformanceTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
}

static
netsnmp_variable_list*
pgmReceiverPerformanceTable_get_next_data_point (
	void**			my_loop_context,
	void**			my_data_context,
	netsnmp_variable_list*	put_index_data,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
        pgm_assert (NULL != my_data_context);
        pgm_assert (NULL != put_index_data);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverPerformanceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)my_data_context,
		(const void*)put_index_data,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
	pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)*my_data_context;
	netsnmp_variable_list *idx = put_index_data;

	if (NULL == context->list)
		return NULL;

	pgm_sock_t* sock = context->list->data;
	data_context->sock = sock;

	if (NULL == context->node)
		return NULL;

	pgm_peer_t* peer = context->node->data;
	data_context->peer = peer;

/* pgmReceiverGlobalId */
	char gsi[ PGM_GSISTRLEN ];
	pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi));
	snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
	idx = idx->next_variable;

/* pgmReceiverSourcePort */
	const unsigned sport = ntohs (peer->tsi.sport);
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
	idx = idx->next_variable;

/* pgmReceiverInstance */
	const unsigned instance = context->instance++;
	snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&instance, sizeof(instance));

/* hunt for next valid node */
	if (context->node->next) {
		context->node = context->node->next;
	}
	else
	{
		context->node = NULL;
		while (context->list->next) {
			pgm_rwlock_reader_unlock (&sock->peers_lock);
			context->list = context->list->next;
			sock = context->list->data;
			pgm_rwlock_reader_lock (&sock->peers_lock);
			context->node = sock->peers_list;

			if (context->node)
				break;
		}
	}

	return put_index_data;
}

static
void
pgmReceiverPerformanceTable_free_loop_context (
	void*			my_loop_context,
	netsnmp_iterator_info*	mydata
	)
{
/* pre-conditions */
        pgm_assert (NULL != my_loop_context);
	pgm_assert (NULL != mydata);

        pgm_debug ("pgmReceiverPerformanceTable_free_loop_context (my_loop_context:%p mydata:%p)",
                (const void*)my_loop_context,
		(const void*)mydata);

	pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;

/* check for intra-peer state */
	if (context->list) {
		pgm_sock_t* sock = context->list->data;
		pgm_rwlock_reader_unlock (&sock->peers_lock);
	}

	pgm_free (context);
	my_loop_context = NULL;

	pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
}

static
int
pgmReceiverPerformanceTable_handler (
	netsnmp_mib_handler*		handler,
	netsnmp_handler_registration*	reginfo,
	netsnmp_agent_request_info*	reqinfo,
	netsnmp_request_info*		requests
	)
{
/* pre-conditions */
        pgm_assert (NULL != handler);
        pgm_assert (NULL != reginfo);
        pgm_assert (NULL != reqinfo);
        pgm_assert (NULL != requests);

        pgm_debug ("pgmReceiverPerformanceTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
                (const void*)handler,
		(const void*)reginfo,
		(const void*)reqinfo,
		(const void*)requests);

	switch (reqinfo->mode) {

/* Read-support (also covers GetNext requests) */

	case MODE_GET:
		for (netsnmp_request_info* request = requests;
		     request;
		     request = request->next)
		{
			const pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)netsnmp_extract_iterator_context (request);
			if (NULL == data_context) {
				netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
				continue;
			}

			const pgm_sock_t* sock = data_context->sock;
			const pgm_peer_t* peer = data_context->peer;
			const pgm_rxw_t* window = peer->window;

			netsnmp_variable_list *var = request->requestvb;
			netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);

			if (NULL == table_info) {
				snmp_log (LOG_ERR, "pgmReceiverTable_handler: empty table request info.\n");
				continue;
			}

			switch (table_info->colnum) {

			case COLUMN_PGMRECEIVERDATABYTESRECEIVED:
				{
					const unsigned data_bytes = peer->cumulative_stats[PGM_PC_RECEIVER_DATA_BYTES_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&data_bytes, sizeof(data_bytes) );
				}
				break;
		
			case COLUMN_PGMRECEIVERDATAMSGSRECEIVED:
				{
					const unsigned data_msgs = peer->cumulative_stats[PGM_PC_RECEIVER_DATA_MSGS_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&data_msgs, sizeof(data_msgs) );
				}
				break;

/* total */
			case COLUMN_PGMRECEIVERNAKSSENT:
				{
					const unsigned naks_sent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_sent, sizeof(naks_sent) );
				}
				break;
	
/* total */	
			case COLUMN_PGMRECEIVERNAKSRETRANSMITTED:
				{
					const unsigned naks_resent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_RETRANSMITTED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_resent, sizeof(naks_resent) );
				}
				break;
	
/* total */	
			case COLUMN_PGMRECEIVERNAKFAILURES:
				{
					const unsigned nak_failures = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&nak_failures, sizeof(nak_failures) );
				}
				break;
		
			case COLUMN_PGMRECEIVERBYTESRECEIVED:
				{
					const unsigned bytes_received = peer->cumulative_stats[PGM_PC_RECEIVER_BYTES_RECEIVED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&bytes_received, sizeof(bytes_received) );
				}
				break;
	
/* total */	
			case COLUMN_PGMRECEIVERNAKSSUPPRESSED:
				{
					const unsigned naks_suppressed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_suppressed, sizeof(naks_suppressed) );
				}
				break;
	
/* bogus: same as source checksum errors */	
			case COLUMN_PGMRECEIVERCKSUMERRORS:
				{
					const unsigned cksum_errors = sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&cksum_errors, sizeof(cksum_errors) );
				}
				break;
		
			case COLUMN_PGMRECEIVERMALFORMEDSPMS:
				{
					const unsigned malformed_spms = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_spms, sizeof(malformed_spms) );
				}
				break;
		
			case COLUMN_PGMRECEIVERMALFORMEDODATA:
				{
					const unsigned malformed_odata = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_ODATA];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_odata, sizeof(malformed_odata) );
				}
				break;
		
			case COLUMN_PGMRECEIVERMALFORMEDRDATA:
				{
					const unsigned malformed_rdata = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_RDATA];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_rdata, sizeof(malformed_rdata) );
				}
				break;
		
			case COLUMN_PGMRECEIVERMALFORMEDNCFS:
				{
					const unsigned malformed_ncfs = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_ncfs, sizeof(malformed_ncfs) );
				}
				break;
		
			case COLUMN_PGMRECEIVERPACKETSDISCARDED:
				{
					const unsigned packets_discarded = peer->cumulative_stats[PGM_PC_RECEIVER_PACKETS_DISCARDED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&packets_discarded, sizeof(packets_discarded) );
				}
				break;
		
			case COLUMN_PGMRECEIVERLOSSES:
				{
					const unsigned losses = window->cumulative_losses;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&losses, sizeof(losses) );
				}
				break;
		
			case COLUMN_PGMRECEIVERBYTESDELIVEREDTOAPP:
				{
					const unsigned bytes_delivered = window->bytes_delivered;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&bytes_delivered, sizeof(bytes_delivered) );
				}
				break;
		
			case COLUMN_PGMRECEIVERMSGSDELIVEREDTOAPP:
				{
					const unsigned msgs_delivered = window->msgs_delivered;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&msgs_delivered, sizeof(msgs_delivered) );
				}
				break;
		
			case COLUMN_PGMRECEIVERDUPSPMS:
				{
					const unsigned dup_spms = peer->cumulative_stats[PGM_PC_RECEIVER_DUP_SPMS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&dup_spms, sizeof(dup_spms) );
				}
				break;
		
			case COLUMN_PGMRECEIVERDUPDATAS:
				{
					const unsigned dup_data = peer->cumulative_stats[PGM_PC_RECEIVER_DUP_DATAS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&dup_data, sizeof(dup_data) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVERDUPPARITIES:
				{
					const unsigned dup_parity = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&dup_parity, sizeof(dup_parity) );
				}
				break;
	
/* COLUMN_PGMRECEIVERPARITYNAKPACKETSSENT + COLUMN_PGMRECEIVERSELECTIVENAKPACKETSSENT */	
			case COLUMN_PGMRECEIVERNAKPACKETSSENT:
				{
					const unsigned nak_packets = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&nak_packets, sizeof(nak_packets) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVERPARITYNAKPACKETSSENT:
				{
					const unsigned parity_naks = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_naks, sizeof(parity_naks) );
				}
				break;
		
			case COLUMN_PGMRECEIVERSELECTIVENAKPACKETSSENT:
				{
					const unsigned nak_packets = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&nak_packets, sizeof(nak_packets) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVERPARITYNAKSSENT:
				{
					const unsigned parity_naks = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_naks, sizeof(parity_naks) );
				}
				break;
		
			case COLUMN_PGMRECEIVERSELECTIVENAKSSENT:
				{
					const unsigned naks_sent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_sent, sizeof(naks_sent) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVERPARITYNAKSRETRANSMITTED:
				{
					const unsigned parity_resent = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_resent, sizeof(parity_resent) );
				}
				break;
		
			case COLUMN_PGMRECEIVERSELECTIVENAKSRETRANSMITTED:
				{
					const unsigned naks_resent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_RETRANSMITTED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_resent, sizeof(naks_resent) );
				}
				break;
	
/* COLUMN_PGMRECEIVERPARITYNAKSFAILED + COLUMN_PGMRECEIVERSELECTIVENAKSFAILED */	
			case COLUMN_PGMRECEIVERNAKSFAILED:
				{
					const unsigned naks_failed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_failed, sizeof(naks_failed) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVERPARITYNAKSFAILED:
				{
					const unsigned parity_failed = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&parity_failed, sizeof(parity_failed) );
				}
				break;
		
			case COLUMN_PGMRECEIVERSELECTIVENAKSFAILED:
				{
					const unsigned naks_failed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&naks_failed, sizeof(naks_failed) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKSFAILEDRXWADVANCED:
				{
					const unsigned rxw_failed = peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_RXW_ADVANCED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&rxw_failed, sizeof(rxw_failed) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKSFALEDNCFRETRIESEXCEEDED:
				{
					const unsigned ncf_retries = peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_NCF_RETRIES_EXCEEDED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&ncf_retries, sizeof(ncf_retries) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKSFAILEDDATARETRIESEXCEEDED:
				{
					const unsigned data_retries = peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_DATA_RETRIES_EXCEEDED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&data_retries, sizeof(data_retries) );
				}
				break;
	
/* FIXED: 0 - absolutely no idea what this means */	
			case COLUMN_PGMRECEIVERNAKSFAILEDGENEXPIRED:
				{
					const unsigned happy_pandas = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&happy_pandas, sizeof(happy_pandas) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKFAILURESDELIVERED:
				{
					const unsigned delivered = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAILURES_DELIVERED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&delivered, sizeof(delivered) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVERPARITYNAKSSUPPRESSED:
				{
					const unsigned suppressed = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&suppressed, sizeof(suppressed) );
				}
				break;
		
			case COLUMN_PGMRECEIVERSELECTIVENAKSSUPPRESSED:
				{
					const unsigned suppressed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&suppressed, sizeof(suppressed) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKERRORS:
				{
					const unsigned malformed_naks = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_ERRORS];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&malformed_naks, sizeof(malformed_naks) );
				}
				break;
	
/* FIXED: 0 */	
			case COLUMN_PGMRECEIVEROUTSTANDINGPARITYNAKS:
				{
					const unsigned outstanding_parity = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&outstanding_parity, sizeof(outstanding_parity) );
				}
				break;
		
			case COLUMN_PGMRECEIVEROUTSTANDINGSELECTIVENAKS:
				{
					const unsigned outstanding_selective = window->nak_backoff_queue.length +
										window->wait_ncf_queue.length +
										window->wait_data_queue.length;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&outstanding_selective, sizeof(outstanding_selective) );
				}
				break;
		
			case COLUMN_PGMRECEIVERLASTACTIVITY:
				{
					union {
						unsigned	uint_value;
						time_t  	time_t_value;
					} last_activity;
					pgm_time_since_epoch (&peer->last_packet, &last_activity.time_t_value);
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&last_activity.uint_value, sizeof(last_activity.uint_value) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKSVCTIMEMIN:
				{
					const unsigned min_repair_time = window->min_fill_time;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&min_repair_time, sizeof(min_repair_time) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKSVCTIMEMEAN:
				{
					const unsigned mean_repair_time = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_SVC_TIME_MEAN];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&mean_repair_time, sizeof(mean_repair_time) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKSVCTIMEMAX:
				{
					const unsigned max_repair_time = window->max_fill_time;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&max_repair_time, sizeof(max_repair_time) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKFAILTIMEMIN:
				{
					const unsigned min_fail_time = peer->min_fail_time;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&min_fail_time, sizeof(min_fail_time) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKFAILTIMEMEAN:
				{
					const unsigned mean_fail_time = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAIL_TIME_MEAN];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&mean_fail_time, sizeof(mean_fail_time) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKFAILTIMEMAX:
				{
					const unsigned max_fail_time = peer->max_fail_time;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&max_fail_time, sizeof(max_fail_time) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKTRANSMITMIN:
				{
					const unsigned min_transmit_count = window->min_nak_transmit_count;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&min_transmit_count, sizeof(min_transmit_count) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKTRANSMITMEAN:
				{
					const unsigned mean_transmit_count = peer->cumulative_stats[PGM_PC_RECEIVER_TRANSMIT_MEAN];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&mean_transmit_count, sizeof(mean_transmit_count) );
				}
				break;
		
			case COLUMN_PGMRECEIVERNAKTRANSMITMAX:
				{
					const unsigned max_transmit_count = window->max_nak_transmit_count;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&max_transmit_count, sizeof(max_transmit_count) );
				}
				break;
	
			case COLUMN_PGMRECEIVERACKSSENT:
				{
					const unsigned acks_sent = peer->cumulative_stats[PGM_PC_RECEIVER_ACKS_SENT];
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&acks_sent, sizeof(acks_sent) );
				}
				break;
		
			case COLUMN_PGMRECEIVERRXWTRAIL:
				{
					const unsigned rxw_trail = window->rxw_trail;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&rxw_trail, sizeof(rxw_trail) );
				}
				break;
		
			case COLUMN_PGMRECEIVERRXWLEAD:
				{
					const unsigned rxw_lead = window->lead;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&rxw_lead, sizeof(rxw_lead) );
				}
				break;
	
/* TODO: traps */	
			case COLUMN_PGMRECEIVERNAKFAILURESLASTINTERVAL:
			case COLUMN_PGMRECEIVERLASTINTERVALNAKFAILURES:
				{
					const unsigned failures = 0;
					snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
								  (const u_char*)&failures, sizeof(failures) );
				}
				break;

			default:
				snmp_log (LOG_ERR, "pgmReceiverTable_handler: unknown column.\n");
				break;
			}
		}
		break;

	case MODE_SET_RESERVE1:
	default:
		snmp_log (LOG_ERR, "pgmReceiverTable_handler: unsupported mode.\n");
		break;

	}

	return SNMP_ERR_NOERROR;
}

/*
 * SNMP TRAPS
 */

PGM_GNUC_INTERNAL
int
send_pgmStart_trap (void)
{
	pgm_debug ("send_pgmStart_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmStart_oid[] = { 1,3,6,1,3,112,2,0,1 };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH( snmptrap_oid ),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmStart_oid, sizeof(pgmStart_oid));
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmStop_trap (void)
{
	pgm_debug ("send_pgmStop_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmStop_oid[] = { 1,3,6,1,3,112,2,0,2 };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmStop_oid, sizeof(pgmStop_oid));
    

/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmNewSourceTrap_trap (void)
{
	pgm_debug ("send_pgmNewSourceTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmNewSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,3 };
	static const oid pgmSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,6, /* insert index here */ };
	static const oid pgmSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,7, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmNewSourceTrap_oid, sizeof(pgmNewSourceTrap_oid));
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmSourceSourceGsi_oid, OID_LENGTH(pgmSourceSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmSourceSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmSourceSourcePortNumber_oid, OID_LENGTH(pgmSourceSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmSourceSourcePortNumber */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmClosedSourceTrap_trap (void)
{
	pgm_debug ("send_pgmClosedSourceTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmClosedSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,4 };
	static const oid pgmSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,6, /* insert index here */ };
	static const oid pgmSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,7, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmClosedSourceTrap_oid, sizeof(pgmClosedSourceTrap_oid));
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmSourceSourceGsi_oid, OID_LENGTH(pgmSourceSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmSourceSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmSourceSourcePortNumber_oid, OID_LENGTH(pgmSourceSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmSourceSourcePortNumber */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmNewReceiverTrap_trap (void)
{
	pgm_debug ("send_pgmNewReceiverTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmNewReceiverTrap_oid[] = { 1,3,6,1,3,112,2,0,5 };
	static const oid pgmReceiverSourceGsi_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,8, /* insert index here */ };
	static const oid pgmReceiverSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,9, /* insert index here */ };
	static const oid pgmReceiverUniqueInstance_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,10, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmNewReceiverTrap_oid, sizeof(pgmNewReceiverTrap_oid));
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverSourceGsi_oid, OID_LENGTH(pgmReceiverSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmReceiverSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverSourcePortNumber_oid, OID_LENGTH(pgmReceiverSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverSourcePortNumber */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverUniqueInstance_oid, OID_LENGTH(pgmReceiverUniqueInstance_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverUniqueInstance */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmClosedReceiverTrap_trap (void)
{
	pgm_debug ("send_pgmClosedReceiverTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmClosedReceiverTrap_oid[] = { 1,3,6,1,3,112,2,0,6 };
	static const oid pgmReceiverSourceGsi_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,8, /* insert index here */ };
	static const oid pgmReceiverSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,9, /* insert index here */ };
	static const oid pgmReceiverUniqueInstance_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,10, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmClosedReceiverTrap_oid, sizeof(pgmClosedReceiverTrap_oid));
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverSourceGsi_oid, OID_LENGTH(pgmReceiverSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmReceiverSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverSourcePortNumber_oid, OID_LENGTH(pgmReceiverSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverSourcePortNumber */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverUniqueInstance_oid, OID_LENGTH(pgmReceiverUniqueInstance_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverUniqueInstance */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmNakFailuresTrap_trap (void)
{
	pgm_debug ("send_pgmNakFailuresTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmNakFailuresTrap_oid[] = { 1,3,6,1,3,112,2,0,7 };
	static const oid pgmReceiverSourceGsi_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,8, /* insert index here */ };
	static const oid pgmReceiverSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,9, /* insert index here */ };
	static const oid pgmReceiverUniqueInstance_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,10, /* insert index here */ };
	static const oid pgmReceiverNakFailureThresholdTimer_oid[] = { 1,3,6,1,3,112,1,3,100,3,1,14, /* insert index here */ };
	static const oid pgmReceiverNakFailureThreshold_oid[] = { 1,3,6,1,3,112,1,3,100,3,1,15, /* insert index here */ };
	static const oid pgmReceiverNakFailuresLastInterval_oid[] = { 1,3,6,1,3,112,1,3,100,4,1,56, /* insert index here */ };
	static const oid pgmReceiverLastIntervalNakFailures_oid[] = { 1,3,6,1,3,112,1,3,100,4,1,57, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmNakFailuresTrap_oid, sizeof(pgmNakFailuresTrap_oid));
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverSourceGsi_oid, OID_LENGTH(pgmReceiverSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmReceiverSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverSourcePortNumber_oid, OID_LENGTH(pgmReceiverSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverSourcePortNumber */
        NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverUniqueInstance_oid, OID_LENGTH(pgmReceiverUniqueInstance_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverUniqueInstance */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverNakFailureThresholdTimer_oid, OID_LENGTH(pgmReceiverNakFailureThresholdTimer_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverNakFailureThresholdTimer */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverNakFailureThreshold_oid, OID_LENGTH(pgmReceiverNakFailureThreshold_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmReceiverNakFailureThreshold */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverNakFailuresLastInterval_oid, OID_LENGTH(pgmReceiverNakFailuresLastInterval_oid),
				   ASN_COUNTER,
/* Set an appropriate value for pgmReceiverNakFailuresLastInterval */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmReceiverLastIntervalNakFailures_oid, OID_LENGTH(pgmReceiverLastIntervalNakFailures_oid),
				   ASN_COUNTER,
/* Set an appropriate value for pgmReceiverLastIntervalNakFailures */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmNewDlrSourceTrap_trap (void)
{
	pgm_debug ("send_pgmNewDlrSourceTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmNewDlrSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,8 };
	static const oid pgmDlrSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,4, /* insert index here */ };
	static const oid pgmDlrSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,5, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmNewDlrSourceTrap_oid, sizeof(pgmNewDlrSourceTrap_oid));
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmDlrSourceSourceGsi_oid, OID_LENGTH(pgmDlrSourceSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmDlrSourceSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmDlrSourceSourcePortNumber_oid, OID_LENGTH(pgmDlrSourceSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmDlrSourceSourcePortNumber */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

PGM_GNUC_INTERNAL
int
send_pgmClosedDlrSourceTrap_trap (void)
{
	pgm_debug ("send_pgmClosedDlrSourceTrap_trap ()");

	netsnmp_variable_list  *var_list = NULL;
	static const oid pgmClosedDlrSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,9 };
	static const oid pgmDlrSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,4, /* insert index here */ };
	static const oid pgmDlrSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,5, /* insert index here */ };

/*
 * Set the snmpTrapOid.0 value
 */
	snmp_varlist_add_variable (&var_list,
				   snmptrap_oid, OID_LENGTH(snmptrap_oid),
				   ASN_OBJECT_ID,
				   (const u_char*)pgmClosedDlrSourceTrap_oid, sizeof(pgmClosedDlrSourceTrap_oid));
    
/*
 * Add any objects from the trap definition
 */
	snmp_varlist_add_variable (&var_list,
				   pgmDlrSourceSourceGsi_oid, OID_LENGTH(pgmDlrSourceSourceGsi_oid),
				   ASN_OCTET_STR,
/* Set an appropriate value for pgmDlrSourceSourceGsi */
				   NULL, 0);
	snmp_varlist_add_variable (&var_list,
				   pgmDlrSourceSourcePortNumber_oid, OID_LENGTH(pgmDlrSourceSourcePortNumber_oid),
				   ASN_UNSIGNED,
/* Set an appropriate value for pgmDlrSourceSourcePortNumber */
				   NULL, 0);
/*
 * Add any extra (optional) objects here
 */

/*
 * Send the trap to the list of configured destinations
 *  and clean up
 */
	send_v2trap (var_list);
	snmp_free_varbind (var_list);
	return SNMP_ERR_NOERROR;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/inet_network.c0000644000175000017500000002121411640407354020417 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * portable implementations of inet_network and inet_network6.
 *
 * Copyright (c) 2006-2011 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 


//#define INET_NETWORK_DEBUG

/* locals */

static uint32_t cidr_to_netmask (const unsigned) PGM_GNUC_CONST;


/* calculate IPv4 netmask from network size, returns address in
 * host byte order.
 */

static
uint32_t
cidr_to_netmask (
	const unsigned	cidr
	)
{
	return (cidr == 0) ? 0 : (0xffffffff - (1 << (32 - cidr)) + 1);
}


/* Converts a numbers-and-dots notation string into a network number in
 * host order.
 * Note parameters and return value differs from inet_network().  This
 * function will not interpret octal numbers, preceeded with a 0, or
 * hexadecimal numbers, preceeded by 0x.
 *
 * 127		=> 127.0.0.0
 * 127.1/8	=> 127.0.0.0	-- 127.1.0.0
 *                                 inet_addr() would be 127.0.0.1
 *                                 inet_network() would be 0.0.127.1
 *
 * returns 0 on success, returns -1 on invalid address.
 */

PGM_GNUC_INTERNAL
int					/* return type to match inet_network() */
pgm_inet_network (
	const char*	restrict s,
	struct in_addr*	restrict in
	)
{
	const char	*p = s;
	unsigned	 val = 0;
	int		 shift = 24;

	pgm_return_val_if_fail (NULL != s,  -1);
	pgm_return_val_if_fail (NULL != in, -1);

	pgm_debug ("pgm_inet_network (s:\"%s\" in:%p)",
		 s, (const void*)in);

	in->s_addr = INADDR_ANY;

	while (*p)
	{
		if (isdigit (*p)) {
			val = 10 * val + (*p - '0');
		} else if (*p == '.' || *p == 0) {
			if (val > 0xff)
				goto default_none;

//g_trace ("elem %i", val);
			
			in->s_addr |= val << shift;
			val = 0;
			shift -= 8;
			if (shift < 0 && *p != 0)
				goto default_none;

		} else if (*p == '/') {
			if (val > 0xff)
				goto default_none;
//g_trace ("elem %i", val);
			in->s_addr |= val << shift;
			p++; val = 0;
			while (*p)
			{
				if (isdigit (*p))
					val = 10 * val + (*p - '0');
				else
					goto default_none;
				p++;
			}
			if (val == 0 || val > 32)
				goto default_none;
//g_trace ("bit mask %i", val);

/* zero out host bits */
			const struct in_addr netaddr = { .s_addr = cidr_to_netmask (val) };
#ifdef INET_NETWORK_DEBUG
{
g_debug ("netaddr %s", inet_ntoa (netaddr));
}
#endif
			in->s_addr &= netaddr.s_addr;
			return 0;
		
		} else if (*p == 'x' || *p == 'X') {	/* skip number, e.g. 1.x.x.x */
			if (val > 0)
				goto default_none;
			
		} else {
			goto default_none;
		}
		p++;
	}

	in->s_addr |= val << shift;
	return 0;

default_none:
	in->s_addr = INADDR_NONE;
	return -1;
}

/* Converts a numbers-and-dots notation string into an IPv6 network number.
 *
 * ::1/128	=> 0:0:0:0:0:0:0:1
 * ::1          => 0:0:0:0:0:0:0:1
 * ::1.2.3.4	=> 0:0:0:0:1.2.3.4
 *
 * returns 0 on success, returns -1 on invalid address.
 */

PGM_GNUC_INTERNAL
int
pgm_inet6_network (
	const char*	 restrict s,		/* NULL terminated */
	struct in6_addr* restrict in6
	)
{
	const char	*p = s;
	char		 s2[INET6_ADDRSTRLEN];
	char		*p2 = s2;
	unsigned	 val = 0;

	pgm_return_val_if_fail (NULL != s,   -1);
	pgm_return_val_if_fail (NULL != in6, -1);

	pgm_debug ("pgm_inet6_network (s:\"%s\" in6:%p)",
		 s, (const void*)in6);

/* inet_pton cannot parse IPv6 addresses with subnet declarations, so
 * chop them off.
 *
 * as we are dealing with network addresses IPv6 zone indices are not important
 * so we can use the inet_xtoy functions.
 */
/* first check for scope identifier and return failure */
	while (*p) {
		if (*p == '%') {
			pgm_debug ("pgm_inet_pton(AF_INET6) failed due to presence of scope identifier.");
			goto default_none;
		}
		p++;
	}

	p = s;
	while (*p) {
		if (*p == '/') break;
		*p2++ = *p++;
	}
	if (*p == 0) {
		if (pgm_inet_pton (AF_INET6, s, in6)) return 0;
		pgm_debug ("pgm_inet_pton(AF_INET6) failed on '%s'", s);
		goto default_none;
	}

	*p2 = 0;
	pgm_debug ("net part %s", s2);
	if (!pgm_inet_pton (AF_INET6, s2, in6)) {
		pgm_debug ("pgm_inet_pton(AF_INET) failed parsing network part '%s'", s2);
		memcpy (in6, &in6addr_any, sizeof(in6addr_any));
		goto default_none;
	}

#ifdef INET_NETWORK_DEBUG
	char sdebug[INET6_ADDRSTRLEN];
	pgm_debug ("IPv6 network address: %s", pgm_inet_ntop(AF_INET6, in6, sdebug, sizeof(sdebug)));
#endif

	p++;
	while (*p)
	{
		if (isdigit(*p)) {
			val = 10 * val + (*p - '0');
		} else {
			pgm_debug ("failed parsing subnet size due to character '%c'", *p);
			goto default_none;
		}
		p++;
	}
	if (val == 0 || val > 128) {
		pgm_debug ("subnet size invalid (%d)", val);
		goto default_none;
	}
	pgm_debug ("subnet size %i", val);

/* zero out host bits */
	const unsigned suffix_length = 128 - val;
	for (int i = suffix_length, j = 15; i > 0; i -= 8, --j)
	{
		in6->s6_addr[ j ] &= i >= 8 ? 0x00 : (unsigned)(( 0xffU << i ) & 0xffU );
	}

	pgm_debug ("effective IPv6 network address after subnet mask: %s",
		pgm_inet_ntop(AF_INET6, in6, s2, sizeof(s2)));
	return 0;

default_none:
	memset (in6, 0xff, sizeof(*in6));	/* equivalent to IN6ADDR_NONE */
	return -1;
}

/* sockaddr_in6 version of pgm_inet6_network, we use sockaddr in order to
 * resolve and keep the scope identifier.
 */

PGM_GNUC_INTERNAL
int
pgm_sa6_network (
	const char*	     restrict s,		/* NULL terminated */
	struct sockaddr_in6* restrict sa6
	)
{
	const char	*p = s;
	char		 s2[INET6_ADDRSTRLEN];
	char		*p2 = s2;
	unsigned	 val = 0;
	struct addrinfo	 hints = {
		.ai_family	= AF_INET6,
		.ai_socktype	= SOCK_STREAM,		/* not really */
		.ai_protocol	= IPPROTO_TCP,		/* not really */
		.ai_flags	= AI_NUMERICHOST
	}, *result = NULL;

	pgm_return_val_if_fail (NULL != s,   -1);
	pgm_return_val_if_fail (NULL != sa6, -1);

	pgm_debug ("pgm_sa6_network (s:\"%s\" sa6:%p)",
		 s, (const void*)sa6);

/* getaddrinfo cannot parse IPv6 addresses with subnet declarations, so
 * chop them off.
 */
	p = s;
	while (*p) {
		if (*p == '/') break;
		*p2++ = *p++;
	}
	if (*p == 0) {
		if (0 == getaddrinfo (s, NULL, &hints, &result)) {
			memcpy (sa6, result->ai_addr, result->ai_addrlen);
			freeaddrinfo (result);
			return 0;
		}
		pgm_debug ("getaddrinfo(AF_INET6) failed on '%s'", s);
		goto default_none;
	}

	*p2 = 0;
	pgm_debug ("net part %s", s2);
	if (0 != getaddrinfo (s2, NULL, &hints, &result)) {
		pgm_debug ("getaddrinfo(AF_INET) failed parsing network part '%s'", s2);
		goto default_none;
	}

	memcpy (sa6, result->ai_addr, result->ai_addrlen);
	freeaddrinfo (result);

#ifdef INET_NETWORK_DEBUG
	char sdebug[INET6_ADDRSTRLEN];
	pgm_sockaddr_ntop ((const struct sockaddr*)sa6, sdebug, sizeof(sdebug));
	pgm_debug ("IPv6 network address: %s", sdebug);
#endif

	p++;
	while (*p)
	{
		if (isdigit(*p)) {
			val = 10 * val + (*p - '0');
		} else {
			pgm_debug ("failed parsing subnet size due to character '%c'", *p);
			goto default_none;
		}
		p++;
	}
	if (val == 0 || val > 128) {
		pgm_debug ("subnet size invalid (%d)", val);
		goto default_none;
	}
	pgm_debug ("subnet size %i", val);

/* zero out host bits */
	const unsigned suffix_length = 128 - val;
	for (int i = suffix_length, j = 15; i > 0; i -= 8, --j)
	{
		sa6->sin6_addr.s6_addr[ j ] &= i >= 8 ? 0x00 : (unsigned)(( 0xffU << i ) & 0xffU );
	}

#ifdef INET_NETWORK_DEBUG
	pgm_sockaddr_ntop ((const struct sockaddr*)sa6, sdebug, sizeof(sdebug));
	pgm_debug ("effective IPv6 network address after subnet mask: %s", sdebug);
#endif
	return 0;

default_none:
	memset (sa6, 0, sizeof(*sa6));
	sa6->sin6_family = AF_INET6;
	memset (&sa6->sin6_addr, 0xff, sizeof(struct in6_addr));	/* equivalent to IN6ADDR_NONE */
	return -1;
}

/* create an internet address from network & host.
 *
 * expect compiler warnings on return type due to compatibility with inet_makeaddr.
 */

PGM_GNUC_INTERNAL
struct in_addr
pgm_inet_makeaddr (
	uint32_t	net,
	uint32_t	host
	)
{
	uint32_t addr;

	if (net < 128)
		addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
	else if (net < 65536)
		addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
	else if (net < 16777216UL)
		addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
	else
		addr = net | host;
	addr = htonl (addr);
	return (*(struct in_addr*)&addr);
}

/* eof */

libpgm-5.1.118-1~dfsg/openpgm/pgm/ip_unittest.c0000644000175000017500000004344211640407354020265 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * unit tests for ip stack.
 *
 * Copyright (c) 2009-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#	include 
#	include 
#else
#	include 
#	include 
#endif
#include 
#include 
#include 


/* getsockopt(3SOCKET)
 * level is the protocol number of the protocl that controls the option.
 */
#ifndef SOL_IP
#	define SOL_IP		IPPROTO_IP
#endif
#ifndef SOL_IPV6
#	define SOL_IPV6		IPPROTO_IPV6
#endif

/* mock state */

size_t
pgm_transport_pkt_offset2 (
        const bool                      can_fragment,
        const bool                      use_pgmcc
        )
{
        return 0;
}

#define PGM_COMPILATION
#include "impl/sockaddr.h"
#include "impl/indextoaddr.h"
#include "impl/ip.h"

PGM_GNUC_INTERNAL
int
pgm_get_nprocs (void)
{
	return 1;
}

/* target:
 *   testing platform capability to loop send multicast packets to a listening
 * receive socket.
 */

START_TEST (test_multicast_loop_pass_001)
{
	struct sockaddr_in	multicast_group;
	struct sockaddr_in	recv_addr;
	struct sockaddr_in	send_addr;
	struct sockaddr_in	if_addr;

	memset (&multicast_group, 0, sizeof(multicast_group));
	multicast_group.sin_family = AF_INET;
	multicast_group.sin_port = 0;
	multicast_group.sin_addr.s_addr = inet_addr ("239.192.0.1");

	fail_unless (TRUE == pgm_if_indextoaddr (0, AF_INET, 0, (struct sockaddr*)&if_addr, NULL), "if_indextoaddr failed");

	SOCKET recv_sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	fail_if (INVALID_SOCKET == recv_sock, "socket failed");
	memcpy (&recv_addr, &multicast_group, sizeof(multicast_group));
/* listen for UDP packets on port 7500 */
	recv_addr.sin_port = htons (7500);
#ifdef _WIN32
/* Can only bind to interfaces */
	recv_addr.sin_addr.s_addr = INADDR_ANY;
#endif
	fail_unless (0 == bind (recv_sock, (struct sockaddr*)&recv_addr, pgm_sockaddr_len ((struct sockaddr*)&recv_addr)), "bind failed");
#ifndef NO_MCAST_JOIN_GROUP
	struct group_req gr;
	memset (&gr, 0, sizeof(gr));
	((struct sockaddr*)&gr.gr_group)->sa_family = multicast_group.sin_family;
	((struct sockaddr_in*)&gr.gr_group)->sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	fail_unless (0 == setsockopt (recv_sock, SOL_IP, MCAST_JOIN_GROUP, (const char*)&gr, sizeof(gr)), "setsockopt(MCAST_JOIN_GROUP) failed");
#else
	struct ip_mreq mreq;
	memset (&mreq, 0, sizeof(mreq));
	mreq.imr_multiaddr.s_addr = multicast_group.sin_addr.s_addr;
	mreq.imr_interface.s_addr = if_addr.sin_addr.s_addr;
	fail_unless (0 == setsockopt (recv_sock, SOL_IP, IP_ADD_MEMBERSHIP, (const char*)&mreq, sizeof(mreq)), "setsockopt(IP_ADD_MEMBERSHIP) failed");
#endif
	fail_unless (0 == pgm_sockaddr_multicast_loop (recv_sock, AF_INET, TRUE), "multicast_loop failed");

	SOCKET send_sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	fail_if (INVALID_SOCKET == send_sock, "socket failed");
	memcpy (&send_addr, &multicast_group, sizeof(multicast_group));
/* random port, default routing */
	send_addr.sin_port = 0;
	send_addr.sin_addr.s_addr = INADDR_ANY;
	fail_unless (0 == bind (send_sock, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)), "bind failed");
	fail_unless (0 == pgm_sockaddr_multicast_if (send_sock, (struct sockaddr*)&if_addr, 0), "multicast_if failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (send_sock, AF_INET, TRUE), "multicast_loop failed");

	const char data[] = "apple pie";
	send_addr.sin_port = htons (7500);
	send_addr.sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	ssize_t bytes_sent = sendto (send_sock, data, sizeof(data), 0, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr));
	if (SOCKET_ERROR == bytes_sent) {
		char errbuf[1024];
		g_message ("sendto: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	fail_unless (sizeof(data) == bytes_sent, "sendto underrun");

	char recv_data[1024];
	ssize_t bytes_read = recv (recv_sock, recv_data, sizeof(recv_data), MSG_DONTWAIT);
	if (SOCKET_ERROR == bytes_read) {
		char errbuf[1024];
		g_message ("recv: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	fail_unless (sizeof(data) == bytes_read, "recv underrun");

	fail_unless (0 == closesocket (recv_sock), "closesocket failed");
	fail_unless (0 == closesocket (send_sock), "closesocket failed");
}
END_TEST

/* target:
 *   testing whether unicast bind accepts packets to multicast join on a
 * different port.
 */

START_TEST (test_port_bind_pass_001)
{
	struct sockaddr_in	multicast_group;
	struct sockaddr_in	recv_addr;
	struct sockaddr_in	send_addr;
	struct sockaddr_in	if_addr;

	memset (&multicast_group, 0, sizeof(multicast_group));
	multicast_group.sin_family = AF_INET;
	multicast_group.sin_port = 0;
	multicast_group.sin_addr.s_addr = inet_addr ("239.192.0.1");

	fail_unless (TRUE == pgm_if_indextoaddr (0, AF_INET, 0, (struct sockaddr*)&if_addr, NULL), "if_indextoaddr failed");

	SOCKET recv_sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	fail_if (INVALID_SOCKET == recv_sock, "socket failed");
	memcpy (&recv_addr, &multicast_group, sizeof(multicast_group));
	recv_addr.sin_port = htons (3056);
#ifdef _WIN32
/* Can only bind to interfaces */
	recv_addr.sin_addr.s_addr = INADDR_ANY;
#endif
	fail_unless (0 == bind (recv_sock, (struct sockaddr*)&recv_addr, pgm_sockaddr_len ((struct sockaddr*)&recv_addr)), "bind failed");
	struct group_req gr;
	memset (&gr, 0, sizeof(gr));
	((struct sockaddr*)&gr.gr_group)->sa_family = multicast_group.sin_family;
	((struct sockaddr_in*)&gr.gr_group)->sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	((struct sockaddr_in*)&gr.gr_group)->sin_port = htons (3055);
	fail_unless (0 == setsockopt (recv_sock, SOL_IP, MCAST_JOIN_GROUP, (const char*)&gr, sizeof(gr)), "setsockopt failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (recv_sock, AF_INET, TRUE), "multicast_loop failed");

	SOCKET send_sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	fail_if (INVALID_SOCKET == send_sock, "socket failed");
	memcpy (&send_addr, &multicast_group, sizeof(multicast_group));
	send_addr.sin_port = 0;
	send_addr.sin_addr.s_addr = INADDR_ANY;
	fail_unless (0 == bind (send_sock, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)), "bind failed");
	fail_unless (0 == pgm_sockaddr_multicast_if (send_sock, (struct sockaddr*)&if_addr, 0), "multicast_if failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (send_sock, AF_INET, TRUE), "multicast_loop failed");

	const char data[] = "apple pie";
	send_addr.sin_port = htons (3056);
	send_addr.sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	ssize_t bytes_sent = sendto (send_sock, data, sizeof(data), 0, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr));
	if (SOCKET_ERROR == bytes_sent) {
		char errbuf[1024];
		g_message ("sendto: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	fail_unless (sizeof(data) == bytes_sent, "sendto underrun");

	char recv_data[1024];
	ssize_t bytes_read = recv (recv_sock, recv_data, sizeof(recv_data), MSG_DONTWAIT);
	if (SOCKET_ERROR == bytes_read) {
		char errbuf[1024];
		g_message ("recv: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	if (sizeof(data) != bytes_read)
		g_message ("recv returned %d bytes expected %d.", bytes_read, sizeof(data));
	fail_unless (sizeof(data) == bytes_read, "recv underrun");

	fail_unless (0 == closesocket (recv_sock), "closesocket failed");
	fail_unless (0 == closesocket (send_sock), "closesocket failed");
}
END_TEST

/* target:
 *   test setting hop limit, aka time-to-live.
 *
 *   NB: whilst convenient, we cannot use SOCK_RAW & IPPROTO_UDP on Solaris 10
 *   as it crashes the IP stack.
 */

START_TEST (test_hop_limit_pass_001)
{
	struct sockaddr_in	multicast_group;
	struct sockaddr_in	recv_addr;
	struct sockaddr_in	send_addr;
	struct sockaddr_in	if_addr;

	memset (&multicast_group, 0, sizeof(multicast_group));
	multicast_group.sin_family = AF_INET;
	multicast_group.sin_port = 0;
	multicast_group.sin_addr.s_addr = inet_addr ("239.192.0.1");

	fail_unless (TRUE == pgm_if_indextoaddr (0, AF_INET, 0, (struct sockaddr*)&if_addr, NULL), "if_indextoaddr failed");

	SOCKET recv_sock = socket (AF_INET, SOCK_RAW, 113);
	fail_if (INVALID_SOCKET == recv_sock, "socket failed");
	memcpy (&recv_addr, &multicast_group, sizeof(multicast_group));
	recv_addr.sin_port = 7500;
#ifdef _WIN32
/* Can only bind to interfaces */
	recv_addr.sin_addr.s_addr = INADDR_ANY;
#endif
	fail_unless (0 == bind (recv_sock, (struct sockaddr*)&recv_addr, pgm_sockaddr_len ((struct sockaddr*)&recv_addr)), "bind failed");
	struct group_req gr;
	memset (&gr, 0, sizeof(gr));
	((struct sockaddr*)&gr.gr_group)->sa_family = multicast_group.sin_family;
	((struct sockaddr_in*)&gr.gr_group)->sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	fail_unless (0 == setsockopt (recv_sock, SOL_IP, MCAST_JOIN_GROUP, (const char*)&gr, sizeof(gr)), "setsockopt failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (recv_sock, AF_INET, TRUE), "multicast_loop failed");
	fail_unless (0 == pgm_sockaddr_hdrincl (recv_sock, AF_INET, TRUE), "hdrincl failed");

	SOCKET send_sock = socket (AF_INET, SOCK_RAW, 113);
	fail_if (INVALID_SOCKET == send_sock, "socket failed");
	memcpy (&send_addr, &multicast_group, sizeof(multicast_group));
	send_addr.sin_port = 0;
	send_addr.sin_addr.s_addr = INADDR_ANY;
	fail_unless (0 == bind (send_sock, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)), "bind failed");
	fail_unless (0 == pgm_sockaddr_multicast_if (send_sock, (struct sockaddr*)&if_addr, 0), "multicast_if failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (send_sock, AF_INET, TRUE), "multicast_loop failed");
	fail_unless (0 == pgm_sockaddr_multicast_hops (send_sock, AF_INET, 16), "multicast_hops failed");

	const char data[] = "apple pie";
	send_addr.sin_port = htons (7500);
	send_addr.sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	ssize_t bytes_sent = sendto (send_sock, data, sizeof(data), 0, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr));
	if (SOCKET_ERROR == bytes_sent) {
		char errbuf[1024];
		g_message ("sendto: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	fail_unless (sizeof(data) == bytes_sent, "sendto underrun");

	char recv_data[1024];
	ssize_t bytes_read = recv (recv_sock, recv_data, sizeof(recv_data), MSG_DONTWAIT);
	if (SOCKET_ERROR == bytes_read) {
		char errbuf[1024];
		g_message ("recv: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	const size_t pkt_len = sizeof(struct pgm_ip) + sizeof(data);
	if (pkt_len != bytes_read)
		g_message ("recv returned %" PRIzd " bytes expected %" PRIzu ".", bytes_read, pkt_len);
	fail_unless (pkt_len == bytes_read, "recv underrun");
	const struct pgm_ip* iphdr = (void*)recv_data;
	fail_unless (4 == iphdr->ip_v, "Incorrect IP version, found %u expecting 4.", iphdr->ip_v);
	fail_unless (16 == iphdr->ip_ttl, "hop count mismatch, found %u expecting 16.", iphdr->ip_ttl);

	fail_unless (0 == closesocket (recv_sock), "closesocket failed");
	fail_unless (0 == closesocket (send_sock), "closesocket failed");
}
END_TEST

/* target:
 *   router alert.
 */

START_TEST (test_router_alert_pass_001)
{
	struct sockaddr_in	multicast_group;
	struct sockaddr_in	recv_addr;
	struct sockaddr_in	send_addr;
	struct sockaddr_in	if_addr;

	memset (&multicast_group, 0, sizeof(multicast_group));
	multicast_group.sin_family = AF_INET;
	multicast_group.sin_port = 0;
	multicast_group.sin_addr.s_addr = inet_addr ("239.192.0.1");

	fail_unless (TRUE == pgm_if_indextoaddr (0, AF_INET, 0, (struct sockaddr*)&if_addr, NULL), "if_indextoaddr failed");

	SOCKET recv_sock = socket (AF_INET, SOCK_RAW, 113);
	fail_if (INVALID_SOCKET == recv_sock, "socket failed");
	memcpy (&recv_addr, &multicast_group, sizeof(multicast_group));
	recv_addr.sin_port = htons (7500);
#ifdef _WIN32
/* Can only bind to interfaces */
	recv_addr.sin_addr.s_addr = INADDR_ANY;
#endif
	fail_unless (0 == bind (recv_sock, (struct sockaddr*)&recv_addr, pgm_sockaddr_len ((struct sockaddr*)&recv_addr)), "bind failed");
	struct group_req gr;
	memset (&gr, 0, sizeof(gr));
	((struct sockaddr*)&gr.gr_group)->sa_family = multicast_group.sin_family;
	((struct sockaddr_in*)&gr.gr_group)->sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	fail_unless (0 == setsockopt (recv_sock, SOL_IP, MCAST_JOIN_GROUP, (const char*)&gr, sizeof(gr)), "setsockopt failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (recv_sock, AF_INET, TRUE), "multicast_loop failed");
	fail_unless (0 == pgm_sockaddr_hdrincl (recv_sock, AF_INET, TRUE), "hdrincl failed");

	SOCKET send_sock = socket (AF_INET, SOCK_RAW, 113);
	fail_if (INVALID_SOCKET == send_sock, "socket failed");
	memcpy (&send_addr, &multicast_group, sizeof(multicast_group));
	send_addr.sin_port = 0;
	send_addr.sin_addr.s_addr = INADDR_ANY;
	fail_unless (0 == bind (send_sock, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr)), "bind failed");
	fail_unless (0 == pgm_sockaddr_multicast_if (send_sock, (struct sockaddr*)&if_addr, 0), "multicast_if failed");
	fail_unless (0 == pgm_sockaddr_multicast_loop (send_sock, AF_INET, TRUE), "multicast_loop failed");
	fail_unless (0 == pgm_sockaddr_router_alert (send_sock, AF_INET, TRUE), "router_alert failed");

	const char data[] = "apple pie";
	send_addr.sin_port = htons (7500);
	send_addr.sin_addr.s_addr = multicast_group.sin_addr.s_addr;
	ssize_t bytes_sent = sendto (send_sock, data, sizeof(data), 0, (struct sockaddr*)&send_addr, pgm_sockaddr_len ((struct sockaddr*)&send_addr));
	if (SOCKET_ERROR == bytes_sent) {
		char errbuf[1024];
		g_message ("sendto: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	fail_unless (sizeof(data) == bytes_sent, "sendto underrun");

	char recv_data[1024];
	ssize_t bytes_read = recv (recv_sock, recv_data, sizeof(recv_data), MSG_DONTWAIT);
	if (SOCKET_ERROR == bytes_read) {
		char errbuf[1024];
		g_message ("recv: %s",
			pgm_sock_strerror_s (errbuf, sizeof (errbuf), pgm_get_last_sock_error()));
	}
	const size_t ra_iphdr_len = sizeof(uint32_t) + sizeof(struct pgm_ip);
	const size_t ra_pkt_len = ra_iphdr_len + sizeof(data);
	if (ra_pkt_len != bytes_read)
		g_message ("recv returned %" PRIzd " bytes expected %" PRIzu ".", bytes_read, ra_pkt_len);
	fail_unless (ra_pkt_len == bytes_read, "recv underrun");
	const struct pgm_ip* iphdr = (void*)recv_data;
	fail_unless (4 == iphdr->ip_v, "Incorrect IP version, found %u expecting 4.", iphdr->ip_v);
	if (ra_iphdr_len != (iphdr->ip_hl << 2)) {
		g_message ("IP header length mismatch, found %" PRIzu " expecting %" PRIzu ".",
			(size_t)(iphdr->ip_hl << 2), ra_iphdr_len);
	}
	g_message ("IP header length = %" PRIzu, (size_t)(iphdr->ip_hl << 2));
	const uint32_t* ipopt = (const void*)&recv_data[ iphdr->ip_hl << 2 ];
	const uint32_t ipopt_ra = ((uint32_t)PGM_IPOPT_RA << 24) | (0x04 << 16);
	const uint32_t router_alert = htonl(ipopt_ra);
	if (router_alert == *ipopt) {
		g_message ("IP option router alert found after IP header length.");
		ipopt += sizeof(uint32_t);
	} else {
		ipopt = (const void*)&recv_data[ sizeof(struct pgm_ip) ];
		fail_unless (router_alert == *ipopt, "IP router alert option not found.");
		g_message ("IP option router alert found before end of IP header length.");
	}
	g_message ("Final IP header length = %" PRIzu, (size_t)((const char*)ipopt - (const char*)recv_data));

	fail_unless (0 == closesocket (recv_sock), "closesocket failed");
	fail_unless (0 == closesocket (send_sock), "closesocket failed");
}
END_TEST


static
Suite*
make_test_suite (void)
{
	Suite* s;

	s = suite_create (__FILE__);

	TCase* tc_multicast_loop = tcase_create ("multicast loop");
	suite_add_tcase (s, tc_multicast_loop);
	tcase_add_test (tc_multicast_loop, test_multicast_loop_pass_001);

	TCase* tc_port_bind = tcase_create ("port bind");
	suite_add_tcase (s, tc_port_bind);
	tcase_add_test (tc_port_bind, test_port_bind_pass_001);

	TCase* tc_hop_limit = tcase_create ("hop limit");
	suite_add_tcase (s, tc_hop_limit);
	tcase_add_test (tc_hop_limit, test_hop_limit_pass_001);

	TCase* tc_router_alert = tcase_create ("router alert");
	suite_add_tcase (s, tc_router_alert);
	tcase_add_test (tc_router_alert, test_router_alert_pass_001);
	return s;
}

static
Suite*
make_master_suite (void)
{
	Suite* s = suite_create ("Master");
	return s;
}

int
main (void)
{
#ifndef _WIN32
	if (0 != getuid()) {
		fprintf (stderr, "This test requires super-user privileges to run.\n");
		return EXIT_FAILURE;
	}
#else
	WORD wVersionRequested = MAKEWORD (2, 2);
	WSADATA wsaData;
	g_assert (0 == WSAStartup (wVersionRequested, &wsaData));
	g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2);
#endif
	pgm_messages_init();
	SRunner* sr = srunner_create (make_master_suite ());
	srunner_add_suite (sr, make_test_suite ());
	srunner_run_all (sr, CK_ENV);
	int number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	pgm_messages_shutdown();
#ifdef _WIN32
	WSACleanup();
#endif
	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/time_unittest.c0000644000175000017500000001174711640407354020616 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * unit tests for high resolution timers.
 *
 * Copyright (c) 2009 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


#include 
#include 
#include 
#include 
#include 
#include 

#ifdef _WIN32
#	define PGM_CHECK_NOFORK		1
#endif


/* mock state */


/* mock functions for external references */

size_t
pgm_transport_pkt_offset2 (
        const bool                      can_fragment,
        const bool                      use_pgmcc
        )
{
        return 0;
}

#include "time.c"

PGM_GNUC_INTERNAL
int
pgm_get_nprocs (void)
{
	return 1;
}

/* target:
 *	boolean
 *	pgm_time_init (pgm_error_t** error)
 */

/* time initialisation uses reference counting */

START_TEST (test_init_pass_001)
{
	fail_unless (TRUE == pgm_time_init (NULL), "init #1 failed");
	fail_unless (TRUE == pgm_time_init (NULL), "init #2 failed");
#ifdef PGM_CHECK_NOFORK
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown #1 failed");
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown #2 failed");
#endif
}
END_TEST

/* target:
 *	bool
 *	pgm_time_shutdown (void)
 */

START_TEST (test_shutdown_pass_001)
{
	fail_unless (TRUE == pgm_time_init (NULL), "init failed");
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown #1 failed");
	fail_unless (FALSE == pgm_time_shutdown (), "shutdown #2 failed");
}
END_TEST

START_TEST (test_shutdown_pass_002)
{
	fail_unless (TRUE == pgm_time_init (NULL), "init #1 failed");
	fail_unless (TRUE == pgm_time_init (NULL), "init #2 failed");
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown #1 failed");
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown #2 failed");
	fail_unless (FALSE == pgm_time_shutdown (), "shutdown #3 failed");
}
END_TEST

/* target:
 *	pgm_time_t
 *	pgm_time_update_now (void)
 */

START_TEST (test_update_now_pass_001)
{
	pgm_time_t tstamps[11];
	fail_unless (TRUE == pgm_time_init (NULL), "init failed");
	const pgm_time_t start_time = pgm_time_update_now ();
	for (unsigned i = 1; i <= 10; i++)
	{
		tstamps[i] = pgm_time_update_now();
	}
	g_message ("start-time:     %" PGM_TIME_FORMAT, start_time);
	for (unsigned i = 1; i <= 10; i++)
	{
		const pgm_time_t check_time = tstamps[i];
		const gint64 elapsed_time = check_time - start_time;

/* must be monotonic */
		fail_unless (G_LIKELY(check_time >= start_time), "non-monotonic");

		g_message ("check-point-%2.2u: %" PGM_TIME_FORMAT " (%+" G_GINT64_FORMAT "us)",
			   i, check_time, pgm_to_usecs(elapsed_time));
	}
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown failed");
}
END_TEST

/* target:
 *	void
 *	pgm_time_since_epoch (
 *		pgm_time_t*	pgm_time,
 *		time_t*		epoch_time
 *		)
 */

START_TEST (test_since_epoch_pass_001)
{
	char stime[1024];
	time_t t;
	struct tm* tmp;
	fail_unless (TRUE == pgm_time_init (NULL), "init failed");
	pgm_time_t pgm_now = pgm_time_update_now ();
	pgm_time_since_epoch (&pgm_now, &t);
	tmp = localtime (&t);
	fail_unless (NULL != tmp, "localtime failed");
	fail_unless (0 != strftime (stime, sizeof(stime), "%X", tmp), "strftime failed");
	g_message ("pgm-time:%" PGM_TIME_FORMAT " = %s",
		   pgm_now, stime);
	fail_unless (TRUE == pgm_time_shutdown (), "shutdown failed");
}
END_TEST


static
Suite*
make_test_suite (void)
{
	Suite* s;

	s = suite_create (__FILE__);

	TCase* tc_init = tcase_create ("init");
	suite_add_tcase (s, tc_init);
	tcase_add_test (tc_init, test_init_pass_001);

	TCase* tc_shutdown = tcase_create ("shutdown");
	suite_add_tcase (s, tc_shutdown);
	tcase_add_test (tc_shutdown, test_shutdown_pass_001);
	tcase_add_test (tc_shutdown, test_shutdown_pass_002);

	TCase* tc_update_now = tcase_create ("update-now");
	suite_add_tcase (s, tc_update_now);
	tcase_add_test (tc_update_now, test_update_now_pass_001);

	TCase* tc_since_epoch = tcase_create ("since-epoch");
	suite_add_tcase (s, tc_since_epoch);
	tcase_add_test (tc_since_epoch, test_since_epoch_pass_001);
	return s;
}

static
Suite*
make_master_suite (void)
{
	Suite* s = suite_create ("Master");
	return s;
}

int
main (void)
{
	pgm_messages_init();
	SRunner* sr = srunner_create (make_master_suite ());
	srunner_add_suite (sr, make_test_suite ());
	srunner_run_all (sr, CK_ENV);
	int number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	pgm_messages_shutdown();
	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/rand.c0000644000175000017500000000567111640407354016644 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * portable weak pseudo-random generator.
 *
 * Copyright (c) 2010-2011 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _WIN32
#	include 
#	include 
#endif
#include 


//#define RAND_DEBUG


/* locals */

static pgm_rand_t		global_rand = { .seed = 0 };
static volatile uint32_t	rand_ref_count = 0;
static pgm_mutex_t		rand_mutex;

PGM_GNUC_INTERNAL
void
pgm_rand_init (void)
{
	if (pgm_atomic_exchange_and_add32 (&rand_ref_count, 1) > 0)
		return;

	pgm_mutex_init (&rand_mutex);
}

PGM_GNUC_INTERNAL
void
pgm_rand_shutdown (void)
{
	pgm_return_if_fail (pgm_atomic_read32 (&rand_ref_count) > 0);

	if (pgm_atomic_exchange_and_add32 (&rand_ref_count, (uint32_t)-1) != 1)
		return;

	pgm_mutex_free (&rand_mutex);
}

PGM_GNUC_INTERNAL
void
pgm_rand_create (
	pgm_rand_t*	new_rand
	)
{
/* pre-conditions */
	pgm_assert (NULL != new_rand);

#ifndef _WIN32
/* attempt to read seed from kernel
 */
	FILE* fp;
	do {
		fp = fopen ("/dev/urandom", "rb");
	} while (PGM_UNLIKELY(EINTR == errno));
	if (fp) {
		size_t items_read;
		do {
			items_read = fread (&new_rand->seed, sizeof(new_rand->seed), 1, fp);
		} while (PGM_UNLIKELY(EINTR == errno));
		fclose (fp);
		if (1 == items_read)
			return;
	}
#endif /* !_WIN32 */
	const pgm_time_t now = pgm_time_update_now();
	new_rand->seed = (uint32_t)pgm_to_msecs (now);
}

/* derived from POSIX.1-2001 example implementation of rand()
 */

PGM_GNUC_INTERNAL
uint32_t
pgm_rand_int (
	pgm_rand_t*	r
	)
{
/* pre-conditions */
	pgm_assert (NULL != r);

	r->seed = r->seed * 1103515245 + 12345;
	return r->seed;
}

PGM_GNUC_INTERNAL
int32_t
pgm_rand_int_range (
	pgm_rand_t*	r,
	int32_t		begin,
	int32_t		end
	)
{
/* pre-conditions */
	pgm_assert (NULL != r);

	return begin + pgm_rand_int (r) % (end - begin);
}

PGM_GNUC_INTERNAL
uint32_t
pgm_random_int (void)
{
	pgm_mutex_lock (&rand_mutex);
	if (PGM_UNLIKELY(!global_rand.seed))
		pgm_rand_create (&global_rand);
	const uint32_t rand_value = pgm_rand_int (&global_rand);
	pgm_mutex_unlock (&rand_mutex);
	return rand_value;
}

PGM_GNUC_INTERNAL
int32_t
pgm_random_int_range (
	int32_t		begin,
	int32_t		end
	)
{
	const uint32_t rand_value = pgm_random_int();
	return begin + rand_value % (end - begin);
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct0000644000175000017500000002455111640407354017604 0ustar  locallocal# -*- mode: python -*-
# OpenPGM build script

import platform
import os
import time
import sys

EnsureSConsVersion( 1, 0 )
SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine());

vars = Variables()
vars.AddVariables (
	EnumVariable ('BUILD', 'build environment', 'debug',
			allowed_values=('release', 'debug', 'profile')),
	EnumVariable ('BRANCH', 'branch prediction', 'none',
			allowed_values=('none', 'profile', 'seed')),
	EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('COVERAGE', 'test coverage', 'none',
			allowed_values=('none', 'full')),
	EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_HTTP', 'HTTP administration', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_SNMP', 'SNMP administration', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_CHECK', 'Check test system', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_TEST', 'Network test system', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_CC', 'C++ examples', 'true',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_EXAMPLES', 'Examples', 'true',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false',
			allowed_values=('true', 'false')),
)

#-----------------------------------------------------------------------------
# Dependencies

env = Environment();

def CheckPKGConfig(context, version):
	context.Message( 'Checking for pkg-config... ' )
	ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
	context.Result( ret )
	return ret

def CheckPKG(context, name):
	context.Message( 'Checking for %s... ' % name )
	ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
	context.Result( ret )
	return ret

conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
				       'CheckPKG' : CheckPKG })

if not conf.CheckPKGConfig('0.15.0'):
	print 'pkg-config >= 0.15.0 not found.'
#	Exit(1)

if not conf.CheckPKG('glib-2.0 >= 2.10'):
	print 'glib-2.0 >= 2.10 not found.'
#	Exit(1)

if not conf.CheckPKG('gthread-2.0'):
	print 'gthread-2.0 not found.'
#	Exit(1)

env = conf.Finish();

#-----------------------------------------------------------------------------
# Platform specifics

env = Environment(
	variables = vars,
	ENV = os.environ,
	CCFLAGS = [	'-pipe',
			'-Wall',
				'-Wextra',
				'-Wfloat-equal',
				'-Wshadow',
				'-Wunsafe-loop-optimizations',
				'-Wpointer-arith',
				'-Wbad-function-cast',
				'-Wcast-qual',
				'-Wcast-align',
				'-Wwrite-strings',
				'-Waggregate-return',
				'-Wstrict-prototypes',
				'-Wold-style-definition',
				'-Wmissing-prototypes',
				'-Wmissing-declarations',
				'-Wmissing-noreturn',
				'-Wmissing-format-attribute',
				'-Wredundant-decls',
				'-Wnested-externs',
#				'-Winline',
				'-Wno-inline',
				'-Wno-unused-function',
			'-pedantic',
# C99
			'-std=gnu99',
			'-D_XOPEN_SOURCE=600',
			'-D_BSD_SOURCE',
# re-entrant libc
			'-D_REENTRANT',
# POSIX spinlocks
			'-DCONFIG_HAVE_POSIX_SPINLOCK',
# NSS protocol lookup
#			'-DCONFIG_HAVE_GETPROTOBYNAME_R',
			'-DCONFIG_HAVE_GETPROTOBYNAME_R2',
# NSS networks lookup, IPv4 only
			'-DCONFIG_HAVE_GETNETENT',
# variadic macros
			'-DCONFIG_HAVE_ISO_VARARGS',
#			'-DCONFIG_HAVE_GNUC_VARARGS',
# stack memory api header
			'-DCONFIG_HAVE_ALLOCA_H',
# optimium checksum implementation
#			'-DCONFIG_8BIT_CHECKSUM',
			'-DCONFIG_16BIT_CHECKSUM',
#			'-DCONFIG_32BIT_CHECKSUM',
#			'-DCONFIG_64BIT_CHECKSUM',
#			'-DCONFIG_VECTOR_CHECKSUM',
# useful /proc system
			'-DCONFIG_HAVE_PROC',
# example: crash handling
			'-DCONFIG_HAVE_BACKTRACE',
# timing
			'-DCONFIG_HAVE_PSELECT',
			'-DCONFIG_HAVE_RTC',
			'-DCONFIG_HAVE_TSC',
			'-DCONFIG_HAVE_HPET',
# event handling
			'-DCONFIG_HAVE_POLL',
			'-DCONFIG_HAVE_EPOLL',
# interface enumeration
			'-DCONFIG_HAVE_GETIFADDRS',
			'-DCONFIG_HAVE_IFR_NETMASK',
# win32 cmsg
#			'-DCONFIG_HAVE_WSACMSGHDR',
# multicast
			'-DCONFIG_HAVE_MCAST_JOIN',
			'-DCONFIG_HAVE_IP_MREQN',
# sprintf
			'-DCONFIG_HAVE_SPRINTF_GROUPING',
			'-DCONFIG_HAVE_VASPRINTF',
# symbol linking scope
			'-DCONFIG_HAVE_DSO_VISIBILITY',
# socket binding
			'-DCONFIG_BIND_INADDR_ANY',
# IP header order as per IP(4) on FreeBSD
#			'-DCONFIG_HOST_ORDER_IP_LEN',
#			'-DCONFIG_HOST_ORDER_IP_OFF',
# ticket based spinlocks
			'-DCONFIG_TICKET_SPINLOCK',
# dumb read-write spinlock
			'-DCONFIG_DUMB_RWSPINLOCK',
# optimum galois field multiplication
			'-DCONFIG_GALOIS_MUL_LUT',
# Wine limited API support
#			'-DCONFIG_TARGET_WINE',
# GNU getopt
			'-DCONFIG_HAVE_GETOPT'
		],
	LINKFLAGS = [	'-pipe',
			'-lpthread'
		],
	LIBS = [
# histogram math
			'm',
# clock_gettime()
			'rt'
		],
	PROTOBUF_CCFLAGS = '-I/miru/projects/protobuf/protobuf-2.3.0/gcc64/include',
	PROTOBUF_LIBS = '/miru/projects/protobuf/protobuf-2.3.0/gcc64/lib/libprotobuf.a',
	PROTOBUF_PROTOC = '/miru/projects/protobuf/protobuf-2.3.0/gcc64/bin/protoc'
)

# Branch prediction
if env['BRANCH'] == 'profile':
	env.Append(CCFLAGS = '-fprofile-arcs')
	env.Append(LINKFLAGS = '-fprofile-arcs')
elif env['BRANCH'] == 'seed':
	env.Append(CCFLAGS = '-fbranch-probabilities')

# Coverage analysis
if env['COVERAGE'] == 'full':
	env.Append(CCFLAGS = '-fprofile-arcs')
	env.Append(CCFLAGS = '-ftest-coverage')
	env.Append(LINKFLAGS = '-fprofile-arcs')
	env.Append(LINKFLAGS = '-lgcov')

# Define separate build environments
release = env.Clone(BUILD = 'release')
release.Append(CCFLAGS = '-O2')

debug = env.Clone(BUILD = 'debug')
debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb')

profile = env.Clone(BUILD = 'profile')
profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg')

thirtytwo = release.Clone(BUILD = 'thirtytwo')
thirtytwo.Append(CCFLAGS = '-m32', LINKFLAGS = '-m32')

# choose and environment to build
if env['BUILD'] == 'release':
	Export({'env':release})
elif env['BUILD'] == 'profile':
	Export({'env':profile})
elif env['BUILD'] == 'thirtytwo':
	Export({'env':thirtytwo})
else:
	Export({'env':debug})

#-----------------------------------------------------------------------------
# Re-analyse dependencies

Import('env')

# vanilla environment
if env['WITH_GLIB'] == 'true':
	env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0');
else:
	env['GLIB_FLAGS'] = '';

# l10n
if env['WITH_GETTEXT'] == 'true':
	env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT');

# instrumentation
if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true':
	env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS');

# managed environment for libpgmsnmp, libpgmhttp
if env['WITH_SNMP'] == 'true':
	env['SNMP_FLAGS'] = env.ParseFlags('!net-snmp-config --agent-libs');

def CheckSNMP(context):
	context.Message('Checking Net-SNMP...');
#	backup = context.env.Clone().Dictionary();
	lastASFLAGS	= context.env.get('ASFLAGS', '');
	lastCCFLAGS	= context.env.get('CCFLAGS', '');
	lastCFLAGS	= context.env.get('CFLAGS', '');
	lastCPPDEFINES	= context.env.get('CPPDEFINES', '');
	lastCPPFLAGS	= context.env.get('CPPFLAGS', '');
	lastCPPPATH	= context.env.get('CPPPATH', '');
	lastLIBPATH	= context.env.get('LIBPATH', '');
	lastLIBS	= context.env.get('LIBS', '');
	lastLINKFLAGS	= context.env.get('LINKFLAGS', '');
	lastRPATH	= context.env.get('RPATH', '');
	context.env.MergeFlags(env['SNMP_FLAGS']);
	result = context.TryLink("""
int main(int argc, char**argv)
{
	init_agent("PGM");
	return 0;
}
""", '.c');
#	context.env.Replace(**backup);
	context.env.Replace(ASFLAGS	= lastASFLAGS,
			    CCFLAGS	= lastCCFLAGS,
			    CFLAGS	= lastCFLAGS,
			    CPPDEFINES	= lastCPPDEFINES,
			    CPPFLAGS	= lastCPPFLAGS,
			    CPPPATH	= lastCPPPATH,
			    LIBPATH	= lastLIBPATH,
			    LIBS	= lastLIBS,
			    LINKFLAGS	= lastLINKFLAGS,
			    RPATH	= lastRPATH);
	context.Result(not result);
	return result;

def CheckCheck(context):
	context.Message('Checking Check unit test framework...');
	result = context.TryAction('pkg-config --cflags --libs check')[0];
	context.Result(result);
	return result;

def CheckEventFD(context):
	context.Message('Checking eventfd...');
	result = context.TryLink("""
#include 
int main(int argc, char**argv)
{
	eventfd(0,0);
	return 0;
}
""", '.c')
	context.Result(result);
	return result;

tests = {
	'CheckCheck':	CheckCheck,
	'CheckEventFD':	CheckEventFD
}
if env['WITH_SNMP'] == 'true':
	tests['CheckSNMP'] = CheckSNMP;
conf = Configure(env, custom_tests = tests);

if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP():
	print 'Net-SNMP libraries not compatible.';
	Exit(1);

if env['WITH_CHECK'] == 'true' and conf.CheckCheck():
	print 'Enabling Check unit tests.';
	conf.env['CHECK'] = 'true';
	env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check');
else:
	print 'Disabling Check unit tests.';
	conf.env['CHECK'] = 'false';

if conf.CheckEventFD():
	print 'Enabling kernel eventfd notification mechanism.';
	conf.env.Append(CCFLAGS = '-DCONFIG_EVENTFD');

env = conf.Finish();

# add builder to create PIC static libraries for including in shared libraries
action_list = [ Action("$ARCOM", "$ARCOMSTR") ];
if env.Detect('ranlib'):
	ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR");
	action_list.append(ranlib_action);
pic_lib = Builder(	action = action_list,
			emitter = '$LIBEMITTER',
			prefix = '$LIBPREFIX',
			suffix = '$LIBSUFFIX',
			src_suffix = '$OBJSUFFIX',
			src_builder = 'SharedObject')
env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib});


#-----------------------------------------------------------------------------

ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '/';
BuildDir(ref_node, '.', duplicate=0)

env.Append(CPPPATH = os.getcwd() + '/include');
env.Append(LIBPATH = os.getcwd() + '/' + ref_node);

if env['WITH_GLIB'] == 'true':
	SConscript(ref_node + 'SConscript.libpgmex');
SConscript(ref_node + 'SConscript.libpgm');
if env['WITH_HTTP'] == 'true':
	SConscript(ref_node + 'SConscript.libpgmhttp');
if env['WITH_SNMP'] == 'true':
	SConscript(ref_node + 'SConscript.libpgmsnmp');
if env['WITH_TEST'] == 'true':
	SConscript(ref_node + 'test/SConscript');
if env['WITH_EXAMPLES'] == 'true':
	SConscript(ref_node + 'examples/SConscript');

# end of file
libpgm-5.1.118-1~dfsg/openpgm/pgm/SConstruct.Solaris.sunstudio0000644000175000017500000002441511640407354023252 0ustar  locallocal# -*- mode: python -*-
# OpenPGM build script

import platform
import os
import time
import sys

EnsureSConsVersion( 1, 0 )
SConsignFile('scons.signatures' + '-' + platform.system() + '-' + platform.machine() + '-sunstudio');

vars = Variables()
vars.AddVariables (
	EnumVariable ('BUILD', 'build environment', 'debug',
			allowed_values=('release', 'debug', 'profile')),
	EnumVariable ('BRANCH', 'branch prediction', 'none',
			allowed_values=('none', 'profile', 'seed')),
	EnumVariable ('WITH_GETTEXT', 'l10n support via libintl', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_GLIB', 'Build GLib dependent modules', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_HISTOGRAMS', 'Runtime statistical information', 'true',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_HTTP', 'HTTP administration', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_SNMP', 'SNMP administration', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_CHECK', 'Check test system', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_TEST', 'Network test system', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_CC', 'C++ examples', 'true',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_EXAMPLES', 'Examples', 'true',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_NCURSES', 'NCURSES examples', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_PROTOBUF', 'Google Protocol Buffer examples', 'false',
			allowed_values=('true', 'false')),
	EnumVariable ('WITH_PLUS', 'libpgmplus GPL library', 'false',
			allowed_values=('true', 'false')),
)

#-----------------------------------------------------------------------------
# Dependencies

def force_sunstudio(env):
	env.PrependENVPath('PATH', '/usr/ccs/bin');
	env.PrependENVPath('PATH', '/opt/glib-sunstudio/bin');
	env.PrependENVPath('PATH', '/opt/sunstudio12.1/bin');
	env.Tool('sunc++');
	env.Tool('suncc');
	env.Tool('sunlink');
	env.Tool('sunar');

env = Environment();
force_sunstudio(env);

def CheckPKGConfig(context, version):
	context.Message( 'Checking for pkg-config... ' )
	ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
	context.Result( ret )
	return ret

def CheckPKG(context, name):
	context.Message( 'Checking for %s... ' % name )
	ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
	context.Result( ret )
	return ret

conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
				       'CheckPKG' : CheckPKG })

if not conf.CheckPKGConfig('0.15.0'):
	print 'pkg-config >= 0.15.0 not found.'
	Exit(1)

if not conf.CheckPKG('glib-2.0 >= 2.10'):
	print 'glib-2.0 >= 2.10 not found.'
	Exit(1)

if not conf.CheckPKG('gthread-2.0'):
	print 'gthread-2.0 not found.'
	Exit(1)

env = conf.Finish();

#-----------------------------------------------------------------------------
# Platform specifics

env = Environment(
	variables = vars,
	ENV = os.environ,
	CCFLAGS = [
# strict C
			'-v',
# enable warnings
			'+w',
# strict ISO C
			'-Xc',
# C99
			'-xc99=all',
			'-D_XOPEN_SOURCE=600',
			'-D__EXTENSIONS__',
# re-entrant libc
			'-D_REENTRANT',
# POSIX spinlocks
			'-DCONFIG_HAVE_POSIX_SPINLOCK',
# NSS protocol lookup
			'-DCONFIG_HAVE_GETPROTOBYNAME_R',
#			'-DCONFIG_HAVE_GETPROTOBYNAME_R2',
# NSS networks lookup, IPv4 only
 			'-DCONFIG_HAVE_GETNETENT',
# variadic macros
			'-DCONFIG_HAVE_ISO_VARARGS',
#			'-DCONFIG_HAVE_GNUC_VARARGS',
# stack memory api header
			'-DCONFIG_HAVE_ALLOCA_H',
# optimium checksum implementation
#			'-DCONFIG_8BIT_CHECKSUM',
			'-DCONFIG_16BIT_CHECKSUM',
#			'-DCONFIG_32BIT_CHECKSUM',
#			'-DCONFIG_64BIT_CHECKSUM',
#			'-DCONFIG_VECTOR_CHECKSUM',
# useful /proc system
#			'-DCONFIG_HAVE_PROC',
# example: crash handling
#			'-DCONFIG_HAVE_BACKTRACE',
# timing
#			'-DCONFIG_HAVE_PSELECT',
#			'-DCONFIG_HAVE_RTC',
#			'-DCONFIG_HAVE_TSC',
#			'-DCONFIG_HAVE_HPET',
# event handling
			'-DCONFIG_HAVE_POLL',
#			'-DCONFIG_HAVE_EPOLL',
# interface enumeration
#			'-DCONFIG_HAVE_GETIFADDRS',
#			'-DCONFIG_HAVE_IFR_NETMASK',
# win32 cmsg
#			'-DCONFIG_HAVE_WSACMSGHDR',
# multicast
			'-DCONFIG_HAVE_MCAST_JOIN',
#			'-DCONFIG_HAVE_IP_MREQN',
# sprintf
#			'-DCONFIG_HAVE_SPRINTF_GROUPING',
#			'-DCONFIG_HAVE_VASPRINTF',
# symbol linking scope
			'-DCONFIG_HAVE_DSO_VISIBILITY',
# socket binding
			'-DCONFIG_BIND_INADDR_ANY',
# IP header order as per IP(4) on FreeBSD
#			'-DCONFIG_HOST_ORDER_IP_LEN',
#			'-DCONFIG_HOST_ORDER_IP_OFF',
# ticket based spinlocks
			'-DCONFIG_TICKET_SPINLOCK',
# dumb read-write spinlock
			'-DCONFIG_DUMB_RWSPINLOCK',
# optimum galois field multiplication
			'-DCONFIG_GALOIS_MUL_LUT',
# Wine limited API support
#			'-DCONFIG_TARGET_WINE',
# GNU getopt
			'-DCONFIG_HAVE_GETOPT'
		 ],
	LINKFLAGS = [],
	LIBS = [
# histogram math
			'm',
# clock_gettime()
			'rt',
# Solaris sockets
			'resolv',
			'socket',
			'nsl'
		    ],
	PROTOBUF_CCFLAGS = '-I/opt/glib-sunstudio/include',
	PROTOBUF_LIBS    = '/opt/glib-sunstudio/lib/sparcv9/libprotobuf.a',
	PROTOBUF_PROTOC  = '/opt/glib-sunstudio/bin/protoc'
)
force_sunstudio(env);

# Branch prediction
if env['BRANCH'] == 'profile':
	env.Append(CCFLAGS = '-fprofile-arcs')
	env.Append(LINKFLAGS = '-fprofile-arcs')
elif env['BRANCH'] == 'seed':
	env.Append(CCFLAGS = '-fbranch-probabilities')

# Define separate build environments
release = env.Clone(BUILD = 'release')
release.Append(CCFLAGS = ['-xO2','-m64'], LINKFLAGS = '-m64')

# outstanding defect with 12u1 cannot compile extended asm without optimization.:w
#
debug = env.Clone(BUILD = 'debug')
debug.Append(CCFLAGS = ['-DPGM_DEBUG','-xO1', '-g','-m64'], LINKFLAGS = ['-g','-m64'])

profile = env.Clone(BUILD = 'profile')
profile.Append(CCFLAGS = ['-xO2','-pg','-m64'], LINKFLAGS = ['-pg','-m64'])

thirtytwo = release.Clone(BUILD = 'thirtytwo')
thirtytwo.Append(CCFLAGS = ['-xO2','-m32'], LINKFLAGS = '-m32');

# choose and environment to build
if env['BUILD'] == 'release':
	Export({'env':release})
elif env['BUILD'] == 'profile':
	Export({'env':profile})
elif env['BUILD'] == 'thirtytwo':
	Export({'env':thirtytwo})
else:
	Export({'env':debug})

#-----------------------------------------------------------------------------
# Re-analyse dependencies

Import('env')

# vanilla environment
if env['WITH_GLIB'] == 'true':
	env['GLIB_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs glib-2.0 gthread-2.0');
else:
	env['GLIB_FLAGS'] = '';

# l10n
if env['WITH_GETTEXT'] == 'true':
	env.Append(CCFLAGS = '-DCONFIG_HAVE_GETTEXT');

# instrumentation
if env['WITH_HTTP'] == 'true' and env['WITH_HISTOGRAMS'] == 'true':
	env.Append(CCFLAGS = '-DCONFIG_HISTOGRAMS');

# managed environment for libpgmsnmp, libpgmhttp
if env['WITH_SNMP'] == 'true':
# net-snmp-config is broken in Solaris 10 and requires two separate calls
	env['SNMP_FLAGS'] = env.ParseFlags(['!/usr/sfw/bin/net-snmp-config-64 --cflags',
					    '!/usr/sfw/bin/net-snmp-config-64 --agent-libs']);

def CheckSNMP(context):
	context.Message('Checking Net-SNMP...');
#       backup = context.env.Clone().Dictionary();
        lastASFLAGS     = context.env.get('ASFLAGS', '');
        lastCCFLAGS     = context.env.get('CCFLAGS', '');
        lastCFLAGS      = context.env.get('CFLAGS', '');
        lastCPPDEFINES  = context.env.get('CPPDEFINES', '');
        lastCPPFLAGS    = context.env.get('CPPFLAGS', '');
        lastCPPPATH     = context.env.get('CPPPATH', '');
        lastLIBPATH     = context.env.get('LIBPATH', '');
        lastLIBS        = context.env.get('LIBS', '');
        lastLINKFLAGS   = context.env.get('LINKFLAGS', '');
        lastRPATH       = context.env.get('RPATH', '');
	context.env.MergeFlags(env['SNMP_FLAGS']);
	result = context.TryLink("""
int main(int argc, char**argv)
{
	init_agent("PGM");
	return 0;
}
""", '.c');
#       context.env.Replace(**backup);
        context.env.Replace(ASFLAGS     = lastASFLAGS,
                            CCFLAGS     = lastCCFLAGS,
                            CFLAGS      = lastCFLAGS,
                            CPPDEFINES  = lastCPPDEFINES,
                            CPPFLAGS    = lastCPPFLAGS,
                            CPPPATH     = lastCPPPATH,
                            LIBPATH     = lastLIBPATH,
                            LIBS        = lastLIBS,
                            LINKFLAGS   = lastLINKFLAGS,
                            RPATH       = lastRPATH);
	context.Result(not result);
	return result;

def CheckCheck(context):
	context.Message('Checking Check unit test framework...');
	result = context.TryAction('pkg-config --cflags --libs check')[0];
	context.Result(result);
	return result;

tests = {
	'CheckCheck':	CheckCheck
}
if env['WITH_SNMP'] == 'true':
	tests['CheckSNMP'] = CheckSNMP;
conf = Configure(env, custom_tests = tests);

if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP():
	print 'Net-SNMP libraries not compatible.';
	Exit(1);

if env['WITH_CHECK'] == 'true' and conf.CheckCheck():
	print 'Enabling Check unit tests.';
	conf.env['CHECK'] = 'true';
	env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check');
else:
	print 'Disabling Check unit tests.';
	conf.env['CHECK'] = 'false';

env = conf.Finish();

# add builder to create PIC static libraries for including in shared libraries
action_list = [ Action("$ARCOM", "$ARCOMSTR") ];
if env.Detect('ranlib'):
	ranlib_action = Action("$RANLIBCOM", "$RANLIBCOMSTR");
	action_list.append(ranlib_action);
pic_lib = Builder(	action = action_list,
			emitter = '$LIBEMITTER',
			prefix = '$LIBPREFIX',
			suffix = '$LIBSUFFIX',
			src_suffix = '$OBJSUFFIX',
			src_builder = 'SharedObject')
env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib});


#-----------------------------------------------------------------------------

ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '-sunstudio/';
BuildDir(ref_node, '.', duplicate=0)

env.Append(CPPPATH = os.getcwd() + '/include');
env.Append(LIBPATH = os.getcwd() + '/' + ref_node);

if env['WITH_GLIB'] == 'true':
	SConscript(ref_node + 'SConscript.libpgmex');
SConscript(ref_node + 'SConscript.libpgm');
if env['WITH_HTTP'] == 'true':
	SConscript(ref_node + 'SConscript.libpgmhttp');
if env['WITH_SNMP'] == 'true':
	SConscript(ref_node + 'SConscript.libpgmsnmp');
if env['WITH_TEST'] == 'true':
	SConscript(ref_node + 'test/SConscript');
if env['WITH_EXAMPLES'] == 'true':
	SConscript(ref_node + 'examples/SConscript');

# end of file
libpgm-5.1.118-1~dfsg/openpgm/pgm/if_unittest.c0000644000175000017500000015612311640407354020254 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * unit tests for network interface declaration parsing.
 *
 * CAUTION: Assumes host is IPv4 by default for AF_UNSPEC
 *
 * Copyright (c) 2009-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/* IFF_UP */
#ifndef _BSD_SOURCE
#	define _BSD_SOURCE	1
#endif
/* GNU gai_strerror_r */
#ifndef _GNU_SOURCE
#	define _GNU_SOURCE	1
#endif

#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#else
#	include 
#	include 
#endif
#include 
#include 
#include 
#include 


/* mock state */

struct mock_host_t {
	struct sockaddr_storage	address;
	char*			canonical_hostname;
	char*			alias;
};

struct mock_network_t {
	char*			name;
	struct sockaddr_storage	number;
	char**			aliases;
};

struct mock_interface_t {
	unsigned int		index;
	char*			name;
	unsigned int		flags;
	struct sockaddr_storage	addr;
	struct sockaddr_storage	netmask;
};

static GList *mock_hosts = NULL, *mock_networks = NULL, *mock_interfaces = NULL;

#define MOCK_HOSTNAME		"kiku"
#define MOCK_HOSTNAME6		"ip6-kiku"		/* ping6 doesn't work on fe80:: */
#define MOCK_NETWORK		"private"		/* /etc/networks */
#define MOCK_NETWORK6		"ip6-private"
#define MOCK_PGM_NETWORK	"pgm-private"
#define MOCK_PGM_NETWORK6	"ip6-pgm-private"
#define MOCK_INTERFACE		"eth0"
#define MOCK_INTERFACE_INDEX	2
#define MOCK_ADDRESS		"10.6.28.33"
#define MOCK_GROUP		((long) 0xefc00001) /* 239.192.0.1 */
#define MOCK_GROUP6_INIT	{ { { 0xff,8,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }	/* ff08::1 */
static const struct in6_addr mock_group6_addr = MOCK_GROUP6_INIT;
#define MOCK_ADDRESS6		"2002:dce8:d28e::33"
#define MOCK_ADDRESS6_INIT	{ { { 0x20,2,0xdc,0xe8,0xd2,0x8e,0,0,0,0,0,0,0,0,0,0x33 } } }
static const struct in6_addr mock_address6_addr = MOCK_ADDRESS6_INIT;

static int mock_family =	0;
static char* mock_kiku =	MOCK_HOSTNAME;
static char* mock_localhost =	"localhost";
static char* mock_invalid =	"invalid.invalid";		/* RFC 2606 */
static char* mock_toolong =	"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij12345"; /* 65 */
static char* mock_hostname =	NULL;

struct pgm_ifaddrs_t;
struct pgm_error_t;

bool mock_pgm_getifaddrs (struct pgm_ifaddrs_t**, struct pgm_error_t**);
void mock_pgm_freeifaddrs (struct pgm_ifaddrs_t*);
unsigned mock_pgm_if_nametoindex (const sa_family_t, const char*);
char* mock_if_indextoname (unsigned int, char*);
int mock_getnameinfo (const struct sockaddr*, socklen_t, char*, size_t, char*, size_t, int);
int mock_getaddrinfo (const char*, const char*, const struct addrinfo*, struct addrinfo**);
void mock_freeaddrinfo (struct addrinfo*);
int mock_gethostname (char*, size_t);
struct pgm_netent_t* mock_pgm_getnetbyname (const char*);
PGM_GNUC_INTERNAL bool mock_pgm_if_getnodeaddr (const sa_family_t, struct sockaddr*restrict, const socklen_t, struct pgm_error_t**restrict);


#define pgm_getifaddrs		mock_pgm_getifaddrs
#define pgm_freeifaddrs		mock_pgm_freeifaddrs
#define pgm_if_nametoindex	mock_pgm_if_nametoindex
#define if_indextoname		mock_if_indextoname
#define getnameinfo		mock_getnameinfo
#define getaddrinfo		mock_getaddrinfo
#define freeaddrinfo		mock_freeaddrinfo
#define gethostname		mock_gethostname
#define pgm_getnetbyname	mock_pgm_getnetbyname
#define pgm_if_getnodeaddr	mock_pgm_if_getnodeaddr


#define IF_DEBUG
#include "if.c"


static
gpointer
create_host (
	const char*	address,
	const char*	canonical_hostname,
	const char*	alias
	)
{
	struct mock_host_t* new_host;

	g_assert (address);
	g_assert (canonical_hostname);

	new_host = g_slice_alloc0 (sizeof(struct mock_host_t));
	g_assert (pgm_sockaddr_pton (address, (struct sockaddr*)&new_host->address));
	new_host->canonical_hostname = g_strdup (canonical_hostname);
	new_host->alias = alias ? g_strdup (alias) : NULL;

	return new_host;
}

static
gpointer
create_network (
	const char*	name,
	const char*	number
	)
{
	struct mock_network_t* new_network;

	g_assert (name);
	g_assert (number);

	new_network = g_slice_alloc0 (sizeof(struct mock_network_t));
	new_network->name = g_strdup (name);
	g_assert (pgm_sockaddr_pton (number, (struct sockaddr*)&new_network->number));

	return new_network;
}

static
gpointer
create_interface (
	const unsigned	index,
	const char*	name,
	const char*	flags
	)
{
	struct mock_interface_t* new_interface;

	g_assert (name);
	g_assert (flags);

	new_interface = g_slice_alloc0 (sizeof(struct mock_interface_t));
	new_interface->index = index;
	new_interface->name = g_strdup (name);

	struct sockaddr_in* sin = (gpointer)&new_interface->addr;
	struct sockaddr_in6* sin6 = (gpointer)&new_interface->addr;

	gchar** tokens = g_strsplit (flags, ",", 0);
	for (guint i = 0; tokens[i]; i++)
	{
		if (strcmp (tokens[i], "up") == 0)
			new_interface->flags |= IFF_UP;
		else if (strcmp (tokens[i], "down") == 0)
			new_interface->flags |= 0;
		else if (strcmp (tokens[i], "loop") == 0)
			new_interface->flags |= IFF_LOOPBACK;
		else if (strcmp (tokens[i], "broadcast") == 0)
			new_interface->flags |= IFF_BROADCAST;
		else if (strcmp (tokens[i], "multicast") == 0)
			new_interface->flags |= IFF_MULTICAST;
		else if (strncmp (tokens[i], "ip=", strlen("ip=")) == 0) {
			const char* addr = tokens[i] + strlen("ip=");
			g_assert (pgm_sockaddr_pton (addr, (struct sockaddr*)&new_interface->addr));
		}
		else if (strncmp (tokens[i], "netmask=", strlen("netmask=")) == 0) {
			const char* addr = tokens[i] + strlen("netmask=");
			g_assert (pgm_sockaddr_pton (addr, (struct sockaddr*)&new_interface->netmask));
		}
		else if (strncmp (tokens[i], "scope=", strlen("scope=")) == 0) {
			const char* scope = tokens[i] + strlen("scope=");
			g_assert (AF_INET6 == ((struct sockaddr*)&new_interface->addr)->sa_family);
			((struct sockaddr_in6*)&new_interface->addr)->sin6_scope_id = atoi (scope);
		}
		else
			g_error ("parsing failed for flag %s%s%s",
				tokens[i] ? "\"" : "", tokens[i] ? tokens[i] : "(null)", tokens[i] ? "\"" : "");
	}
			
	g_strfreev (tokens);
	return new_interface;
}

#define APPEND_HOST2(a,b,c)	\
		do { \
			gpointer data = create_host ((a), (b), (c)); \
			g_assert (data); \
			mock_hosts = g_list_append (mock_hosts, data); \
			g_assert (mock_hosts); g_assert (mock_hosts->data); \
		} while (0)
#define APPEND_HOST(a,b)	APPEND_HOST2((a),(b),NULL)
#define APPEND_NETWORK(a,b)	\
		do { \
			gpointer data = create_network ((a), (b)); \
			g_assert (data); \
			mock_networks = g_list_append (mock_networks, data); \
			g_assert (mock_networks); g_assert (mock_networks->data); \
		} while (0)
#define APPEND_INTERFACE(a,b,c)	\
		do { \
			gpointer data = create_interface ((a), (b), (c)); \
			g_assert (data); \
			mock_interfaces = g_list_append (mock_interfaces, data); \
			g_assert (mock_interfaces); g_assert (mock_interfaces->data); \
		} while (0)
static
void
mock_setup_net (void)
{
	mock_hostname = mock_kiku;

	APPEND_HOST (	"127.0.0.1",		"localhost");
	APPEND_HOST2(	"10.6.28.33",		"kiku.hk.miru.hk",	"kiku");
	APPEND_HOST2(	"2002:dce8:d28e::33",	"ip6-kiku",		"kiku");
	APPEND_HOST2(	"172.12.90.1",		"mi-hee.ko.miru.hk",	"mi-hee");
	APPEND_HOST2(	"::1",			"ip6-localhost",	"ip6-loopback");
	APPEND_HOST (	"239.192.0.1",		"PGM.MCAST.NET");
	APPEND_HOST (	"ff08::1",		"IP6-PGM.MCAST.NET");

	APPEND_NETWORK(	"loopback",	"127.0.0.0");
	APPEND_NETWORK(	"private",	"10.6.28.0");
	APPEND_NETWORK(	"private2",	"172.16.90.0");
#ifndef CONFIG_HAVE_GETNETENT
	APPEND_NETWORK( "pgm-private",	"239.192.0.1");
	APPEND_NETWORK(	"ip6-private",	"2002:dce8:d28e::");
	APPEND_NETWORK( "ip6-pgm-private","ff08::1");
#endif

	APPEND_INTERFACE(	1,	"lo",	"up,loop");
	APPEND_INTERFACE(	2,	"eth0",	"up,broadcast,multicast");
	APPEND_INTERFACE(	3,	"eth1",	"down,broadcast,multicast");
	APPEND_INTERFACE(	1,	"lo",	"up,loop,ip=127.0.0.1,netmask=255.0.0.0");
	APPEND_INTERFACE(	2,	"eth0",	"up,broadcast,multicast,ip=10.6.28.33,netmask=255.255.255.0");
	APPEND_INTERFACE(	1,	"lo",	"up,loop,ip=::1,netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,scope=0");
	APPEND_INTERFACE(	2,	"eth0",	"up,broadcast,multicast,ip=2002:dce8:d28e::33,netmask=ffff:ffff:ffff:ffff::0,scope=0");
	APPEND_INTERFACE(	2,	"eth0",	"up,broadcast,multicast,ip=fe80::214:5eff:febd:6dda,netmask=ffff:ffff:ffff:ffff::0,scope=2");
}

static
void
mock_teardown_net (void)
{
	GList* list;

/* rollback APPEND_HOST */
	list = mock_hosts;
	while (list) {
		struct mock_host_t* host = list->data;
		g_free (host->canonical_hostname);
		host->canonical_hostname = NULL;
		if (host->alias) {
			g_free (host->alias);
			host->alias = NULL;
		}
		g_slice_free1 (sizeof(struct mock_host_t), host);
		list->data = NULL;
		list = list->next;
	}
	g_list_free (mock_hosts);
	mock_hosts = NULL;

/* rollback APPEND_NETWORK */
	list = mock_networks;
	while (list) {
		struct mock_network_t* network = list->data;
		g_free (network->name);
		network->name = NULL;
		g_slice_free1 (sizeof(struct mock_network_t), network);
		list->data = NULL;
		list = list->next;
	}
	g_list_free (mock_networks);
	mock_networks = NULL;

/* rollback APPEND_INTERFACE */
	list = mock_interfaces;
	while (list) {
		struct mock_interface_t* interface_ = list->data;
		g_free (interface_->name);
		interface_->name = NULL;
		g_slice_free1 (sizeof(struct mock_interface_t), interface_);
		list->data = NULL;
		list = list->next;
	}
	g_list_free (mock_interfaces);
	mock_interfaces = NULL;

	mock_hostname = NULL;
}

/* mock functions for external references */

size_t
pgm_transport_pkt_offset2 (
        const bool                      can_fragment,
        const bool                      use_pgmcc
        )
{
        return 0;
}

PGM_GNUC_INTERNAL
int
pgm_get_nprocs (void)
{
	return 1;
}

bool
mock_pgm_getifaddrs (
	struct pgm_ifaddrs_t**	ifap,
	pgm_error_t**		err
	)
{
	if (NULL == ifap) {
		return -1;
	}

	g_debug ("mock_getifaddrs (ifap:%p err:%p)", (gpointer)ifap, (gpointer)err);

	GList* list = mock_interfaces;
	int n = g_list_length (list);
	struct pgm_ifaddrs_t* ifa = calloc (n, sizeof(struct pgm_ifaddrs_t));
	struct pgm_ifaddrs_t* ift = ifa;
	while (list) {
		struct mock_interface_t* interface_ = list->data;
		ift->ifa_addr = (gpointer)&interface_->addr;
		ift->ifa_name = interface_->name;
		ift->ifa_flags = interface_->flags;
		ift->ifa_netmask = (gpointer)&interface_->netmask;
		list = list->next;
		if (list) {
			ift->ifa_next = ift + 1;
			ift = ift->ifa_next;
		}
	}

	*ifap = ifa;
	return TRUE;
}

void
mock_pgm_freeifaddrs (
	struct pgm_ifaddrs_t*		ifa
	)
{
	free (ifa);
}

unsigned
mock_pgm_if_nametoindex (
	const sa_family_t	iffamily,
	const char*		ifname
	)
{
	GList* list = mock_interfaces;
	while (list) {
		const struct mock_interface_t* interface_ = list->data;
		if (0 == strcmp (ifname, interface_->name))
			return interface_->index;
		list = list->next;
	}
	return 0;
}

char*
mock_if_indextoname (
	unsigned		ifindex,
	char*			ifname
	)
{
	GList* list = mock_interfaces;
	while (list) {
		const struct mock_interface_t* interface_ = list->data;
		if (interface_->index == ifindex) {
			strcpy (ifname, interface_->name);
			return ifname;
		}
		list = list->next;
	}
	errno = ENXIO;
	return NULL;
}

int
mock_getnameinfo (
	const struct sockaddr*	sa,
	socklen_t		salen,
	char*			host,
	size_t			hostlen,
	char*			serv,
	size_t			servlen,
	int			flags
	)
{
	if ((0 == hostlen && 0 == servlen) ||
            (NULL == host && NULL == serv))
		return EAI_NONAME;

	if (flags & NI_NUMERICHOST && flags & NI_NAMEREQD)
		return EAI_BADFLAGS;

/* pre-conditions */
	g_assert (NULL != host);
	g_assert (hostlen > 0);
	g_assert (NULL == serv);
	g_assert (0 == servlen);

	const int sa_family = sa->sa_family;

	if (AF_INET == sa_family)
		g_assert (sizeof(struct sockaddr_in) == salen);
	else {
		g_assert (AF_INET6 == sa_family);
		g_assert (sizeof(struct sockaddr_in6) == salen);
	}

	if (!(flags & NI_NUMERICHOST))
	{
		GList* list = mock_hosts;
		while (list) {
			const struct mock_host_t* _host = list->data;
			const int host_family = ((struct sockaddr*)&_host->address)->sa_family;
			const size_t host_len = AF_INET == host_family ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);

			if (host_family == sa_family &&
			    host_len == salen &&
			    0 == memcmp (sa, &_host->address, salen))
			{
				if (hostlen < (1 + strlen(_host->canonical_hostname)))
#ifdef EAI_OVERFLOW
					return EAI_OVERFLOW;
#else
					return EAI_MEMORY;
#endif
				strncpy (host, _host->canonical_hostname, hostlen);
				return 0;
			}
			list = list->next;
		}

		if (flags & NI_NAMEREQD)
			return EAI_NONAME;
	}

	if (AF_INET == sa_family) 
		pgm_inet_ntop (sa_family, &((const struct sockaddr_in*)sa)->sin_addr, host, hostlen);
	else {
		const unsigned scope = ((const struct sockaddr_in6*)sa)->sin6_scope_id;
		pgm_inet_ntop (sa_family, &((const struct sockaddr_in6*)sa)->sin6_addr, host, hostlen);
		if (scope) {
			char buffer[1+IF_NAMESIZE];
			strcat (host, "%");
			strcat (host, mock_if_indextoname (scope, buffer));
		}
	}
	return 0;
}

int
mock_getaddrinfo (
	const char*		node,
	const char*		service,
	const struct addrinfo*	hints,
	struct addrinfo**	res
	)
{
#ifdef AI_V4MAPPED
	const int ai_flags  = hints ? hints->ai_flags  : (AI_V4MAPPED | AI_ADDRCONFIG);
#else
	const int ai_flags  = hints ? hints->ai_flags  : (AI_ADDRCONFIG);
#endif
	const int ai_family = hints ? hints->ai_family : AF_UNSPEC;
	GList* list;
	struct sockaddr_storage addr;

	if (NULL == node && NULL == service)
		return EAI_NONAME;

/* pre-conditions */
	g_assert (NULL != node);
	g_assert (NULL == service);
	g_assert (!(ai_flags & AI_CANONNAME));
#ifdef AI_NUMERICSERV
	g_assert (!(ai_flags & AI_NUMERICSERV));
#endif
#ifdef AI_V4MAPPED
	g_assert (!(ai_flags & AI_V4MAPPED));
#endif

	g_message ("mock_getaddrinfo (node:%s%s%s service:%s%s%s hints:%p res:%p)",
		node ? "\"" : "", node ? node : "(null)", node ? "\"" : "",
		service ? "\"" : "", service ? service : "(null)", service ? "\"" : "",
		(gpointer)hints,
		(gpointer)res);

	gboolean has_ip4_config;
	gboolean has_ip6_config;

	if (hints && hints->ai_flags & AI_ADDRCONFIG)
	{
		has_ip4_config = has_ip6_config = FALSE;
		list = mock_interfaces;
		while (list) {
			const struct mock_interface_t* interface_ = list->data;
			if (AF_INET == ((struct sockaddr*)&interface_->addr)->sa_family)
				has_ip4_config = TRUE;
			else if (AF_INET6 == ((struct sockaddr*)&interface_->addr)->sa_family)
				has_ip6_config = TRUE;
			if (has_ip4_config && has_ip6_config)
				break;
			list = list->next;
		}
	} else {
		has_ip4_config = has_ip6_config = TRUE;
	}

	if (ai_flags & AI_NUMERICHOST) {
		pgm_sockaddr_pton (node, (struct sockaddr*)&addr);
	}
	list = mock_hosts;
	while (list) {
		struct mock_host_t* host = list->data;
		const int host_family = ((struct sockaddr*)&host->address)->sa_family;
		if (((strcmp (host->canonical_hostname, node) == 0) ||
		     (host->alias && strcmp (host->alias, node) == 0) || 
		     (ai_flags & AI_NUMERICHOST &&
		      0 == pgm_sockaddr_cmp ((struct sockaddr*)&addr, (struct sockaddr*)&host->address)))
		     &&
		    (host_family == ai_family || AF_UNSPEC == ai_family) &&
		    ((AF_INET == host_family && has_ip4_config) || (AF_INET6 == host_family && has_ip6_config)))
		{
			struct addrinfo* ai = malloc (sizeof(struct addrinfo));
			memset (ai, 0, sizeof(struct addrinfo));
			ai->ai_family = host_family;
			ai->ai_addrlen = AF_INET == host_family ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
			ai->ai_addr = (gpointer)&host->address;
			*res = ai;
			return 0;
		}
		list = list->next;
	}
	return EAI_NONAME;
}

void
mock_freeaddrinfo (
	struct addrinfo*	res
	)
{
	free (res);
}

int
mock_gethostname (
	char*			name,
	size_t			len
	)
{
	if (NULL == name) {
		errno = EFAULT;
		return -1;
	}
	if (len < 0) {
		errno = EINVAL;
		return -1;
	}
	if (len < (1 + strlen (mock_hostname))) {
		errno = ENAMETOOLONG;
		return -1;
	}
/* force an error */
	if (mock_hostname == mock_toolong) {
		errno = ENAMETOOLONG;
		return -1;
	}
	strncpy (name, mock_hostname, len);
	if (len > 0)
		name[len - 1] = '\0';
	return 0;
}

struct pgm_netent_t*
mock_pgm_getnetbyname (
	const char*		name
	)
{
	static struct pgm_netent_t ne;
	GList* list = mock_networks;

	if (NULL == name)
		return NULL;

	while (list) {
		const struct mock_network_t* network = list->data;
		if (strcmp (network->name, name) == 0) {
			ne.n_name	= network->name;
			ne.n_aliases	= network->aliases;
			if (AF_INET == network->number.ss_family) {
				struct sockaddr_in sa;
				memset (&sa, 0, sizeof (sa));
				sa.sin_family = network->number.ss_family;
				sa.sin_addr.s_addr = g_ntohl (((struct sockaddr_in*)&network->number)->sin_addr.s_addr);
				memcpy (&ne.n_net, &sa, sizeof (sa));
			} else {
				struct sockaddr_in6 sa6;
				memset (&sa6, 0, sizeof (sa6));
				sa6.sin6_family = network->number.ss_family;
				sa6.sin6_addr = ((struct sockaddr_in6*)&network->number)->sin6_addr;
				memcpy (&ne.n_net, &sa6, sizeof (sa6));
			}
			return ≠
		}
		list = list->next;
	}
	return NULL;
}

PGM_GNUC_INTERNAL
bool
mock_pgm_if_getnodeaddr (
	const sa_family_t	family,
	struct sockaddr*	addr,
	const socklen_t		cnt,
	pgm_error_t**		error
	)
{
	switch (family) {
	case AF_UNSPEC:
	case AF_INET:
		((struct sockaddr*)addr)->sa_family = AF_INET;
		((struct sockaddr_in*)addr)->sin_addr.s_addr = inet_addr(MOCK_ADDRESS);
		break;
	case AF_INET6:
		((struct sockaddr*)addr)->sa_family = AF_INET6;
		((struct sockaddr_in6*)addr)->sin6_addr = mock_address6_addr;
		break;
	default:
		g_assert_not_reached();
	}
	return TRUE;
}

/* following tests will use AF_UNSPEC address family */

static
void
mock_setup_unspec (void)
{
	mock_family = AF_UNSPEC;
}

/* following tests will use AF_INET address family */

static
void
mock_setup_ip4 (void)
{
	mock_family = AF_INET;
}

/* following tests will use AF_INET6 address family */

static
void
mock_setup_ip6 (void)
{
	mock_family = AF_INET6;
}


/* return 0 if gsr multicast group does not match the default PGM group for
 * the address family, return -1 on no match.
 */

static
gboolean
match_default_group (
	const int			ai_family,
	const struct group_source_req*	gsr
	)
{
	const struct sockaddr_in sa_default = {
		.sin_family	 = AF_INET,
		.sin_addr.s_addr = g_htonl (MOCK_GROUP)
	};
	const struct sockaddr_in6 sa6_default = {
		.sin6_family	 = AF_INET6,
		.sin6_addr	 = MOCK_GROUP6_INIT
	};
	gboolean is_match = FALSE;

	switch (ai_family) {
	case AF_UNSPEC:
	case AF_INET:
		is_match = (0 == pgm_sockaddr_cmp ((struct sockaddr*)&gsr->gsr_group, (const struct sockaddr*)&sa_default));
		if (!is_match) {
			char addr1[INET6_ADDRSTRLEN], addr2[INET6_ADDRSTRLEN];
			pgm_sockaddr_ntop ((struct sockaddr*)&gsr->gsr_group, addr1, sizeof(addr1));
			pgm_sockaddr_ntop ((struct sockaddr*)&sa_default, addr2, sizeof(addr2));
			g_message ("FALSE == cmp(%s%s%s, default-group %s%s%s)",
				addr1 ? "\"" : "", addr1 ? addr1 : "(null)", addr1 ? "\"" : "",
				addr2 ? "\"" : "", addr2 ? addr2 : "(null)", addr2 ? "\"" : "");
		}
		break;
	case AF_INET6:
		is_match = (0 == pgm_sockaddr_cmp ((struct sockaddr*)&gsr->gsr_group, (const struct sockaddr*)&sa6_default));
		if (!is_match) {
			char addr1[INET6_ADDRSTRLEN], addr2[INET6_ADDRSTRLEN];
			pgm_sockaddr_ntop ((struct sockaddr*)&gsr->gsr_group, addr1, sizeof(addr1));
			pgm_sockaddr_ntop ((struct sockaddr*)&sa6_default, addr2, sizeof(addr2));
			g_message ("FALSE == cmp(%s%s%s, default-group %s%s%s)",
				addr1 ? "\"" : "", addr1 ? addr1 : "(null)", addr1 ? "\"" : "",
				addr2 ? "\"" : "", addr2 ? addr2 : "(null)", addr2 ? "\"" : "");
		}
	default:
		break;
	}
	return is_match;
}

/* return 0 if gsr source inteface does not match the INADDR_ANY reserved
 * address, return -1 on no match.
 */

static
int
match_default_source (
	const int			ai_family,
	const struct group_source_req*	gsr
	)
{
	if (0 != gsr->gsr_interface)
		return FALSE;

/* ASM: source == group */
	return (0 == pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_group, (const struct sockaddr*)&gsr->gsr_source));
}

/* return 0 if gsr source interface does not match the hosts default interface,
 * return -1 on mismatch
 */

static
int
match_default_interface (
	const int			ai_family,
	const struct group_source_req*	gsr
	)
{
	if (MOCK_INTERFACE_INDEX != gsr->gsr_interface)
		return FALSE;

/* ASM: source == group */
	return (0 == pgm_sockaddr_cmp ((const struct sockaddr*)&gsr->gsr_group, (const struct sockaddr*)&gsr->gsr_source));
}

/* target:
 *	bool
 *	pgm_getaddrinfo (
 *		const char*				s,
 *		const struct pgm_addrinfo_t* const	hints,
 *		struct pgm_addrinfo_t**			res,
 *		pgm_error_t**				err
 *	)
 */

struct test_case_t {
	const char* ip4;
	const char* ip6;
};

#define IP4_AND_IP6(x)	x, x

static const struct test_case_t cases_001[] = {
	{ 	IP4_AND_IP6("")	},
	{ 	IP4_AND_IP6(";")	},
	{ 	IP4_AND_IP6(";;")	},
	{ "239.192.0.1",			"ff08::1"				},
	{ "239.192.0.1",			"[ff08::1]"				},
	{ ";239.192.0.1",			";ff08::1"				},
	{ ";239.192.0.1",			";[ff08::1]"				},
	{ ";239.192.0.1;239.192.0.1",		";ff08::1;ff08::1"			},
	{ ";239.192.0.1;239.192.0.1",		";[ff08::1];[ff08::1]"			},
	{ "PGM.MCAST.NET",			"IP6-PGM.MCAST.NET"			},
	{ ";PGM.MCAST.NET",			";IP6-PGM.MCAST.NET"			},
	{ ";PGM.MCAST.NET;PGM.MCAST.NET",	";IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
	{ ";239.192.0.1;PGM.MCAST.NET",		";ff08::1;IP6-PGM.MCAST.NET"		},
	{ ";239.192.0.1;PGM.MCAST.NET",		";[ff08::1];IP6-PGM.MCAST.NET"		},
	{ ";PGM.MCAST.NET;239.192.0.1",		";IP6-PGM.MCAST.NET;ff08::1"		},
	{ ";PGM.MCAST.NET;239.192.0.1",		";IP6-PGM.MCAST.NET;[ff08::1]"		},
#ifndef CONFIG_HAVE_GETNETENT
	{ "pgm-private",			/* ‡ */ "ip6-pgm-private"			},
	{ ";pgm-private",			/* ‡ */ ";ip6-pgm-private"			},
	{ ";pgm-private;pgm-private",		/* ‡ */ ";ip6-pgm-private;ip6-pgm-private" 	},
	{ ";PGM.MCAST.NET;pgm-private",		/* ‡ */ ";IP6-PGM.MCAST.NET;ip6-pgm-private" 	},
	{ ";pgm-private;PGM.MCAST.NET",		/* ‡ */ ";ip6-pgm-private;IP6-PGM.MCAST.NET" 	},
	{ ";239.192.0.1;pgm-private",		/* ‡ */ ";ff08::1;ip6-pgm-private" 		},
	{ ";239.192.0.1;pgm-private",		/* ‡ */ ";[ff08::1];ip6-pgm-private" 		},
	{ ";pgm-private;239.192.0.1",		/* ‡ */ ";ip6-pgm-private;ff08::1" 		},
	{ ";pgm-private;239.192.0.1",		/* ‡ */ ";ip6-pgm-private;[ff08::1]" 		},
#endif
};

START_TEST (test_parse_transport_pass_001)
{
	fail_unless (mock_family == AF_UNSPEC || mock_family == AF_INET || mock_family == AF_INET6, "invalid mock address family");

	const char* s = (mock_family == AF_INET6) ? cases_001[_i].ip6 : cases_001[_i].ip4;
	struct pgm_addrinfo_t hints = {
		.ai_family	= mock_family
	}, *res = NULL;
	pgm_error_t* err = NULL;

	g_message ("%i: test_parse_transport_001(%s, %s%s%s)",
		   _i,
		   (mock_family == AF_INET6) ? "AF_INET6" : ( (mock_family == AF_INET) ? "AF_INET" : "AF_UNSPEC" ),
		   s ? "\"" : "", s ? s : "(null)", s ? "\"" : "");

/* ‡ Linux does not support IPv6 /etc/networks so IPv6 entries appear as 255.255.255.255 and
 *   pgm_if_parse_transport will fail.
 */
#ifdef CONFIG_HAVE_GETNETENT
	if (NULL != strstr (s, MOCK_NETWORK6) || NULL != strstr (s, MOCK_PGM_NETWORK6))
	{
		g_message ("IPv6 exception, /etc/networks not supported on this platform.");
		return;
	}
#endif

	gboolean retval = pgm_getaddrinfo (s, &hints, &res, &err);
	if (!retval) {
		g_message ("pgm_getaddrinfo: %s",
			(err && err->message) ? err->message : "(null)");
	}
	fail_unless (TRUE == retval, "pgm_getaddrinfo failed");
	fail_if     (NULL == res, "no result");
	fail_unless (NULL == err, "error raised");

	fail_unless (1 == res->ai_recv_addrs_len, "not exactly one receive address");
	fail_unless (match_default_group (mock_family, &res->ai_recv_addrs[0]), "receive address not match default group");
	fail_unless (match_default_source (mock_family, &res->ai_recv_addrs[0]), "receive address not match default source");
	fail_unless (1 == res->ai_send_addrs_len, "not exactly one send address");
	fail_unless (match_default_group (mock_family, &res->ai_send_addrs[0]), "send address not match default group");
	fail_unless (match_default_source (mock_family, &res->ai_send_addrs[0]), "send address not match default source");
	pgm_freeaddrinfo (res);
}
END_TEST

/* interface name
 *
 * pre-condition: interface defined to match running host
 * 		  ipv4 and ipv6 hostnames are different, otherwise "" tests might go unexpected.
 */

static const struct test_case_t cases_002[] = {
	{ MOCK_INTERFACE,				/* † */ MOCK_INTERFACE		},
	{ MOCK_INTERFACE ";",				/* † */ MOCK_INTERFACE ";"		},
	{ MOCK_INTERFACE ";;",				/* † */ MOCK_INTERFACE ";;"	},
	{ MOCK_INTERFACE ";239.192.0.1",		/* † */ MOCK_INTERFACE ";ff08::1"			},
	{ MOCK_INTERFACE ";239.192.0.1",		/* † */ MOCK_INTERFACE ";[ff08::1]"			},
	{ MOCK_INTERFACE ";239.192.0.1;239.192.0.1",	/* † */ MOCK_INTERFACE ";ff08::1;ff08::1"		},
	{ MOCK_INTERFACE ";239.192.0.1;239.192.0.1",	/* † */ MOCK_INTERFACE ";[ff08::1];[ff08::1]"		},
	{ MOCK_INTERFACE ";PGM.MCAST.NET",		/* † */ MOCK_INTERFACE ";IP6-PGM.MCAST.NET"	},
	{ MOCK_INTERFACE ";PGM.MCAST.NET;PGM.MCAST.NET",/* † */ MOCK_INTERFACE ";IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
	{ MOCK_INTERFACE ";239.192.0.1;PGM.MCAST.NET",	/* † */ MOCK_INTERFACE ";ff08::1;IP6-PGM.MCAST.NET"	},
	{ MOCK_INTERFACE ";239.192.0.1;PGM.MCAST.NET",	/* † */ MOCK_INTERFACE ";[ff08::1];IP6-PGM.MCAST.NET"	},
	{ MOCK_INTERFACE ";PGM.MCAST.NET;239.192.0.1",	/* † */	MOCK_INTERFACE ";IP6-PGM.MCAST.NET;ff08::1"	},
	{ MOCK_INTERFACE ";PGM.MCAST.NET;239.192.0.1",	/* † */	MOCK_INTERFACE ";IP6-PGM.MCAST.NET;[ff08::1]"	},
#ifndef CONFIG_HAVE_GETNETENT
	{ MOCK_INTERFACE ";pgm-private",		/* ‡ */ MOCK_INTERFACE ";ip6-pgm-private" },
	{ MOCK_INTERFACE ";pgm-private;pgm-private",	/* ‡ */ MOCK_INTERFACE ";ip6-pgm-private;ip6-pgm-private" },
#endif
	{ MOCK_ADDRESS,					MOCK_ADDRESS6			},
	{ MOCK_ADDRESS,					"[" MOCK_ADDRESS6 "]"		},
	{ MOCK_ADDRESS ";",				MOCK_ADDRESS6 ";"		},
	{ MOCK_ADDRESS ";",				"[" MOCK_ADDRESS6 "];"		},
	{ MOCK_ADDRESS ";;",				MOCK_ADDRESS6 ";;"		},
	{ MOCK_ADDRESS ";;",				"[" MOCK_ADDRESS6 "];;"		},
	{ MOCK_ADDRESS ";239.192.0.1",			MOCK_ADDRESS6 ";ff08::1"			},
	{ MOCK_ADDRESS ";239.192.0.1",			"[" MOCK_ADDRESS6 "];[ff08::1]"			},
	{ MOCK_ADDRESS ";239.192.0.1;239.192.0.1",	MOCK_ADDRESS6 ";ff08::1;ff08::1"		},
	{ MOCK_ADDRESS ";239.192.0.1;239.192.0.1",	"[" MOCK_ADDRESS6 "];[ff08::1];[ff08::1]"		},
	{ MOCK_ADDRESS ";PGM.MCAST.NET",		MOCK_ADDRESS6 ";IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS ";PGM.MCAST.NET",		"[" MOCK_ADDRESS6 "];IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS ";PGM.MCAST.NET;PGM.MCAST.NET",	MOCK_ADDRESS6 ";IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS ";PGM.MCAST.NET;PGM.MCAST.NET",	"[" MOCK_ADDRESS6 "];IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS ";239.192.0.1;PGM.MCAST.NET",	MOCK_ADDRESS6 ";ff08::1;IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS ";239.192.0.1;PGM.MCAST.NET",	"[" MOCK_ADDRESS6 "];[ff08::1];IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS ";PGM.MCAST.NET;239.192.0.1",	MOCK_ADDRESS6 ";IP6-PGM.MCAST.NET;ff08::1"	},
	{ MOCK_ADDRESS ";PGM.MCAST.NET;239.192.0.1",	"[" MOCK_ADDRESS6 "];IP6-PGM.MCAST.NET;[ff08::1]"	},
#ifndef CONFIG_HAVE_GETNETENT
	{ MOCK_ADDRESS ";pgm-private",			MOCK_ADDRESS6 ";ip6-pgm-private" },
	{ MOCK_ADDRESS ";pgm-private",			"[" MOCK_ADDRESS6 "];ip6-pgm-private" },
	{ MOCK_ADDRESS ";pgm-private;pgm-private",	MOCK_ADDRESS6 ";ip6-pgm-private;ip6-pgm-private" },
	{ MOCK_ADDRESS ";pgm-private;pgm-private",	"[" MOCK_ADDRESS6 "];ip6-pgm-private;ip6-pgm-private" },
	{ MOCK_NETWORK,					/* ‡ */ MOCK_NETWORK6			},
	{ MOCK_NETWORK ";",				/* ‡ */ MOCK_NETWORK6 ";"		},
	{ MOCK_NETWORK ";;",				/* ‡ */ MOCK_NETWORK6 ";;"		},
	{ MOCK_NETWORK ";239.192.0.1",			/* ‡ */ MOCK_NETWORK6 ";ff08::1"			},
	{ MOCK_NETWORK ";239.192.0.1",			/* ‡ */ MOCK_NETWORK6 ";[ff08::1]"			},
	{ MOCK_NETWORK ";239.192.0.1;239.192.0.1",	/* ‡ */ MOCK_NETWORK6 ";ff08::1;ff08::1"		},
	{ MOCK_NETWORK ";239.192.0.1;239.192.0.1",	/* ‡ */ MOCK_NETWORK6 ";[ff08::1];[ff08::1]"		},
	{ MOCK_NETWORK ";PGM.MCAST.NET",		/* ‡ */ MOCK_NETWORK6 ";IP6-PGM.MCAST.NET"	},
	{ MOCK_NETWORK ";PGM.MCAST.NET;PGM.MCAST.NET",	/* ‡ */ MOCK_NETWORK6 ";IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
	{ MOCK_NETWORK ";239.192.0.1;PGM.MCAST.NET",	/* ‡ */ MOCK_NETWORK6 ";ff08::1;IP6-PGM.MCAST.NET"	},
	{ MOCK_NETWORK ";239.192.0.1;PGM.MCAST.NET",	/* ‡ */ MOCK_NETWORK6 ";[ff08::1];IP6-PGM.MCAST.NET"	},
	{ MOCK_NETWORK ";PGM.MCAST.NET;239.192.0.1",	/* ‡ */ MOCK_NETWORK6 ";IP6-PGM.MCAST.NET;ff08::1"	},
	{ MOCK_NETWORK ";PGM.MCAST.NET;239.192.0.1",	/* ‡ */ MOCK_NETWORK6 ";IP6-PGM.MCAST.NET;[ff08::1]"	},
	{ MOCK_NETWORK ";pgm-private",			/* ‡ */ MOCK_NETWORK6 ";ip6-pgm-private" },
	{ MOCK_NETWORK ";pgm-private;pgm-private",	/* ‡ */ MOCK_NETWORK6 ";ip6-pgm-private;ip6-pgm-private" },
#endif
	{ MOCK_HOSTNAME,				MOCK_HOSTNAME6			},
	{ MOCK_HOSTNAME ";",				MOCK_HOSTNAME6 ";"		},
	{ MOCK_HOSTNAME ";;",				MOCK_HOSTNAME6 ";;"		},
	{ MOCK_HOSTNAME ";239.192.0.1",			MOCK_HOSTNAME6 ";ff08::1"		},
	{ MOCK_HOSTNAME ";239.192.0.1",			MOCK_HOSTNAME6 ";[ff08::1]"		},
	{ MOCK_HOSTNAME ";239.192.0.1;239.192.0.1",	MOCK_HOSTNAME6 ";ff08::1;ff08::1"	},
	{ MOCK_HOSTNAME ";239.192.0.1;239.192.0.1",	MOCK_HOSTNAME6 ";[ff08::1];[ff08::1]"	},
	{ MOCK_HOSTNAME ";PGM.MCAST.NET",		MOCK_HOSTNAME6 ";IP6-PGM.MCAST.NET" },
	{ MOCK_HOSTNAME ";PGM.MCAST.NET;PGM.MCAST.NET",	MOCK_HOSTNAME6 ";IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET" },
	{ MOCK_HOSTNAME ";239.192.0.1;PGM.MCAST.NET",	MOCK_HOSTNAME6 ";ff08::1;IP6-PGM.MCAST.NET" },
	{ MOCK_HOSTNAME ";239.192.0.1;PGM.MCAST.NET",	MOCK_HOSTNAME6 ";[ff08::1];IP6-PGM.MCAST.NET" },
	{ MOCK_HOSTNAME ";PGM.MCAST.NET;239.192.0.1",	MOCK_HOSTNAME6 ";IP6-PGM.MCAST.NET;ff08::1" },
	{ MOCK_HOSTNAME ";PGM.MCAST.NET;239.192.0.1",	MOCK_HOSTNAME6 ";IP6-PGM.MCAST.NET;[ff08::1]" },
#ifndef CONFIG_HAVE_GETNETENT
	{ MOCK_HOSTNAME ";pgm-private",			MOCK_HOSTNAME6 ";ip6-pgm-private" },
	{ MOCK_HOSTNAME ";pgm-private;pgm-private",	MOCK_HOSTNAME6 ";ip6-pgm-private;ip6-pgm-private" },
#endif
};

START_TEST (test_parse_transport_pass_002)
{
	fail_unless (mock_family == AF_UNSPEC || mock_family == AF_INET || mock_family == AF_INET6, "invalid mock address family");

	const char* s = (mock_family == AF_INET6) ? cases_002[_i].ip6 : cases_002[_i].ip4;
	struct pgm_addrinfo_t hints = {
		.ai_family	= mock_family
	}, *res = NULL;
	pgm_error_t* err = NULL;

	g_message ("%i: test_parse_transport_002(%s, %s%s%s)",
		   _i,
		   (mock_family == AF_INET6) ? "AF_INET6" : ( (mock_family == AF_INET) ? "AF_INET" : "AF_UNSPEC" ),
		   s ? "\"" : "", s ? s : "(null)", s ? "\"" : "");

/* ‡ Linux does not support IPv6 /etc/networks so IPv6 entries appear as 255.255.255.255 and
 *   pgm_if_parse_transport will fail.
 */
#ifdef CONFIG_HAVE_GETNETENT
	if (NULL != strstr (s, MOCK_NETWORK6) || NULL != strstr (s, MOCK_PGM_NETWORK6))
	{
		g_message ("IPv6 exception, /etc/networks not supported on this platform.");
		return;
	}
#endif

/* † Multiple scoped IPv6 interfaces match a simple interface name network parameter and so
 *   pgm-if_parse_transport will fail finding multiple matching interfaces
 */
	if (AF_INET6 == mock_family && 0 == strncmp (s, MOCK_INTERFACE, strlen (MOCK_INTERFACE)))
	{
		g_message ("IPv6 exception, multiple scoped addresses on one interface");
		fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
		fail_unless (NULL == res, "unexpected result");
		fail_if     (NULL == err, "error not raised");
		fail_unless (PGM_ERROR_NOTUNIQ == err->code, "interfaces not found unique");
		return;
	}

	fail_unless (TRUE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (1 == res->ai_recv_addrs_len, "not exactly one receive address");
	fail_unless (match_default_group     (mock_family, &res->ai_recv_addrs[0]), "receive address not match default group");
	fail_unless (match_default_interface (mock_family, &res->ai_recv_addrs[0]), "receive address not match default interface");
	fail_unless (1 == res->ai_send_addrs_len, "not exactly one send address");
	fail_unless (match_default_group     (mock_family, &res->ai_send_addrs[0]), "send address not match default group");
	fail_unless (match_default_interface (mock_family, &res->ai_send_addrs[0]), "send address not match default interface");
	pgm_freeaddrinfo (res);
}
END_TEST

/* network to node address in bits, 8-32
 *
 * e.g. 127.0.0.1/16
 */

static const struct test_case_t cases_003[] = {
	{ MOCK_ADDRESS "/24",				MOCK_ADDRESS6 "/64"				},
	{ MOCK_ADDRESS "/24;",				MOCK_ADDRESS6 "/64;"				},
	{ MOCK_ADDRESS "/24;;",				MOCK_ADDRESS6 "/64;;"				},
	{ MOCK_ADDRESS "/24;239.192.0.1",		MOCK_ADDRESS6 "/64;ff08::1"			},
	{ MOCK_ADDRESS "/24;239.192.0.1",		MOCK_ADDRESS6 "/64;[ff08::1]"			},
	{ MOCK_ADDRESS "/24;239.192.0.1;239.192.0.1",	MOCK_ADDRESS6 "/64;ff08::1;ff08::1"		},
	{ MOCK_ADDRESS "/24;239.192.0.1;239.192.0.1",	MOCK_ADDRESS6 "/64;[ff08::1];[ff08::1]"		},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET",		MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET"		},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET;PGM.MCAST.NET",MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS "/24;239.192.0.1;PGM.MCAST.NET",	MOCK_ADDRESS6 "/64;ff08::1;IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS "/24;239.192.0.1;PGM.MCAST.NET",	MOCK_ADDRESS6 "/64;[ff08::1];IP6-PGM.MCAST.NET"	},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET;239.192.0.1",	MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET;ff08::1"	},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET;239.192.0.1",	MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET;[ff08::1]"	},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET",		MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET"		},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET;PGM.MCAST.NET",MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET;IP6-PGM.MCAST.NET"	},
#ifndef CONFIG_HAVE_GETNETENT
	{ MOCK_ADDRESS "/24;pgm-private",		/* ‡ */ MOCK_ADDRESS6 "/64;ip6-pgm-private"			},
	{ MOCK_ADDRESS "/24;pgm-private;pgm-private",	/* ‡ */ MOCK_ADDRESS6 "/64;ip6-pgm-private;ip6-pgm-private"	},
	{ MOCK_ADDRESS "/24;239.192.0.1;pgm-private",	/* ‡ */ MOCK_ADDRESS6 "/64;ff08::1;ip6-pgm-private"		},
	{ MOCK_ADDRESS "/24;239.192.0.1;pgm-private",	/* ‡ */ MOCK_ADDRESS6 "/64;[ff08::1];ip6-pgm-private"		},
	{ MOCK_ADDRESS "/24;pgm-private;239.192.0.1",	/* ‡ */ MOCK_ADDRESS6 "/64;ip6-pgm-private;ff08::1"		},
	{ MOCK_ADDRESS "/24;pgm-private;239.192.0.1",	/* ‡ */ MOCK_ADDRESS6 "/64;ip6-pgm-private;[ff08::1]"		},
	{ MOCK_ADDRESS "/24;PGM.MCAST.NET;pgm-private",	/* ‡ */ MOCK_ADDRESS6 "/64;IP6-PGM.MCAST.NET;ip6-pgm-private"	},
	{ MOCK_ADDRESS "/24;pgm-private;PGM.MCAST.NET",	/* ‡ */ MOCK_ADDRESS6 "/64;ip6-pgm-private;IP6-PGM.MCAST.NET"	},
#endif
};

START_TEST (test_parse_transport_pass_003)
{
	fail_unless (mock_family == AF_UNSPEC || mock_family == AF_INET || mock_family == AF_INET6, "invalid mock address family");

	const char* s = (mock_family == AF_INET6) ? cases_003[_i].ip6 : cases_003[_i].ip4;
	struct pgm_addrinfo_t hints = {
		.ai_family	= mock_family
	}, *res = NULL;
	pgm_error_t* err = NULL;

	g_message ("%i: test_parse_transport_003(%s, %s%s%s)",
		   _i,
		   (mock_family == AF_INET6) ? "AF_INET6" : ( (mock_family == AF_INET) ? "AF_INET" : "AF_UNSPEC" ),
		   s ? "\"" : "", s ? s : "(null)", s ? "\"" : "");

/* ‡ Linux does not support IPv6 /etc/networks so IPv6 entries appear as 255.255.255.255 and
 *   pgm_if_parse_transport will fail.
 */
#ifdef CONFIG_HAVE_GETNETENT
	if (NULL != strstr (s, MOCK_NETWORK6) || NULL != strstr (s, MOCK_PGM_NETWORK6))
	{
		g_message ("IPv6 exception, /etc/networks not supported on this platform.");
		return;
	}
#endif

	gboolean retval = pgm_getaddrinfo (s, &hints, &res, &err);
	if (!retval) {
		g_message ("pgm_getaddrinfo: %s",
			(err && err->message) ? err->message : "(null)");
	}
	fail_unless (TRUE == retval, "pgm_getaddrinfo failed");
	fail_unless (1 == res->ai_recv_addrs_len, "not exactly one receive address");
	fail_unless (match_default_group     (mock_family, &res->ai_recv_addrs[0]), "receive address not match default group");
	fail_unless (match_default_interface (mock_family, &res->ai_recv_addrs[0]), "receive address not match default interface");
	fail_unless (1 == res->ai_send_addrs_len, "not exactly one send address");
	fail_unless (match_default_group     (mock_family, &res->ai_send_addrs[0]), "send address not match default group");
	fail_unless (match_default_interface (mock_family, &res->ai_send_addrs[0]), "send address not match default interface");
	pgm_freeaddrinfo (res);
}
END_TEST

/* asymmetric groups
 */

START_TEST (test_parse_transport_pass_004)
{
	fail_unless (mock_family == AF_UNSPEC || mock_family == AF_INET || mock_family == AF_INET6, "invalid mock address family");

	const char* s = (mock_family == AF_INET6) ? ";ff08::1;ff08::2"
				       /* AF_INET */: ";239.192.56.1;239.192.56.2";
	struct pgm_addrinfo_t hints = {
		.ai_family	= mock_family
	}, *res = NULL;
	pgm_error_t* err = NULL;
	struct sockaddr_storage addr;

	fail_unless (TRUE == pgm_getaddrinfo (s, &hints, &res, &err), "get_transport_info failed");
	fail_unless (1 == res->ai_recv_addrs_len, "not exactly one receive address");
	fail_unless (1 == res->ai_send_addrs_len, "not exactly one send address");
	if (mock_family == AF_INET6)
	{
		pgm_inet_pton (AF_INET6, "ff08::1", &((struct sockaddr_in6*)&addr)->sin6_addr);
		((struct sockaddr*)&addr)->sa_family = mock_family;
		((struct sockaddr_in6*)&addr)->sin6_port = 0;
		((struct sockaddr_in6*)&addr)->sin6_flowinfo = 0;
		((struct sockaddr_in6*)&addr)->sin6_scope_id = 0;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_recv_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
		pgm_inet_pton (AF_INET6, "ff08::2", &((struct sockaddr_in6*)&addr)->sin6_addr);
		((struct sockaddr*)&addr)->sa_family = mock_family;
		((struct sockaddr_in6*)&addr)->sin6_port = 0;
		((struct sockaddr_in6*)&addr)->sin6_flowinfo = 0;
		((struct sockaddr_in6*)&addr)->sin6_scope_id = 0;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
	} else {
		pgm_inet_pton (AF_INET, "239.192.56.1", &((struct sockaddr_in*)&addr)->sin_addr);
		((struct sockaddr*)&addr)->sa_family = AF_INET;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_recv_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
		pgm_inet_pton (AF_INET, "239.192.56.2", &((struct sockaddr_in*)&addr)->sin_addr);
		((struct sockaddr*)&addr)->sa_family = AF_INET;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
	}
	fail_unless (match_default_source (mock_family, &res->ai_recv_addrs[0]), "source not match");
	fail_unless (match_default_source (mock_family, &res->ai_send_addrs[0]), "source not match");
	pgm_freeaddrinfo (res);
}
END_TEST

/* multiple receive groups and asymmetric sending
 */

START_TEST (test_parse_transport_pass_005)
{
	fail_unless (mock_family == AF_UNSPEC || mock_family == AF_INET || mock_family == AF_INET6, "invalid mock address family");

	const char* s = (mock_family == AF_INET6) ? ";ff08::1,ff08::2;ff08::3"
				       /* AF_INET */: ";239.192.56.1,239.192.56.2;239.192.56.3";
	struct pgm_addrinfo_t hints = {
		.ai_family	= mock_family
	}, *res = NULL;
	pgm_error_t* err = NULL;
	struct sockaddr_storage addr;

	fail_unless (TRUE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (2 == res->ai_recv_addrs_len, "not exactly one receive address");
	fail_unless (1 == res->ai_send_addrs_len, "not exactly one send address");
	if (mock_family == AF_INET6)
	{
		pgm_inet_pton (AF_INET6, "ff08::1", &((struct sockaddr_in6*)&addr)->sin6_addr);
		((struct sockaddr*)&addr)->sa_family = mock_family;
		((struct sockaddr_in6*)&addr)->sin6_port = 0;
		((struct sockaddr_in6*)&addr)->sin6_flowinfo = 0;
		((struct sockaddr_in6*)&addr)->sin6_scope_id = 0;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_recv_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
		pgm_inet_pton (AF_INET6, "ff08::2", &((struct sockaddr_in6*)&addr)->sin6_addr);
		((struct sockaddr*)&addr)->sa_family = mock_family;
		((struct sockaddr_in6*)&addr)->sin6_port = 0;
		((struct sockaddr_in6*)&addr)->sin6_flowinfo = 0;
		((struct sockaddr_in6*)&addr)->sin6_scope_id = 0;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_recv_addrs[1].gsr_group, (struct sockaddr*)&addr), "group not match");
		pgm_inet_pton (AF_INET6, "ff08::3", &((struct sockaddr_in6*)&addr)->sin6_addr);
		((struct sockaddr*)&addr)->sa_family = mock_family;
		((struct sockaddr_in6*)&addr)->sin6_port = 0;
		((struct sockaddr_in6*)&addr)->sin6_flowinfo = 0;
		((struct sockaddr_in6*)&addr)->sin6_scope_id = 0;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
	} else {
		pgm_inet_pton (AF_INET, "239.192.56.1", &((struct sockaddr_in*)&addr)->sin_addr);
		((struct sockaddr*)&addr)->sa_family = AF_INET;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_recv_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
		pgm_inet_pton (AF_INET, "239.192.56.2", &((struct sockaddr_in*)&addr)->sin_addr);
		((struct sockaddr*)&addr)->sa_family = AF_INET;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_recv_addrs[1].gsr_group, (struct sockaddr*)&addr), "group not match");
		pgm_inet_pton (AF_INET, "239.192.56.3", &((struct sockaddr_in*)&addr)->sin_addr);
		((struct sockaddr*)&addr)->sa_family = AF_INET;
		fail_unless (0 == pgm_sockaddr_cmp ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, (struct sockaddr*)&addr), "group not match");
	}
	fail_unless (match_default_source (mock_family, &res->ai_recv_addrs[0]), "source not match");
	fail_unless (match_default_source (mock_family, &res->ai_send_addrs[0]), "source not match");
	pgm_freeaddrinfo (res);
}
END_TEST


/* too many interfaces
 */
START_TEST (test_parse_transport_fail_001)
{
	const char* s = "eth0,lo;;;";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* invalid characters, or simply just bogus
 */
START_TEST (test_parse_transport_fail_002)
{
        const char* s = "!@#$%^&*()";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* too many groups
 */
START_TEST (test_parse_transport_fail_003)
{
        const char* s = ";239.192.0.1,239.192.0.2,239.192.0.3,239.192.0.4,239.192.0.5,239.192.0.6,239.192.0.7,239.192.0.8,239.192.0.9,239.192.0.10,239.192.0.11,239.192.0.12,239.192.0.13,239.192.0.14,239.192.0.15,239.192.0.16,239.192.0.17,239.192.0.18,239.192.0.19,239.192.0.20;239.192.0.21";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* too many receiver groups in asymmetric pairing
 */
START_TEST (test_parse_transport_fail_004)
{
        const char* s = ";239.192.0.1,239.192.0.2,239.192.0.3,239.192.0.4,239.192.0.5,239.192.0.6,239.192.0.7,239.192.0.8,239.192.0.9,239.192.0.10,239.192.0.11,239.192.0.12,239.192.0.13,239.192.0.14,239.192.0.15,239.192.0.16,239.192.0.17,239.192.0.18,239.192.0.19,239.192.0.20,239.192.0.21;239.192.0.22";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* null string
 */
START_TEST (test_parse_transport_fail_005)
{
        const char* s = NULL;
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* invalid address family
 */
START_TEST (test_parse_transport_fail_006)
{
        const char* s = ";";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_SNA
	}, *res = NULL;
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, &hints, &res, &err), "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* invalid transport info pointer
 */
START_TEST (test_parse_transport_fail_007)
{
        const char* s = ";";
	pgm_error_t* err = NULL;

	fail_unless (FALSE == pgm_getaddrinfo (s, NULL, NULL, &err), "pgm_getaddrinfo failed");
}
END_TEST

/* invalid interface
 */
START_TEST (test_parse_transport_fail_008)
{
	const char* s = "qe0;";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	gboolean retval = pgm_getaddrinfo (s, &hints, &res, &err);
	if (!retval) {
		g_message ("pgm_getaddrinfo: %s", err ? err->message : "(null)");
	}
	fail_unless (FALSE == retval, "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* non-existing interface IP address
 */
START_TEST (test_parse_transport_fail_009)
{
	const char* s = "172.16.90.1;";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	gboolean retval = pgm_getaddrinfo (s, &hints, &res, &err);
	if (!retval) {
		g_message ("pgm_getaddrinfo: %s",
			(err && err->message) ? err->message : "(null)");
	}
	fail_unless (FALSE == retval, "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* non-existing network name address
 */
START_TEST (test_parse_transport_fail_010)
{
	const char* s = "private2;";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	gboolean retval = pgm_getaddrinfo (s, &hints, &res, &err);
	if (!retval) {
		g_message ("pgm_getaddrinfo: %s",
			(err && err->message) ? err->message : "(null)");
	}
	fail_unless (FALSE == retval, "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* non-existing host name interface
 */
START_TEST (test_parse_transport_fail_011)
{
	const char* s = "mi-hee.ko.miru.hk;";
	struct pgm_addrinfo_t hints = {
		.ai_family	= AF_UNSPEC
	}, *res = NULL;
	pgm_error_t* err = NULL;

	gboolean retval = pgm_getaddrinfo (s, &hints, &res, &err);
	if (!retval) {
		g_message ("pgm_getaddrinfo: %s",
			(err && err->message) ? err->message : "(null)");
	}
	fail_unless (FALSE == retval, "pgm_getaddrinfo failed");
	fail_unless (NULL == res, "unexpected result");
}
END_TEST

/* target:
 *	pgm_if_print_all (void)
 */

START_TEST (test_print_all_pass_001)
{
	pgm_if_print_all ();
}
END_TEST


/* target:
 * 	bool
 * 	is_in_net (
 * 		const struct in_addr*	addr,		-- in host byte order
 * 		const struct in_addr*	netaddr,
 * 		const struct in_addr*	netmask
 * 		)
 */

struct test_case_net_t {
        const char* addr;
        const char* netaddr;
        const char* netmask;
	const gboolean answer;
};

static const struct test_case_net_t cases_004[] = {
	{ "127.0.0.1",		"127.0.0.1",	"255.0.0.0",		TRUE		},
	{ "127.0.0.1",		"127.0.0.1",	"255.255.0.0",		TRUE		},
	{ "127.0.0.1",		"127.0.0.1",	"255.255.255.0",	TRUE		},
	{ "127.0.0.1",		"127.0.0.1",	"255.255.255.255",	TRUE		},
	{ "127.0.0.1",		"127.0.0.0",	"255.0.0.0",		TRUE		},
	{ "127.0.0.1",		"127.0.0.0",	"255.255.0.0",		TRUE		},
	{ "127.0.0.1",		"127.0.0.0",	"255.255.255.0",	TRUE		},
	{ "127.0.0.1",		"127.0.0.0",	"255.255.255.255",	FALSE		},
	{ "172.15.1.1",		"172.16.0.0",	"255.240.0.0",		FALSE		},
	{ "172.16.1.1",		"172.16.0.0",	"255.240.0.0",		TRUE		},
	{ "172.18.1.1",		"172.16.0.0",	"255.240.0.0",		TRUE		},
	{ "172.31.1.1",		"172.16.0.0",	"255.240.0.0",		TRUE		},
	{ "172.32.1.1",		"172.16.0.0",	"255.240.0.0",		FALSE		},
};

START_TEST (test_is_in_net_pass_001)
{
	struct in_addr addr, netaddr, netmask;
	fail_unless (pgm_inet_pton (AF_INET, cases_004[_i].addr,    &addr), "inet_pton failed");
	fail_unless (pgm_inet_pton (AF_INET, cases_004[_i].netaddr, &netaddr), "inet_pton failed");
	fail_unless (pgm_inet_pton (AF_INET, cases_004[_i].netmask, &netmask), "inet_pton failed");
	const gboolean answer =		     cases_004[_i].answer;

	addr.s_addr    = g_ntohl (addr.s_addr);
	netaddr.s_addr = g_ntohl (netaddr.s_addr);
	netmask.s_addr = g_ntohl (netmask.s_addr);
	gboolean result = is_in_net (&addr, &netaddr, &netmask);

	g_message ("result %s (%s)",
		result ? "TRUE" : "FALSE",
		answer ? "TRUE" : "FALSE");

	fail_unless (answer == result, "unexpected result");
}
END_TEST

static const struct test_case_net_t cases_005[] = {
	{ "::1",			"::1",			"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",		TRUE		},
	{ "fe80::203:baff:fe4e:6cc8",	"fe80::",		"ffff:0000:0000:0000:0000:0000:0000:0000",		TRUE		},
	{ "2002:dec8:d28e::36",		"2002:dec8:d28e::",	"ffff:ffff:ffff:0000:0000:0000:0000:0000",		TRUE		},
	{ "2002:dec8:d28e::36",		"2002:dafa:939:0::",	"ffff:ffff:ffff:ffff:0000:0000:0000:0000",		FALSE		},
};

START_TEST (test_is_in_net6_pass_001)
{
	struct in6_addr addr, netaddr, netmask;
	fail_unless (pgm_inet_pton (AF_INET6, cases_005[_i].addr,    &addr), "inet_pton failed");
	fail_unless (pgm_inet_pton (AF_INET6, cases_005[_i].netaddr, &netaddr), "inet_pton failed");
	fail_unless (pgm_inet_pton (AF_INET6, cases_005[_i].netmask, &netmask), "inet_pton failed");
	const gboolean answer =		      cases_005[_i].answer;

	gboolean result = is_in_net6 (&addr, &netaddr, &netmask);

	g_message ("result %s (%s)",
		result ? "TRUE" : "FALSE",
		answer ? "TRUE" : "FALSE");

	fail_unless (answer == result, "unexpected result");
}
END_TEST



static
Suite*
make_test_suite (void)
{
	Suite* s;

	s = suite_create (__FILE__);

	TCase* tc_is_in_net = tcase_create ("is_in_net");
	suite_add_tcase (s, tc_is_in_net);
	tcase_add_checked_fixture (tc_is_in_net, mock_setup_net, mock_teardown_net);
	tcase_add_checked_fixture (tc_is_in_net, mock_setup_unspec, NULL);
	tcase_add_loop_test (tc_is_in_net, test_is_in_net_pass_001, 0, G_N_ELEMENTS(cases_004));

	TCase* tc_is_in_net6 = tcase_create ("is_in_net6");
	suite_add_tcase (s, tc_is_in_net6);
	tcase_add_checked_fixture (tc_is_in_net6, mock_setup_net, mock_teardown_net);
	tcase_add_checked_fixture (tc_is_in_net6, mock_setup_unspec, NULL);
	tcase_add_loop_test (tc_is_in_net6, test_is_in_net6_pass_001, 0, G_N_ELEMENTS(cases_005));

	TCase* tc_print_all = tcase_create ("print-all");
	tcase_add_checked_fixture (tc_print_all, mock_setup_net, mock_teardown_net);
	suite_add_tcase (s, tc_print_all);
	tcase_add_test (tc_print_all, test_print_all_pass_001);

	return s;
}

/* three variations of all parse-transport tests, one for each valid
 * address family value: AF_UNSPEC, AF_INET, AF_INET6. 
 */

static
Suite*
make_unspec_suite (void)
{
	Suite* s;

	s = suite_create ("AF_UNSPEC");

/* unspecified address family, ai_family == AF_UNSPEC */
	TCase* tc_parse_transport_unspec = tcase_create ("parse_transport/unspec");
	suite_add_tcase (s, tc_parse_transport_unspec);
	tcase_add_checked_fixture (tc_parse_transport_unspec, mock_setup_net, mock_teardown_net);
	tcase_add_checked_fixture (tc_parse_transport_unspec, mock_setup_unspec, NULL);
	tcase_add_loop_test (tc_parse_transport_unspec, test_parse_transport_pass_001, 0, G_N_ELEMENTS(cases_001));
	tcase_add_loop_test (tc_parse_transport_unspec, test_parse_transport_pass_002, 0, G_N_ELEMENTS(cases_002));
	tcase_add_loop_test (tc_parse_transport_unspec, test_parse_transport_pass_003, 0, G_N_ELEMENTS(cases_003));
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_pass_004);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_pass_005);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_001);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_002);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_003);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_004);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_005);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_006);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_007);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_008);
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_009);
#ifndef _WIN32
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_010);
#endif
	tcase_add_test (tc_parse_transport_unspec, test_parse_transport_fail_011);

	return s;
}

static
Suite*
make_af_inet_suite (void)
{
	Suite* s;

	s = suite_create ("AF_INET");

/* IP version 4, ai_family = AF_INET */
	TCase* tc_parse_transport_ip4 = tcase_create ("parse_transport/af_inet");
	suite_add_tcase (s, tc_parse_transport_ip4);
	tcase_add_checked_fixture (tc_parse_transport_ip4, mock_setup_net, mock_teardown_net);
	tcase_add_checked_fixture (tc_parse_transport_ip4, mock_setup_ip4, NULL);
	tcase_add_loop_test (tc_parse_transport_ip4, test_parse_transport_pass_001, 0, G_N_ELEMENTS(cases_001));
	tcase_add_loop_test (tc_parse_transport_ip4, test_parse_transport_pass_002, 0, G_N_ELEMENTS(cases_002));
	tcase_add_loop_test (tc_parse_transport_ip4, test_parse_transport_pass_003, 0, G_N_ELEMENTS(cases_003));
	tcase_add_test (tc_parse_transport_ip4, test_parse_transport_pass_004);
	tcase_add_test (tc_parse_transport_ip4, test_parse_transport_pass_005);

	return s;
}

static
Suite*
make_af_inet6_suite (void)
{
	Suite* s;

	s = suite_create ("AF_INET6");

/* IP version 6, ai_family = AF_INET6 */
	TCase* tc_parse_transport_ip6 = tcase_create ("parse_transport/af_inet6");
	suite_add_tcase (s, tc_parse_transport_ip6);
	tcase_add_checked_fixture (tc_parse_transport_ip6, mock_setup_net, mock_teardown_net);
	tcase_add_checked_fixture (tc_parse_transport_ip6, mock_setup_ip6, NULL);
	tcase_add_loop_test (tc_parse_transport_ip6, test_parse_transport_pass_001, 0, G_N_ELEMENTS(cases_001));
	tcase_add_loop_test (tc_parse_transport_ip6, test_parse_transport_pass_002, 0, G_N_ELEMENTS(cases_002));
	tcase_add_loop_test (tc_parse_transport_ip6, test_parse_transport_pass_003, 0, G_N_ELEMENTS(cases_003));
	tcase_add_test (tc_parse_transport_ip6, test_parse_transport_pass_004);
	tcase_add_test (tc_parse_transport_ip6, test_parse_transport_pass_005);

	TCase* tc_print_all = tcase_create ("print-all");
	tcase_add_checked_fixture (tc_print_all, mock_setup_net, mock_teardown_net);
	suite_add_tcase (s, tc_print_all);
	tcase_add_test (tc_print_all, test_print_all_pass_001);

	return s;
}

static
Suite*
make_master_suite (void)
{
	Suite* s = suite_create ("Master");
	return s;
}

int
main (void)
{
#ifdef _WIN32
	WORD wVersionRequested = MAKEWORD (2, 2);
	WSADATA wsaData;
	g_assert (0 == WSAStartup (wVersionRequested, &wsaData));
	g_assert (LOBYTE (wsaData.wVersion) == 2 && HIBYTE (wsaData.wVersion) == 2);
#endif
	pgm_messages_init();
	SRunner* sr = srunner_create (make_master_suite ());
	srunner_add_suite (sr, make_test_suite ());
	srunner_add_suite (sr, make_unspec_suite ());
	srunner_add_suite (sr, make_af_inet_suite ());
	srunner_add_suite (sr, make_af_inet6_suite ());
	srunner_run_all (sr, CK_ENV);
	int number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	pgm_messages_shutdown();
#ifdef _WIN32
	WSACleanup();
#endif
	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/timer.c.c89.patch0000644000175000017500000000225411640407354020532 0ustar  locallocal--- timer.c	2011-03-12 10:33:29.000000000 +0800
+++ timer.c89.c	2011-03-12 11:13:24.000000000 +0800
@@ -146,11 +146,13 @@
 			if (pgm_time_after_eq (now, sock->ack_expiry))
 			{
 #ifdef DEBUG_PGMCC
+{
 char nows[1024];
 time_t t = time (NULL);
 struct tm* tmp = localtime (&t);
 strftime (nows, sizeof(nows), "%Y-%m-%d %H:%M:%S", tmp);
 printf ("ACK timeout, T:%u W:%u\n", pgm_fp8tou(sock->tokens), pgm_fp8tou(sock->cwnd_size));
+}
 #endif
 				sock->tokens = sock->cwnd_size = pgm_fp8 (1);
 				sock->ack_bitmap = 0xffffffff;
@@ -164,11 +166,13 @@
 
 /* SPM broadcast */
 		pgm_mutex_lock (&sock->timer_mutex);
+		{
 		const unsigned spm_heartbeat_state = sock->spm_heartbeat_state;
 		const pgm_time_t next_heartbeat_spm = sock->next_heartbeat_spm;
 		pgm_mutex_unlock (&sock->timer_mutex);
 
 /* no lock needed on ambient */
+		{
 		const pgm_time_t next_ambient_spm = sock->next_ambient_spm;
 		pgm_time_t next_spm = spm_heartbeat_state ? MIN(next_heartbeat_spm, next_ambient_spm) : next_ambient_spm;
 
@@ -210,6 +214,8 @@
 		}
 
 		next_expiration = next_expiration > 0 ? MIN(next_expiration, next_spm) : next_spm;
+		}
+		}
 
 /* check for reset */
 		pgm_mutex_lock (&sock->timer_mutex);
libpgm-5.1.118-1~dfsg/openpgm/pgm/dlr/0000755000175000017500000000000011640407421016317 5ustar  locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/indextoname.c0000644000175000017500000000264011640407354020224 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Windows interface index to interface name function.
 *
 * Copyright (c) 2006-2011 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifdef _WIN32
#	include 
#	include 
#endif
#include 


//#define INDEXTONAME_DEBUG

PGM_GNUC_INTERNAL
char*
pgm_if_indextoname (
	unsigned int		ifindex,
	char*			ifname
        )
{
#ifndef _WIN32
	return if_indextoname (ifindex, ifname);
#else
	pgm_return_val_if_fail (NULL != ifname, NULL);

	MIB_IFROW ifRow = { .dwIndex = ifindex };
	const DWORD dwRetval = GetIfEntry (&ifRow);
	if (NO_ERROR != dwRetval)
		return NULL;
	strcpy (ifname, (char*)ifRow.wszName);
	return ifname;
#endif /* _WIN32 */
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/token and leaky bucket.txt0000644000175000017500000000036111640407354022473 0ustar  locallocalleaky bucket:

	if (BUCKET->rate_limit > BUCKET->rate_per_sec) 
		BUCKET->rate_limit = BUCKET->rate_per_sec;


token bucket:

	guint bucket_limit;

	if (BUCKET->rate_limit > BUCKET->bucket_limit)
		BUCKET->rate_limit = BUCKET->bucket_limit;
libpgm-5.1.118-1~dfsg/openpgm/pgm/rate_control.c.c89.patch0000644000175000017500000001044711640407354022110 0ustar  locallocal--- rate_control.c	2011-03-12 10:21:10.000000000 +0800
+++ rate_control.c89.c	2011-03-12 10:51:31.000000000 +0800
@@ -81,7 +81,7 @@
 	const bool		is_nonblocking
 	)
 {
-	int64_t new_major_limit, new_minor_limit;
+	ssize_t new_major_limit, new_minor_limit;
 	pgm_time_t now;
 
 /* pre-conditions */
@@ -103,7 +103,9 @@
 			if (time_since_last_rate_check > pgm_msecs(1)) 
 				new_major_limit = major_bucket->rate_per_msec;
 			else {
+#pragma warning( disable : 4244 )
 				new_major_limit = major_bucket->rate_limit + ((major_bucket->rate_per_msec * time_since_last_rate_check) / 1000UL);
+#pragma warning( default : 4244 )
 				if (new_major_limit > major_bucket->rate_per_msec)
 					new_major_limit = major_bucket->rate_per_msec;
 			}
@@ -114,7 +116,9 @@
 			if (time_since_last_rate_check > pgm_secs(1)) 
 				new_major_limit = major_bucket->rate_per_sec;
 			else {
+#pragma warning( disable : 4244 )
 				new_major_limit = major_bucket->rate_limit + ((major_bucket->rate_per_sec * time_since_last_rate_check) / 1000000UL);
+#pragma warning( default : 4244 )
 				if (new_major_limit > major_bucket->rate_per_sec)
 					new_major_limit = major_bucket->rate_per_sec;
 			}
@@ -151,7 +155,9 @@
 			if (time_since_last_rate_check > pgm_msecs(1)) 
 				new_minor_limit = minor_bucket->rate_per_msec;
 			else {
+#pragma warning( disable : 4244 )
 				new_minor_limit = minor_bucket->rate_limit + ((minor_bucket->rate_per_msec * time_since_last_rate_check) / 1000UL);
+#pragma warning( default : 4244 )
 				if (new_minor_limit > minor_bucket->rate_per_msec)
 					new_minor_limit = minor_bucket->rate_per_msec;
 			}
@@ -162,7 +168,9 @@
 			if (time_since_last_rate_check > pgm_secs(1)) 
 				new_minor_limit = minor_bucket->rate_per_sec;
 			else {
+#pragma warning( disable : 4244 )
 				new_minor_limit = minor_bucket->rate_limit + ((minor_bucket->rate_per_sec * time_since_last_rate_check) / 1000000UL);
+#pragma warning( default : 4244 )
 				if (new_minor_limit > minor_bucket->rate_per_sec)
 					new_minor_limit = minor_bucket->rate_per_sec;
 			}
@@ -209,7 +217,7 @@
 	const bool		is_nonblocking
 	)
 {
-	int64_t new_rate_limit;
+	ssize_t new_rate_limit;
 
 /* pre-conditions */
 	pgm_assert (NULL != bucket);
@@ -219,6 +227,7 @@
 		return TRUE;
 
 	pgm_spinlock_lock (&bucket->spinlock);
+	{
 	pgm_time_t now = pgm_time_update_now();
 
 	if (bucket->rate_per_msec)
@@ -227,7 +236,9 @@
 		if (time_since_last_rate_check > pgm_msecs(1)) 
 			new_rate_limit = bucket->rate_per_msec;
 		else {
+#pragma warning( disable : 4244 )
 			new_rate_limit = bucket->rate_limit + ((bucket->rate_per_msec * time_since_last_rate_check) / 1000UL);
+#pragma warning( default : 4244 )
 			if (new_rate_limit > bucket->rate_per_msec)
 				new_rate_limit = bucket->rate_per_msec;
 		}
@@ -238,7 +249,9 @@
 		if (time_since_last_rate_check > pgm_secs(1)) 
 			new_rate_limit = bucket->rate_per_sec;
 		else {
+#pragma warning( disable : 4244 )
 			new_rate_limit = bucket->rate_limit + ((bucket->rate_per_sec * time_since_last_rate_check) / 1000000UL);
+#pragma warning( default : 4244 )
 			if (new_rate_limit > bucket->rate_per_sec)
 				new_rate_limit = bucket->rate_per_sec;
 		}
@@ -264,6 +277,7 @@
 	} 
 	pgm_spinlock_unlock (&bucket->spinlock);
 	return TRUE;
+	}
 }
 
 PGM_GNUC_INTERNAL
@@ -288,12 +302,14 @@
 	{
 		pgm_spinlock_lock (&major_bucket->spinlock);
 		now = pgm_time_update_now();
+		{
 		const int64_t bucket_bytes = major_bucket->rate_limit + pgm_to_secs (major_bucket->rate_per_sec * (now - major_bucket->last_rate_check)) - n;
 
 		if (bucket_bytes < 0) {
 			const int64_t outstanding_bytes = -bucket_bytes;
 			const pgm_time_t major_remaining = (1000000UL * outstanding_bytes) / major_bucket->rate_per_sec;
-			remaining = major_remaining;
+			 remaining = major_remaining;
+		}
 		}
 	}
 	else
@@ -335,6 +351,7 @@
 		return 0;
 
 	pgm_spinlock_lock (&bucket->spinlock);
+	{
 	const pgm_time_t now = pgm_time_update_now();
 	const pgm_time_t time_since_last_rate_check = now - bucket->last_rate_check;
 	const int64_t bucket_bytes = bucket->rate_limit + pgm_to_secs (bucket->rate_per_sec * time_since_last_rate_check) - n;
@@ -343,10 +360,13 @@
 	if (bucket_bytes >= 0)
 		return 0;
 
+	{
 	const int64_t outstanding_bytes = -bucket_bytes;
 	const pgm_time_t remaining = (1000000UL * outstanding_bytes) / bucket->rate_per_sec;
 
 	return remaining;
+	}
+	}
 }
 
 /* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/0000755000175000017500000000000011640407424017357 5ustar  locallocallibpgm-5.1.118-1~dfsg/openpgm/pgm/examples/async.c0000644000175000017500000002517511640407353020653 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Asynchronous queue for receiving packets in a separate managed thread.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#	include 
#else
#	include 
#endif
#ifdef __APPLE__
#	include 
#endif
#include 

#include "async.h"


/* locals */

struct async_event_t {
	struct async_event_t   *next, *prev;
	size_t			len;
	struct pgm_sockaddr_t	addr;
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
	char			data[];
#elif defined(__cplusplus)
	char			data[1];
#else
	char			data[0];
#endif
};


static void on_data (async_t*const restrict, const void*restrict, const size_t, const struct pgm_sockaddr_t*restrict, const socklen_t);


/* queued data is stored as async_event_t objects
 */

static inline
struct async_event_t*
async_event_alloc (
	size_t			len
	)
{
	struct async_event_t* event;
	event = (struct async_event_t*)calloc (1, len + sizeof(struct async_event_t));
	event->len = len;
	return event;
}

static inline
void
async_event_unref (
        struct async_event_t* const event
        )
{
	free (event);
}

/* async_t implements a queue
 */

static inline
void
async_push_event (
	async_t*		restrict async,
	struct async_event_t*   restrict event
	)
{
	event->next = async->head;
	if (async->head)
		async->head->prev = event;
	else
		async->tail = event;
	async->head = event;
	async->length++;
}

static inline
struct async_event_t*
async_pop_event (
	async_t*		async
	)
{
	if (async->tail)
	{
		struct async_event_t *event = async->tail;

		async->tail = event->prev;
		if (async->tail)
		{
			async->tail->next = NULL;
			event->prev = NULL;
		}
		else
			async->head = NULL;
		async->length--;

		return event;
	}

	return NULL;
}

/* asynchronous receiver thread, sits in a loop processing incoming packets
 */

static
#ifndef _WIN32
void*
#else
unsigned
__stdcall
#endif
receiver_routine (
	void*		arg
	)
{
	assert (NULL != arg);
	async_t* async = (async_t*)arg;
	assert (NULL != async->sock);
#ifndef _WIN32
	int fds;
	fd_set readfds;
#else
	SOCKET recv_sock, pending_sock;
	DWORD cEvents = PGM_RECV_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ PGM_RECV_SOCKET_READ_COUNT + 1 ];
	DWORD dwTimeout, dwEvents;
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = async->destroyEvent;
	waitEvents[1] = WSACreateEvent();
	waitEvents[2] = WSACreateEvent();
	assert (2 == PGM_RECV_SOCKET_READ_COUNT);
	pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[2], FD_READ);
#endif /* !_WIN32 */

/* dispatch loop */
	do {
		struct timeval tv;
		char buffer[4096];
		size_t len;
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof (from);
		const int status = pgm_recvfrom (async->sock,
						 buffer,
						 sizeof(buffer),
						 0,
						 &len,
						 &from,
						 &fromlen,
						 NULL);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_data (async, buffer, len, &from, fromlen);
			break;
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
		case PGM_IO_STATUS_WOULD_BLOCK:
/* select for next event */
block:
#ifndef _WIN32
			fds = async->destroy_pipe[0] + 1;
			FD_ZERO(&readfds);
			FD_SET(async->destroy_pipe[0], &readfds);
			pgm_select_info (async->sock, &readfds, NULL, &fds);
			fds = select (fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#else
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.
tv_usec / 1000));
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break;
			default: break;
			}
#endif /* !_WIN32 */
			break;

		default:
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!async->is_destroyed);

/* cleanup */
#ifndef _WIN32
	return NULL;
#else
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
	_endthread();
	return 0;
#endif /* !_WIN32 */
}

/* enqueue a new data event.
 */

static
void
on_data (
	async_t*const		     restrict async,
	const void*		     restrict data,
	const size_t			      len,
	const struct pgm_sockaddr_t* restrict from,
	const socklen_t			      fromlen
	)
{
	struct async_event_t* event = async_event_alloc (len);
	memcpy (&event->addr, from, fromlen);
	memcpy (&event->data, data, len);
#ifndef _WIN32
	pthread_mutex_lock (&async->pthread_mutex);
	async_push_event (async, event);
	if (1 == async->length) {
		const char one = '1';
		const size_t writelen = write (async->notify_pipe[1], &one, sizeof(one));
		assert (sizeof(one) == writelen);
	}
	pthread_mutex_unlock (&async->pthread_mutex);
#else
	WaitForSingleObject (async->win32_mutex, INFINITE);
	async_push_event (async, event);
	if (1 == async->length) {
		WSASetEvent (async->notifyEvent);
	}
	ReleaseMutex (async->win32_mutex);
#endif /* _WIN32 */
}

/* create asynchronous thread handler from bound PGM sock.
 *
 * on success, 0 is returned.  on error, -1 is returned, and errno set appropriately.
 */

int
async_create (
	async_t**         restrict async,
	pgm_sock_t* const restrict sock
	)
{
	async_t* new_async;

	if (NULL == async || NULL == sock) {
		errno = EINVAL;
		return -1;
	}

	new_async = (async_t*)calloc (1, sizeof(async_t));
	new_async->sock = sock;
#ifndef _WIN32
	int e;
	e = pthread_mutex_init (&new_async->pthread_mutex, NULL);
	if (0 != e) goto err_destroy;
	e = pipe (new_async->notify_pipe);
	const int flags = fcntl (new_async->notify_pipe[0], F_GETFL);
	fcntl (new_async->notify_pipe[0], F_SETFL, flags | O_NONBLOCK);
	if (0 != e) goto err_destroy;
	e = pipe (new_async->destroy_pipe);
	if (0 != e) goto err_destroy;
	const int status = pthread_create (&new_async->thread, NULL, &receiver_routine, new_async);
	if (0 != status) goto err_destroy;
#else
	new_async->win32_mutex = CreateMutex (NULL, FALSE, NULL);
	new_async->notifyEvent = WSACreateEvent();
	new_async->destroyEvent = WSACreateEvent();
/* expect warning on MinGW due to lack of native uintptr_t */
	new_async->thread = (HANDLE)_beginthreadex (NULL, 0, &receiver_routine, new_async, 0, NULL);
	if (0 == new_async->thread) goto err_destroy;
#endif /* _WIN32 */

/* return new object */
	*async = new_async;
	return 0;

err_destroy:
#ifndef _WIN32
	close (new_async->destroy_pipe[0]);
	close (new_async->destroy_pipe[1]);
	close (new_async->notify_pipe[0]);
	close (new_async->notify_pipe[1]);
	pthread_mutex_destroy (&new_async->pthread_mutex);
#else
	WSACloseEvent (new_async->destroyEvent);
	WSACloseEvent (new_async->notifyEvent);
	CloseHandle (new_async->win32_mutex);
#endif /* _WIN32 */
	if (new_async)
		free (new_async);
#ifndef _WIN32
	return -1;
#else
	return INVALID_SOCKET;
#endif
}

/* Destroy asynchronous receiver, there must be no active queue consumer.
 *
 * on success, 0 is returned, on error -1 is returned and errno set appropriately.
 */

int
async_destroy (
	async_t* const	async
	)
{
	if (NULL == async || async->is_destroyed) {
		errno = EINVAL;
		return -1;
	}

	async->is_destroyed = TRUE;
#ifndef _WIN32
	const char one = '1';
	const size_t writelen = write (async->destroy_pipe[1], &one, sizeof(one));
	assert (sizeof(one) == writelen);
	pthread_join (async->thread, NULL);
	close (async->destroy_pipe[0]);
	close (async->destroy_pipe[1]);
	close (async->notify_pipe[0]);
	close (async->notify_pipe[1]);
	pthread_mutex_destroy (&async->pthread_mutex);
#else
	WSASetEvent (async->destroyEvent);
	WaitForSingleObject (async->thread, INFINITE);
	CloseHandle (async->thread);
	WSACloseEvent (async->destroyEvent);
	WSACloseEvent (async->notifyEvent);
	CloseHandle (async->win32_mutex);
#endif /* !_WIN32 */
	while (async->head) {
		struct async_event_t *next = async->head->next;
		async_event_unref (async->head);
		async->head = next;
		async->length--;
	}
	free (async);
	return 0;
}

/* synchronous reading from the queue.
 *
 * returns GIOStatus with success, error, again, or eof.
 */

ssize_t
async_recvfrom (
	async_t*  	 const restrict async,
	void*		       restrict	buf,
	size_t				len,
	struct pgm_sockaddr_t* restrict from,
	socklen_t*     	       restrict fromlen
	)
{
	struct async_event_t* event;

	if (NULL == async || NULL == buf || async->is_destroyed) {
#ifndef _WIN32
		errno = EINVAL;
		return -1;
#else
		WSASetLastError (WSAEINVAL);
		return SOCKET_ERROR;
#endif
	}

#ifndef _WIN32
	pthread_mutex_lock (&async->pthread_mutex);
	if (0 == async->length) {
/* flush event pipe */
		char tmp;
		while (sizeof(tmp) == read (async->notify_pipe[0], &tmp, sizeof(tmp)));
		pthread_mutex_unlock (&async->pthread_mutex);
		errno = EAGAIN;
		return -1;
	}
	event = async_pop_event (async);
	pthread_mutex_unlock (&async->pthread_mutex);
#else
	WaitForSingleObject (async->win32_mutex, INFINITE);
	if (0 == async->length) {
/* clear event */
		WSAResetEvent (async->notifyEvent);
		ReleaseMutex (async->win32_mutex);
		WSASetLastError (WSAEWOULDBLOCK);
		return SOCKET_ERROR;
	}
	event = async_pop_event (async);
	ReleaseMutex (async->win32_mutex);
#endif /* _WIN32 */
	assert (NULL != event);

/* pass data back to callee */
	const size_t event_len = MIN(event->len, len);
	if (NULL != from && sizeof(struct pgm_sockaddr_t) == *fromlen) {
		memcpy (from, &event->addr, *fromlen);
	}
	memcpy (buf, event->data, event_len);
	async_event_unref (event);
	return event_len;
}

ssize_t
async_recv (
	async_t* const restrict async,
	void*	       restrict buf,
	size_t			len
	)
{
	return async_recvfrom (async, buf, len, NULL, NULL);
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/getopt.c0000644000175000017500000000735011640407353021033 0ustar  locallocal/*
 * Copyright (c) 1987, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include 
#include 
#include "getopt.h"

int	opterr = 1,		/* if error message should be printed */
	optind = 1,		/* index into parent argv vector */
	optopt,			/* character checked for validity */
	optreset;		/* reset getopt */
char	*optarg;		/* argument associated with option */

#define	BADCH	(int)'?'
#define	BADARG	(int)':'
#define	EMSG	""

/*
 * getopt --
 *	Parse argc/argv argument vector.
 */
int
getopt(int nargc, char* const* nargv, const char* ostr)
{
	static char *place = EMSG;		/* option letter processing */
	char *oli;				/* option letter list index */

	if (optreset || !*place) {		/* update scanning pointer */
		optreset = 0;
		if (optind >= nargc || *(place = nargv[optind]) != '-') {
			place = EMSG;
			return (-1);
		}
		if (place[1] && *++place == '-') {	/* found "--" */
			++optind;
			place = EMSG;
			return (-1);
		}
	}					/* option letter okay? */
	if ((optopt = (int)*place++) == (int)':' ||
	    !(oli = strchr(ostr, optopt))) {
		/*
		 * if the user didn't specify '-' as an option,
		 * assume it means -1.
		 */
		if (optopt == (int)'-')
			return (-1);
		if (!*place)
			++optind;
		if (opterr && *ostr != ':' && optopt != BADCH)
			(void)fprintf(stderr, "%s: illegal option -- %c\n",
			    "progname", optopt);
		return (BADCH);
	}
	if (*++oli != ':') {			/* don't need argument */
		optarg = NULL;
		if (!*place)
			++optind;
	}
	else {					/* need an argument */
		if (*place)			/* no white space */
			optarg = place;
		else if (nargc <= ++optind) {	/* no arg */
			place = EMSG;
			if (*ostr == ':')
				return (BADARG);
			if (opterr)
				(void)fprintf(stderr,
				    "%s: option requires an argument -- %c\n",
				    "progname", optopt);
			return (BADCH);
		}
	 	else				/* white space */
			optarg = nargv[optind];
		place = EMSG;
		++optind;
	}
	return (optopt);			/* dump back option letter */
}

libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/purinrecvcc.cc0000644000175000017500000003100311640407353022207 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * プリン PGM receiver
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#	include 
#else
#	include "getopt.h"
#endif
#include 


/* globals */

static int		port = 0;
static const char*	network = "";
static bool		use_multicast_loop = FALSE;
static int		udp_encap_port = 0;

static int		max_tpdu = 1500;
static int		sqns = 100;

static bool		use_fec = FALSE;
static int		rs_k = 8;
static int		rs_n = 255;

static ip::pgm::endpoint* endpoint = NULL;
static ip::pgm::socket*	sock = NULL;
static bool		is_terminated = FALSE;

#ifndef _WIN32
static int		terminate_pipe[2];
static void on_signal (int);
#else
static WSAEVENT		terminateEvent;
static BOOL on_console_ctrl (DWORD);
#endif
#ifndef _MSC_VER
static void usage (const char*) __attribute__((__noreturn__));
#else
static void usage (const char*);
#endif

static bool on_startup (void);
static int on_data (const void*, size_t, const ip::pgm::endpoint&);


static void
usage (
	const char*	bin
	)
{
	std::cerr << "Usage: " << bin << " [options]" << std::endl;
	std::cerr << "  -n     : Multicast group or unicast IP address" << std::endl;
	std::cerr << "  -s        : IP port" << std::endl;
	std::cerr << "  -p        : Encapsulate PGM in UDP on IP port" << std::endl;
	std::cerr << "  -f        : Enable FEC with either proactive or ondemand parity" << std::endl;
	std::cerr << "  -K           : Configure Reed-Solomon code (n, k)" << std::endl;
	std::cerr << "  -N " << std::endl;
	std::cerr << "  -l              : Enable multicast loopback and address sharing" << std::endl;
	std::cerr << "  -i              : List available interfaces" << std::endl;
	exit (EXIT_SUCCESS);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	cpgm::pgm_error_t* pgm_err = NULL;

	std::setlocale (LC_ALL, "");

#if !defined(_WIN32) || defined(CONFIG_TARGET_WINE)
	std::cout << "プリン プリン" << std::endl;
#else
	std::wcout << L"プリン プリン" << std::endl;
#endif

	if (!cpgm::pgm_init (&pgm_err)) {
		std::cerr << "Unable to start PGM engine: " << pgm_err->message << std::endl;
		cpgm::pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = std::strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:f:K:N:lih")) != -1)
	{
		switch (c) {
		case 'n':	network = optarg; break;
		case 's':	port = atoi (optarg); break;
		case 'p':	udp_encap_port = atoi (optarg); break;
		case 'f':	use_fec = TRUE; break;
		case 'K':	rs_k = atoi (optarg); break;
		case 'N':	rs_n = atoi (optarg); break;
		case 'l':	use_multicast_loop = TRUE; break;

		case 'i':
			cpgm::pgm_if_print_all();
			return EXIT_SUCCESS;

		case 'h':
		case '?': usage (binary_name);
		}
	}

	if (use_fec && ( !rs_n || !rs_k )) {
		std::cerr << "Invalid Reed-Solomon parameters RS(" << rs_n << "," << rs_k << ")." << std::endl;
		usage (binary_name);
	}

/* setup signal handlers */
#ifdef SIGHUP
	std::signal (SIGHUP,  SIG_IGN);
#endif
#ifndef _WIN32
	int e = pipe (terminate_pipe);
	assert (0 == e);
	std::signal (SIGINT,  on_signal);
	std::signal (SIGTERM, on_signal);
#else
	terminateEvent = WSACreateEvent();
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif /* !_WIN32 */

	if (!on_startup()) {
		std::cerr << "Startup failed" << std::endl;
		return EXIT_FAILURE;
	}

/* dispatch loop */
#ifndef _WIN32
	int fds;
	fd_set readfds;
#else
	SOCKET recv_sock, pending_sock;
	DWORD cEvents = PGM_RECV_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ PGM_RECV_SOCKET_READ_COUNT + 1 ];
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = terminateEvent;
	sock->get_option (IPPROTO_PGM, cpgm::PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	sock->get_option (IPPROTO_PGM, cpgm::PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[2], FD_READ);
#endif /* !_WIN32 */
	std::cout << "Entering PGM message loop ... " << std::endl;
	do {
		socklen_t optlen;
		struct timeval tv;
#ifdef _WIN32
		DWORD dwTimeout, dwEvents;
#endif
		char buffer[4096];
		size_t len;
		ip::pgm::endpoint from;
		const int status = sock->receive_from (buffer,
						       sizeof(buffer),
						       0,
						       &len,
						       &from,
						       &pgm_err);
		switch (status) {
		case cpgm::PGM_IO_STATUS_NORMAL:
			on_data (buffer, len, from);
			break;
		case cpgm::PGM_IO_STATUS_TIMER_PENDING:
			optlen = sizeof (tv);
			sock->get_option (IPPROTO_PGM, cpgm::PGM_TIME_REMAIN, &tv, &optlen);
			goto block;
		case cpgm::PGM_IO_STATUS_RATE_LIMITED:
			optlen = sizeof (tv);
			sock->get_option (IPPROTO_PGM, cpgm::PGM_RATE_REMAIN, &tv, &optlen);
		case cpgm::PGM_IO_STATUS_WOULD_BLOCK:
/* select for next event */
block:
#ifndef _WIN32
			fds = terminate_pipe[0] + 1;
			FD_ZERO(&readfds);
			FD_SET(terminate_pipe[0], &readfds);
			pgm_select_info (sock->native(), &readfds, NULL, &fds);
			fds = select (fds, &readfds, NULL, NULL, cpgm::PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#else
			dwTimeout = cpgm::PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break;
			default: break;
			}
#endif /* !_WIN32 */
			break;

		default:
			if (pgm_err) {
				std::cerr << pgm_err->message << std::endl;
				cpgm::pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (cpgm::PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!is_terminated);

	std::cout << "Message loop terminated, cleaning up." << std::endl;

/* cleanup */
#ifndef _WIN32
	close (terminate_pipe[0]);
	close (terminate_pipe[1]);
#else
	WSACloseEvent (waitEvents[0]);
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
#endif /* !_WIN32 */

	if (sock) {
		std::cout << "Closing PGM socket." << std::endl;
		sock->close (TRUE);
		sock = NULL;
	}

	std::cout << "PGM engine shutdown." << std::endl;
	cpgm::pgm_shutdown ();
	std::cout << "finished." << std::endl;
	return EXIT_SUCCESS;
}

#ifndef _WIN32
static
void
on_signal (
	int		signum
	)
{
	std::cout << "on_signal (signum:" << signum << ")" << std::endl;
	is_terminated = TRUE;
	const char one = '1';
	const size_t writelen = write (terminate_pipe[1], &one, sizeof(one));
	assert (sizeof(one) == writelen);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	std::cout << "on_console_ctrl (dwCtrlType:" << dwCtrlType << ")" << std::endl;
	is_terminated = TRUE;
	WSASetEvent (terminateEvent);
	return TRUE;
}
#endif /* !_WIN32 */

static
bool
on_startup (void)
{
	struct cpgm::pgm_addrinfo_t* res = NULL;
	cpgm::pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into PGM socket address structure */
	if (!pgm_getaddrinfo (network, NULL, &res, &pgm_err)) {
		std::cerr << "Parsing network parameter: " << pgm_err->message << std::endl;
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	sock = new ip::pgm::socket();

	if (udp_encap_port) {
		std::cout << "Create PGM/UDP socket." << std::endl;
		if (!sock->open (sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			std::cerr << "Creating PGM/UDP socket: " << pgm_err->message << std::endl;
			goto err_abort;
		}
		sock->set_option (IPPROTO_PGM, cpgm::PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
	} else {
		std::cout << "Create PGM/IP socket." << std::endl;
		if (!sock->open (sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			std::cerr << "Creating PGM/IP socket: " << pgm_err->message << std::endl;
			goto err_abort;
		}
	}

	{
/* Use RFC 2113 tagging for PGM Router Assist */
		const int no_router_assist = 0;
		sock->set_option (IPPROTO_PGM, cpgm::PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));
	}

	cpgm::pgm_drop_superuser();

	{
/* set PGM parameters */
		const int recv_only = 1,
			  passive = 0,
			  peer_expiry = pgm_secs (300),
			  spmr_expiry = pgm_msecs (250),
			  nak_bo_ivl = pgm_msecs (50),
			  nak_rpt_ivl = pgm_secs (2),
			  nak_rdata_ivl = pgm_secs (2),
			  nak_data_retries = 50,
			  nak_ncf_retries = 50;

		sock->set_option (IPPROTO_PGM, cpgm::PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_PASSIVE, &passive, sizeof(passive));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_MTU, &max_tpdu, sizeof(max_tpdu));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_RXW_SQNS, &sqns, sizeof(sqns));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));
	}
	if (use_fec) {
		struct cpgm::pgm_fecinfo_t fecinfo;
		fecinfo.block_size		= rs_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= rs_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= FALSE;
		sock->set_option (IPPROTO_PGM, cpgm::PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}

/* create global session identifier */
	endpoint = new ip::pgm::endpoint (DEFAULT_DATA_DESTINATION_PORT);

/* assign socket to specified address */
	if (!sock->bind (*endpoint, &pgm_err)) {
		std::cerr << "Binding PGM socket: " << pgm_err->message << std::endl;
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		sock->set_option (IPPROTO_PGM, cpgm::PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	sock->set_option (IPPROTO_PGM, cpgm::PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

	{
/* set IP parameters */
		const int nonblocking = 1,
			  multicast_loop = use_multicast_loop ? 1 : 0,
			  multicast_hops = 16,
			  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

		sock->set_option (IPPROTO_PGM, cpgm::PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_TOS, &dscp, sizeof(dscp));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));
	}

	if (!sock->connect (&pgm_err)) {
		std::cerr << "Connecting PGM socket: " << pgm_err->message << std::endl;
		goto err_abort;
	}

	std::cout << "Startup complete." << std::endl;
	return TRUE;

err_abort:
	if (NULL != sock) {
		sock->close (FALSE);
		sock = NULL;
	}
	if (NULL != res) {
		cpgm::pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		cpgm::pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_data (
	const void*       		data,
	size_t				len,
	const ip::pgm::endpoint&	from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN(sizeof(buf) - 1, len);
	strncpy (buf, (char*)data, buflen);
	buf[buflen] = '\0';
	cpgm::pgm_tsi_print_r (from.address(), tsi, sizeof(tsi));
	std::cout << "\"" << buf << "\" (" << len << " bytes from " << tsi << ")" << std::endl;
	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/purinsend.c0000644000175000017500000002057011640407353021537 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * プリン PGM sender
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#ifndef _WIN32
#	include 
#else
#	include "getopt.h"
#endif
#ifdef __APPLE__
#	include 
#endif
#include 


/* globals */

static int		port = 0;
static const char*	network = "";
static bool		use_multicast_loop = FALSE;
static int		udp_encap_port = 0;

static int		max_tpdu = 1500;
static int		max_rte = 400*1000;		/* very conservative rate, 2.5mb/s */
static int		sqns = 100;

static bool		use_fec = FALSE;
static int		rs_k = 8;
static int		rs_n = 255;

static pgm_sock_t*	sock = NULL;

#ifndef _MSC_VER
static void usage (const char*) __attribute__((__noreturn__));
#else
static void usage (const char*);
#endif
static bool create_sock (void);


static void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options] message\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -r        : Regulate to rate bytes per second\n");
	fprintf (stderr, "  -f        : Enable FEC with either proactive or ondemand parity\n");
	fprintf (stderr, "  -K           : Configure Reed-Solomon code (n, k)\n");
	fprintf (stderr, "  -N \n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	fprintf (stderr, "  -i              : List available interfaces\n");
	exit (EXIT_SUCCESS);
}

int
main (
	int	argc,
	char   *argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	if (!pgm_init (&pgm_err)) {
		fprintf (stderr, "Unable to start PGM engine: %s\n", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
#ifdef _WIN32
	const char* binary_name = strrchr (argv[0], '\\');
#else
	const char* binary_name = strrchr (argv[0], '/');
#endif
	if (NULL == binary_name)	binary_name = argv[0];
	else				binary_name++;

	int c;
	while ((c = getopt (argc, argv, "s:n:p:r:f:K:N:lih")) != -1)
	{
		switch (c) {
		case 'n':	network = optarg; break;
		case 's':	port = atoi (optarg); break;
		case 'p':	udp_encap_port = atoi (optarg); break;
		case 'r':	max_rte = atoi (optarg); break;
		case 'f':	use_fec = TRUE; break;
		case 'K':	rs_k = atoi (optarg); break;
		case 'N':	rs_n = atoi (optarg); break;

		case 'l':	use_multicast_loop = TRUE; break;

		case 'i':
			pgm_if_print_all();
			return EXIT_SUCCESS;

		case 'h':
		case '?':
			usage (binary_name);
		}
	}

	if (use_fec && ( !rs_n || !rs_k )) {
		fprintf (stderr, "Invalid Reed-Solomon parameters RS(%d,%d).\n", rs_n, rs_k);
		usage (binary_name);
	}

	if (create_sock())
	{
		while (optind < argc) {
			const int status = pgm_send (sock, argv[optind], strlen (argv[optind]) + 1, NULL);
		        if (PGM_IO_STATUS_NORMAL != status) {
				fprintf (stderr, "pgm_send() failed.\n");
		        }
			optind++;
		}
	}

/* cleanup */
	if (sock) {
		pgm_close (sock, TRUE);
		sock = NULL;
	}
	pgm_shutdown();
	return EXIT_SUCCESS;
}

static
bool
create_sock (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into PGM socket address structure */
	if (!pgm_getaddrinfo (network, NULL, &res, &pgm_err)) {
		fprintf (stderr, "Parsing network parameter: %s\n", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (udp_encap_port) {
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			fprintf (stderr, "Creating PGM/UDP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
	} else {
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			fprintf (stderr, "Creating PGM/IP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int send_only = 1,
		  ambient_spm = pgm_secs (30),
		  heartbeat_spm[] = { pgm_msecs (100),
				      pgm_msecs (100),
                                      pgm_msecs (100),
				      pgm_msecs (100),
				      pgm_msecs (1300),
				      pgm_secs  (7),
				      pgm_secs  (16),
				      pgm_secs  (25),
				      pgm_secs  (30) };

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_ONLY, &send_only, sizeof(send_only));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu, sizeof(max_tpdu));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_TXW_SQNS, &sqns, sizeof(sqns));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &max_rte, sizeof(max_rte));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm));
	if (use_fec) {
		struct pgm_fecinfo_t fecinfo; 
		fecinfo.block_size		= rs_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= rs_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= TRUE;
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = port ? port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		fprintf (stderr, "Creating GSI: %s\n", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		fprintf (stderr, "Binding PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	unsigned i;
	for (i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int blocking = 0,
		  multicast_loop = use_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK, &blocking, sizeof(blocking));

	if (!pgm_connect (sock, &pgm_err)) {
		fprintf (stderr, "Connecting PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

	return TRUE;

err_abort:
	if (NULL != sock) {
		pgm_close (sock, FALSE);
		sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/getopt.h0000644000175000017500000000516311640407353021040 0ustar  locallocal/*      $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $    */
/*      $FreeBSD: src/include/getopt.h,v 1.1 2002/09/29 04:14:30 eric Exp $ */

/*-
 * Copyright (c) 2000 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Dieter Baron and Thomas Klausner.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _GETOPT_H_
#define _GETOPT_H_

#ifdef  __cplusplus
extern "C" {
#endif

/* These are global getopt variables */
extern int   opterr,   /* if error message should be printed */
	     optind,   /* index into parent argv vector */
	     optopt,   /* character checked for validity */
	     optreset; /* reset getopt */
extern char* optarg;   /* argument associated with option */

/* Original getopt */
int getopt (int, char*const*, const char*);

#ifdef  __cplusplus
}
#endif
 
#endif /* !_GETOPT_H_ */

libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/shortcakerecv.c0000644000175000017500000003015611640407353022374 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * ショートケーキ PGM receiver
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#else
#	include "getopt.h"
#	define snprintf		_snprintf
#endif
#ifdef __APPLE__
#	include 
#endif
#include 

#include "async.h"


/* globals */

static int		port = 0;
static const char*	network = "";
static bool		use_multicast_loop = FALSE;
static int		udp_encap_port = 0;

static int		max_tpdu = 1500;
static int		sqns = 100;

static bool		use_fec = FALSE;
static int		rs_k = 8;
static int		rs_n = 255;

static pgm_sock_t*	sock = NULL;
static async_t*		async = NULL;
static bool		is_terminated = FALSE;

#ifndef _WIN32
static int		terminate_pipe[2];
static void on_signal (int);
#else
static WSAEVENT		terminateEvent;
static BOOL on_console_ctrl (DWORD);
#endif
#ifndef _MSC_VER
static void usage (const char*) __attribute__((__noreturn__));
#else
static void usage (const char*);
#endif

static bool on_startup (void);
static int on_data (const void*restrict, const size_t, const struct pgm_sockaddr_t*restrict);


static void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -f        : Enable FEC with either proactive or ondemand parity\n");
	fprintf (stderr, "  -K           : Configure Reed-Solomon code (n, k)\n");
	fprintf (stderr, "  -N \n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	fprintf (stderr, "  -i              : List available interfaces\n");
	exit (EXIT_SUCCESS);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

#ifndef _WIN32
	puts ("いちごのショートケーキ");
#else
	puts ("ichigo no shōtokēki");
#endif

	if (!pgm_init (&pgm_err)) {
		fprintf (stderr, "Unable to start PGM engine: %s\n", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
#ifdef _WIN32
	const char* binary_name = strrchr (argv[0], '\\');
#else
	const char* binary_name = strrchr (argv[0], '/');
#endif
	if (NULL == binary_name)	binary_name = argv[0];
	else				binary_name++;

	int c;
	while ((c = getopt (argc, argv, "s:n:p:f:K:N:lih")) != -1)
	{
		switch (c) {
		case 'n':	network = optarg; break;
		case 's':	port = atoi (optarg); break;
		case 'p':	udp_encap_port = atoi (optarg); break;
		case 'f':	use_fec = TRUE; break;
		case 'K':	rs_k = atoi (optarg); break;
		case 'N':	rs_n = atoi (optarg); break;
		case 'l':	use_multicast_loop = TRUE; break;

		case 'i':
			pgm_if_print_all();
			return EXIT_SUCCESS;

		case 'h':
		case '?': usage (binary_name);
		}
	}

	if (use_fec && ( !rs_n || !rs_k )) {
		fprintf (stderr, "Invalid Reed-Solomon parameters RS(%d,%d).\n", rs_n, rs_k);
		usage (binary_name);
	}

/* setup signal handlers */
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif
#ifndef _WIN32
	int e = pipe (terminate_pipe);
	assert (0 == e);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#else
	terminateEvent = WSACreateEvent ();
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif /* !_WIN32 */

	if (!on_startup()) {
		fprintf (stderr, "Startup failed\n");
		return EXIT_FAILURE;
	}

/* dispatch loop */
#ifndef _WIN32
	int fds, read_fd = async_get_socket (async);
	fd_set readfds;
#else
	DWORD cEvents = 2;
	WSAEVENT waitEvents[ 2 ];
	DWORD dwEvents;

	waitEvents[0] = terminateEvent;
	waitEvents[1] = async_get_event (async);
#endif /* !_WIN32 */
	puts ("Entering PGM message loop ... ");
	do {
		char buffer[4096];
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof (from);
		const ssize_t len = async_recvfrom (async,
					            buffer,
					            sizeof(buffer),
					            &from,
						    &fromlen);
		if (len >= 0) {
			on_data (buffer, len, &from);
		} else {
#ifndef _WIN32
			fds = MAX(terminate_pipe[0], read_fd) + 1;
			FD_ZERO(&readfds);
			FD_SET(terminate_pipe[0], &readfds);
			FD_SET(read_fd, &readfds);
			fds = select (fds, &readfds, NULL, NULL, NULL);
#else
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, WSA_INFINITE, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			default: break;
			}
#endif /* _WIN32 */
		}
	} while (!is_terminated);

	puts ("Message loop terminated, cleaning up.");

/* cleanup */
#ifndef _WIN32
	close (terminate_pipe[0]);
	close (terminate_pipe[1]);
#else
	WSACloseEvent (terminateEvent);
#endif /* !_WIN32 */

	if (async) {
		puts ("Destroying asynchronous queue.");
		async_destroy (async);
		async = NULL;
	}

	if (sock) {
		puts ("Closing PGM socket.");
		pgm_close (sock, TRUE);
		sock = NULL;
	}

	puts ("PGM engine shutdown.");
	pgm_shutdown ();
	puts ("finished.");
	return EXIT_SUCCESS;
}

#ifndef _WIN32
static
void
on_signal (
	int		signum
	)
{
	printf ("on_signal (signum:%d)\n", signum);
	is_terminated = TRUE;
	const char one = '1';
	const size_t writelen = write (terminate_pipe[1], &one, sizeof(one));
	assert (sizeof(one) == writelen);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	printf ("on_console_ctrl (dwCtrlType:%lu)\n", (unsigned long)dwCtrlType);
	is_terminated = TRUE;
	WSASetEvent (terminateEvent);
	return TRUE;
}
#endif /* !_WIN32 */

static
bool
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into PGM socket address structure */
	if (!pgm_getaddrinfo (network, NULL, &res, &pgm_err)) {
		fprintf (stderr, "Parsing network parameter: %s\n", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	puts ("Create PGM socket.");
	if (udp_encap_port) {
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			fprintf (stderr, "Creating PGM/UDP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
	} else {
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			fprintf (stderr, "Creating PGM/IP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu, sizeof(max_tpdu));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_RXW_SQNS, &sqns, sizeof(sqns));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));
	if (use_fec) {
		struct pgm_fecinfo_t fecinfo;
		fecinfo.block_size		= rs_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= rs_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= TRUE;
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = port ? port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		fprintf (stderr, "Creating GSI: %s\n", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),        /* tx interface */
			&if_req, sizeof(if_req),        /* rx interface */
			&pgm_err))
	{
		fprintf (stderr, "Binding PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = use_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (sock, &pgm_err)) {
		fprintf (stderr, "Connecting PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

/* wrap bound socket in asynchronous queue */
	if (0 != async_create (&async, sock)) {
		fprintf (stderr, "Creating asynchronous queue failed: %s\n", strerror(errno));
		goto err_abort;
	}

	puts ("Startup complete.");
	return TRUE;

err_abort:
	if (NULL != sock) {
		pgm_close (sock, FALSE);
		sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_data (
	const void*      	     restrict data,
	const size_t		    	      len,
	const struct pgm_sockaddr_t* restrict from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN(sizeof(buf) - 1, len);
#ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT
	strncpy (buf, (const char*)data, buflen);
	buf[buflen] = '\0';
#else
	strncpy_s (buf, buflen, (const char*)data, _TRUNCATE);
#endif
	pgm_tsi_print_r (&from->sa_addr, tsi, sizeof(tsi));
#ifndef _WIN32
	printf ("\"%s\" (%zu bytes from %s)\n",
			buf, len, tsi);
#else
/* Microsoft CRT will crash on %zu */
	printf ("\"%s\" (%lu bytes from %s)\n",
			buf, (unsigned long)len, tsi);
#endif
	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/pgmping.cc0000644000175000017500000013435111640407353021337 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple send/reply ping tool using the PGM transport.
 *
 * With no arguments, one message is sent per second.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/* MSVC secure CRT */
#define _CRT_SECURE_NO_WARNINGS		1

/* c99 compatibility for c++ */
#define __STDC_LIMIT_MACROS

/* Must be first for Sun */
#include "ping.pb.h"

/* c99 compatibility for c++ */
#define __STDC_FORMAT_MACROS

#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#ifdef CONFIG_HAVE_EPOLL
#	include 
#endif
#include 
#ifndef _WIN32
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#else
#	include 
#	include 
#	include 
#	include "getopt.h"
#endif
#include 
#include 
#ifdef CONFIG_WITH_HTTP
#	include 
#endif
#ifdef CONFIG_WITH_SNMP
#	include 
#endif

#ifndef MSG_ERRQUEUE
#	define MSG_ERRQUEUE		0x2000
#endif

/* PGM internal time keeper */
extern "C" {
	typedef pgm_time_t (*pgm_time_update_func)(void);
	extern pgm_time_update_func pgm_time_update_now;
	size_t pgm_pkt_offset (bool, sa_family_t);
}

/* example dependencies */
#include 
#include 
#include 


using namespace std;


/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static int		g_udp_encap_port = 0;

static int		g_odata_rate = 0;
static int		g_odata_interval = 0;
static guint32		g_payload = 0;
static int		g_max_tpdu = 1500;
static int		g_max_rte = 16*1000*1000;
static int		g_odata_rte = 0;	/* 0 = disabled */
static int		g_rdata_rte = 0;	/* 0 = disabled */
static int		g_sqns = 200;

static gboolean		g_use_pgmcc = FALSE;
static sa_family_t	g_pgmcc_family = 0;	/* 0 = disabled */

static gboolean		g_use_fec = FALSE;
static int		g_rs_k = 8;
static int		g_rs_n = 255;

static enum {
	PGMPING_MODE_SOURCE,
	PGMPING_MODE_RECEIVER,
	PGMPING_MODE_INITIATOR,
	PGMPING_MODE_REFLECTOR
}			g_mode = PGMPING_MODE_INITIATOR;

static pgm_sock_t*	g_sock = NULL;

/* stats */
static guint64		g_msg_sent = 0;
static guint64		g_msg_received = 0;
static pgm_time_t	g_interval_start = 0;
static pgm_time_t	g_latency_current = 0;
static guint64		g_latency_seqno = 0;
static guint64		g_last_seqno = 0;
static double		g_latency_total = 0.0;
static double		g_latency_square_total = 0.0;
static guint64		g_latency_count = 0;
static double		g_latency_max = 0.0;
#ifdef INFINITY
static double		g_latency_min = INFINITY;
#else
static double		g_latency_min = (double)INT64_MAX;
#endif
static double		g_latency_running_average = 0.0;
static guint64		g_out_total = 0;
static guint64		g_in_total = 0;

#ifdef CONFIG_WITH_HEATMAP
static FILE*		g_heatmap_file = NULL;
static GHashTable*	g_heatmap_slice = NULL;		/* acting as sparse array */
static GMutex*		g_heatmap_lock = NULL;
static guint		g_heatmap_resolution = 10;	/* microseconds */
#endif

static GMainLoop*	g_loop = NULL;
static GThread*		g_sender_thread = NULL;
static GThread*		g_receiver_thread = NULL;
static gboolean		g_quit = FALSE;
#ifdef G_OS_UNIX
static int		g_quit_pipe[2];
static void on_signal (int, gpointer);
#else
static SOCKET		g_quit_socket[2];
static BOOL on_console_ctrl (DWORD);
#endif

static gboolean on_startup (gpointer);
static gboolean on_shutdown (gpointer);
static gboolean on_mark (gpointer);

static void send_odata (void);
static int on_msgv (struct pgm_msgv_t*, size_t);

static gpointer sender_thread (gpointer);
static gpointer receiver_thread (gpointer);


G_GNUC_NORETURN static void
usage (const char* bin)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
        fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -d     : Terminate transport after duration.\n");
	fprintf (stderr, "  -m   : Number of message to send per second\n");
	fprintf (stderr, "  -o              : Send-only mode (default send & receive mode)\n");
	fprintf (stderr, "  -l              : Listen-only mode\n");
	fprintf (stderr, "  -e              : Relect mode\n");
        fprintf (stderr, "  -r        : Regulate to rate bytes per second\n");
        fprintf (stderr, "  -O        : Regulate ODATA packets to rate bps\n");
        fprintf (stderr, "  -D        : Regulate RDATA packets to rate bps\n");
	fprintf (stderr, "  -c              : Enable PGMCC\n");
        fprintf (stderr, "  -f        : Enable FEC with either proactive or ondemand parity\n");
        fprintf (stderr, "  -K           : Configure Reed-Solomon code (n, k)\n");
        fprintf (stderr, "  -N \n");
#ifdef CONFIG_WITH_HEATMAP
	fprintf (stderr, "  -M    : Generate latency heap map\n");
#endif
        fprintf (stderr, "  -H              : Enable HTTP administrative interface\n");
        fprintf (stderr, "  -S              : Enable SNMP interface\n");
	exit (1);
}

int
main (
	int	argc,
	char   *argv[]
	)
{
	GError* err = NULL;
	pgm_error_t* pgm_err = NULL;
	gboolean enable_http = FALSE;
	gboolean enable_snmpx = FALSE;
	int timeout = 0;

	GOOGLE_PROTOBUF_VERIFY_VERSION;

	setlocale (LC_ALL, "");
#ifndef _WIN32
	setenv ("PGM_TIMER", "GTOD", 1);
	setenv ("PGM_SLEEP", "USLEEP", 1);
#endif

	log_init ();
	g_message ("pgmping");

	g_thread_init (NULL);

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = g_get_prgname();
	int c;
	while ((c = getopt (argc, argv, "s:n:p:m:old:r:O:D:cfeK:N:M:HSh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'r':	g_max_rte = atoi (optarg); break;
		case 'O':	g_odata_rte = atoi (optarg); break;
		case 'D':	g_rdata_rte = atoi (optarg); break;

		case 'c':	g_use_pgmcc = TRUE; break;

		case 'f':	g_use_fec = TRUE; break;
		case 'K':	g_rs_k = atoi (optarg); break;
		case 'N':	g_rs_n = atoi (optarg); break;

#ifdef CONFIG_WITH_HEATMAP
		case 'M':	g_heatmap_file = fopen (optarg, "w"); break;
#else
		case 'M':	g_warning ("Heat map support not compiled in."); break;
#endif

		case 'H':	enable_http = TRUE; break;
		case 'S':	enable_snmpx = TRUE; break;

		case 'm':	g_odata_rate = atoi (optarg);
				g_odata_interval = (1000 * 1000) / g_odata_rate; break;
		case 'd':	timeout = 1000 * atoi (optarg); break;

		case 'o':	g_mode = PGMPING_MODE_SOURCE; break;
		case 'l':	g_mode = PGMPING_MODE_RECEIVER; break;
		case 'e':	g_mode = PGMPING_MODE_REFLECTOR; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}

	if (g_use_fec && ( !g_rs_k || !g_rs_n )) {
		g_error ("Invalid Reed-Solomon parameters.");
		usage (binary_name);
	}

#ifdef CONFIG_WITH_HEATMAP
	if (NULL != g_heatmap_file) {
		g_heatmap_slice = g_hash_table_new (g_direct_hash, g_direct_equal);
		g_heatmap_lock = g_mutex_new ();
	}
#endif

#ifdef CONFIG_WITH_HTTP
	if (enable_http) {
		if (!pgm_http_init (PGM_HTTP_DEFAULT_SERVER_PORT, &pgm_err)) {
			g_error ("Unable to start HTTP interface: %s", pgm_err->message);
			pgm_error_free (pgm_err);
			pgm_shutdown ();
			return EXIT_FAILURE;
		}
	}
#endif
#ifdef CONFIG_WITH_SNMP
	if (enable_snmpx) {
		if (!pgm_snmp_init (&pgm_err)) {
			g_error ("Unable to start SNMP interface: %s", pgm_err->message);
			pgm_error_free (pgm_err);
#	ifdef CONFIG_WITH_HTTP
			if (enable_http)
				pgm_http_shutdown ();
#	endif
			pgm_shutdown ();
			return EXIT_FAILURE;
		}
	}
#endif

	g_loop = g_main_loop_new (NULL, FALSE);

/* setup signal handlers */
#ifdef G_OS_UNIX
	signal (SIGSEGV, on_sigsegv);
#	ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#	endif
	pipe (g_quit_pipe);
	pgm_signal_install (SIGINT,  on_signal, g_loop);
	pgm_signal_install (SIGTERM, on_signal, g_loop);
#else
	SOCKET s = socket (AF_INET, SOCK_STREAM, 0);
	struct sockaddr_in addr;
	int addrlen = sizeof (addr);
	memset (&addr, 0, sizeof (addr));
	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = inet_addr ("127.0.0.1");
	bind (s, (const struct sockaddr*)&addr, sizeof (addr));
	getsockname (s, (struct sockaddr*)&addr, &addrlen);
	listen (s, 1);
	g_quit_socket[1] = socket (AF_INET, SOCK_STREAM, 0);
	connect (g_quit_socket[1], (struct sockaddr*)&addr, addrlen);
	g_quit_socket[0] = accept (s, NULL, NULL);
	closesocket (s);
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif /* !G_OS_UNIX */

/* delayed startup */
	g_message ("scheduling startup.");
	g_timeout_add (0, (GSourceFunc)on_startup, g_loop);

	if (timeout) {
		g_message ("scheduling shutdown.");
		g_timeout_add (timeout, (GSourceFunc)on_shutdown, g_loop);
	}

/* dispatch loop */
	g_message ("entering main event loop ... ");
	g_main_loop_run (g_loop);

	g_message ("event loop terminated, cleaning up.");

/* cleanup */
	g_quit = TRUE;
#ifdef G_OS_UNIX
	const char one = '1';
	write (g_quit_pipe[1], &one, sizeof(one));
	if (PGMPING_MODE_SOURCE == g_mode || PGMPING_MODE_INITIATOR == g_mode)
		g_thread_join (g_sender_thread);
	g_thread_join (g_receiver_thread);
	close (g_quit_pipe[0]);
	close (g_quit_pipe[1]);
#else
	const char one = '1';
	send (g_quit_socket[1], &one, sizeof(one), 0);
	if (PGMPING_MODE_SOURCE == g_mode || PGMPING_MODE_INITIATOR == g_mode)
		g_thread_join (g_sender_thread);
	g_thread_join (g_receiver_thread);
	closesocket (g_quit_socket[0]);
	closesocket (g_quit_socket[1]);
#endif

	g_main_loop_unref (g_loop);
	g_loop = NULL;

	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

#ifdef CONFIG_WITH_HTTP
	if (enable_http)
		pgm_http_shutdown();
#endif
#ifdef CONFIG_WITH_SNMP
	if (enable_snmpx)
		pgm_snmp_shutdown();
#endif

#ifdef CONFIG_WITH_HEATMAP
	if (NULL != g_heatmap_file) {
		fclose (g_heatmap_file);
		g_heatmap_file = NULL;
		g_mutex_free (g_heatmap_lock);
		g_heatmap_lock = NULL;
		g_hash_table_destroy (g_heatmap_slice);
		g_heatmap_slice = NULL;
	}
#endif

	google::protobuf::ShutdownProtobufLibrary();

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

#ifdef G_OS_UNIX
static
void
on_signal (
	int		signum,
	gpointer	user_data
	)
{
	GMainLoop* loop = (GMainLoop*)user_data;
	g_message ("on_signal (signum:%d user-data:%p)",
		   signum, user_data);
	g_main_loop_quit (loop);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType);
	g_main_loop_quit (g_loop);
	return TRUE;
}
#endif /* !G_OS_UNIX */

static
gboolean
on_shutdown (
	gpointer	user_data
	)
{
	GMainLoop* loop = (GMainLoop*)user_data;
	g_message ("on_shutdown (user-data:%p)", user_data);
	g_main_loop_quit (loop);
	return FALSE;
}

static
gboolean
on_startup (
	gpointer	user_data
	)
{
	GMainLoop* loop = (GMainLoop*)user_data;
	struct pgm_addrinfo_t* res = NULL;
	GError* err = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;
	if (g_use_pgmcc)
		g_pgmcc_family = sa_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port))) {
			g_error ("setting PGM_UDP_ENCAP_UCAST_PORT = %d", g_udp_encap_port);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port))) {
			g_error ("setting PGM_UDP_ENCAP_MCAST_PORT = %d", g_udp_encap_port);
			goto err_abort;
		}
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	{
		const int no_router_assist = 0;
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist))) {
			g_error ("setting PGM_IP_ROUTER_ALERT = %d", no_router_assist);
			goto err_abort;
		}
	}

#ifndef CONFIG_HAVE_SCHEDPARAM
	pgm_drop_superuser();
#endif
#ifdef CONFIG_PRIORITY_CLASS
/* Any priority above normal usually yields worse performance than expected */
	if (!SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS))
	{
		g_warning ("setting priority class (%d)", GetLastError());
	}
#endif

/* set PGM parameters */
/* common */
	{
#if defined(__FreeBSD__)
/* FreeBSD defaults to low maximum socket size */
		const int txbufsize = 128 * 1024, rxbufsize = 128 * 1024,
#else
		const int txbufsize = 1024 * 1024, rxbufsize = 1024 * 1024,
#endif
			  max_tpdu = g_max_tpdu;

		if (!pgm_setsockopt (g_sock, SOL_SOCKET, SO_RCVBUF, &rxbufsize, sizeof(rxbufsize))) {
			g_error ("setting SO_RCVBUF = %d", rxbufsize);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, SOL_SOCKET, SO_SNDBUF, &txbufsize, sizeof(txbufsize))) {
			g_error ("setting SO_SNDBUF = %d", txbufsize);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &max_tpdu, sizeof(max_tpdu))) {
			g_error ("setting PGM_MTU = %d", max_tpdu);
			goto err_abort;
		}
	}

/* send side */
	if (PGMPING_MODE_SOURCE    == g_mode ||
	    PGMPING_MODE_INITIATOR == g_mode ||
	    PGMPING_MODE_REFLECTOR == g_mode    )
	{
		const int send_only	  = (PGMPING_MODE_SOURCE == g_mode) ? 1 : 0,
			  txw_sqns	  = g_sqns * 4,
			  txw_max_rte	  = g_max_rte,
			  odata_max_rte	  = g_odata_rte,
			  rdata_max_rte	  = g_rdata_rte,
			  ambient_spm	  = pgm_secs (30),
			  heartbeat_spm[] = { pgm_msecs (100),
					      pgm_msecs (100),
					      pgm_msecs (100),
					      pgm_msecs (100),
					      pgm_msecs (1300),
					      pgm_secs  (7),
					      pgm_secs  (16),
					      pgm_secs  (25),
					      pgm_secs  (30) };

		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_ONLY, &send_only, sizeof(send_only))) {
			g_error ("setting PGM_SEND_ONLY = %d", send_only);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TXW_SQNS, &txw_sqns, sizeof(txw_sqns))) {
			g_error ("setting PGM_TXW_SQNS = %d", txw_sqns);
			goto err_abort;
		}
		if (txw_max_rte > 0 &&
		    !pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &txw_max_rte, sizeof(txw_max_rte))) {
			g_error ("setting PGM_TXW_MAX_RTE = %d", txw_max_rte);
			goto err_abort;
		}
		if (odata_max_rte > 0 &&
		    !pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_ODATA_MAX_RTE, &odata_max_rte, sizeof(odata_max_rte))) {
			g_error ("setting PGM_ODATA_MAX_RTE = %d", odata_max_rte);
			goto err_abort;
		}
		if (rdata_max_rte > 0 &&
		    !pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RDATA_MAX_RTE, &rdata_max_rte, sizeof(rdata_max_rte))) {
			g_error ("setting PGM_RDATA_MAX_RTE = %d", rdata_max_rte);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm))) {
			g_error ("setting PGM_AMBIENT_SPM = %d", ambient_spm);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm))) {
	                char buffer[1024];
	                sprintf (buffer, "%d", heartbeat_spm[0]);
	                for (unsigned i = 1; i < G_N_ELEMENTS(heartbeat_spm); i++) {
	                        char t[1024];
	                        sprintf (t, ", %d", heartbeat_spm[i]);
	                        strcat (buffer, t);
	                }
	                g_error ("setting HEARTBEAT_SPM = { %s }", buffer);
			goto err_abort;
	        }

	}

/* receive side */
	if (PGMPING_MODE_RECEIVER  == g_mode ||
	    PGMPING_MODE_INITIATOR == g_mode ||
	    PGMPING_MODE_REFLECTOR == g_mode    )
	{
		const int recv_only	   = (PGMPING_MODE_RECEIVER == g_mode) ? 1 : 0,
			  not_passive	   = 0,
			  rxw_sqns	   = g_sqns,
			  peer_expiry	   = pgm_secs (300),
			  spmr_expiry	   = pgm_msecs (250),
			  nak_bo_ivl	   = pgm_msecs (50),
			  nak_rpt_ivl	   = pgm_msecs (200), //pgm_secs (2),
			  nak_rdata_ivl    = pgm_msecs (200), //pgm_secs (2),
			  nak_data_retries = 50,
			  nak_ncf_retries  = 50;

		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only))) {
			g_error ("setting PGM_RECV_ONLY = %d", recv_only);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, ¬_passive, sizeof(not_passive))) {
			g_error ("setting PGM_PASSIVE = %d", not_passive);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &rxw_sqns, sizeof(rxw_sqns))) {
			g_error ("setting PGM_RXW_SQNS = %d", rxw_sqns);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry))) {
			g_error ("setting PGM_PEER_EXPIRY = %d", peer_expiry);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry))) {
			g_error ("setting PGM_SPMR_EXPIRY = %d", spmr_expiry);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl))) {
			g_error ("setting PGM_NAK_BO_IVL = %d", nak_bo_ivl);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl))) {
			g_error ("setting PGM_NAK_RPT_IVL = %d", nak_rpt_ivl);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl))) {
			g_error ("setting PGM_NAK_RDATA_IVL = %d", nak_rdata_ivl);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries))) {
			g_error ("setting PGM_NAK_DATA_RETRIES = %d", nak_data_retries);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries))) {
			g_error ("setting PGM_NAK_NCF_RETRIES = %d", nak_ncf_retries);
			goto err_abort;
		}
	}

#ifdef I_UNDERSTAND_PGMCC_AND_FEC_ARE_NOT_SUPPORTED
/* PGMCC congestion control */
	if (g_use_pgmcc) {
		struct pgm_pgmccinfo_t pgmccinfo;
		pgmccinfo.ack_bo_ivl		= pgm_msecs (50);
		pgmccinfo.ack_c			= 75;
		pgmccinfo.ack_c_p		= 500;
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_USE_PGMCC, &pgmccinfo, sizeof(pgmccinfo))) {
			g_error ("setting PGM_USE_PGMCC = { ack_bo_ivl = %d ack_c = %d ack_c_p = %d }",
				pgmccinfo.ack_bo_ivl,
				pgmccinfo.ack_c,
				pgmccinfo.ack_c_p);
			goto err_abort;
		}
	}

/* Reed Solomon forward error correction */
	if (g_use_fec) {
		struct pgm_fecinfo_t fecinfo; 
		fecinfo.block_size		= g_rs_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= g_rs_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= TRUE;
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo))) {
			g_error ("setting PGM_USE_FEC = { block_size = %d proactive_packets = %d group_size = %d ondemand_parity_enabled = %s var_pktlen_enabled = %s }",
				fecinfo.block_size,
				fecinfo.proactive_packets,
				fecinfo.group_size,
				fecinfo.ondemand_parity_enabled ? "TRUE" : "FALSE",
				fecinfo.var_pktlen_enabled ? "TRUE" : "FALSE");
			goto err_abort;
		}
	}
#endif

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = (0 != g_port) ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
	{
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req))) {
			char group[INET6_ADDRSTRLEN];
			getnameinfo ((struct sockaddr*)&res->ai_recv_addrs[i].gsr_group, sizeof(struct sockaddr_in),
                                        group, sizeof(group),
                                        NULL, 0,
                                        NI_NUMERICHOST);
			g_error ("setting PGM_JOIN_GROUP = { #%u %s }",
				(unsigned)res->ai_recv_addrs[i].gsr_interface,
				group);
			goto err_abort;
		}
	}
	if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req))) {
                char group[INET6_ADDRSTRLEN];
                getnameinfo ((struct sockaddr*)&res->ai_send_addrs[0].gsr_group, sizeof(struct sockaddr_in),
				group, sizeof(group),
                                NULL, 0,
                                NI_NUMERICHOST);
		g_error ("setting PGM_SEND_GROUP = { #%u %s }",
			(unsigned)res->ai_send_addrs[0].gsr_interface,
			group);
		goto err_abort;
	}
	pgm_freeaddrinfo (res);

/* set IP parameters */
	{
		const int nonblocking	   = 1,
			  multicast_direct = 0,
			  multicast_hops   = 16,
			  dscp		   = 0x2e << 2;	/* Expedited Forwarding PHB for network elements, no ECN. */

		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_direct, sizeof(multicast_direct))) {
			g_error ("setting PGM_MULTICAST_LOOP = %d", multicast_direct);
			goto err_abort;
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops))) {
			g_error ("setting PGM_MULTICAST_HOPS = %d", multicast_hops);
			goto err_abort;
		}
		if (AF_INET6 != sa_family) {
			if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp))) {
				g_error ("setting PGM_TOS = 0x%x", dscp);
				goto err_abort;
			}
		}
		if (!pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking))) {
			g_error ("setting PGM_NOBLOCK = %d", nonblocking);
			goto err_abort;
		}
	}

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* period timer to indicate some form of life */
// TODO: Gnome 2.14: replace with g_timeout_add_seconds()
	g_timeout_add (2 * 1000, (GSourceFunc)on_mark, NULL);

	if (PGMPING_MODE_SOURCE == g_mode || PGMPING_MODE_INITIATOR == g_mode)
	{
		g_sender_thread = g_thread_create_full (sender_thread,
							g_sock,
							0,
							TRUE,
							TRUE,
							G_THREAD_PRIORITY_NORMAL,
							&err);
		if (!g_sender_thread) {
			g_critical ("g_thread_create_full failed errno %i: \"%s\"", err->code, err->message);
			goto err_abort;
		}
	}

	{
		g_receiver_thread = g_thread_create_full (receiver_thread,
							  g_sock,
							  0,
							  TRUE,
							  TRUE,
							  G_THREAD_PRIORITY_HIGH,
							  &err);
		if (!g_receiver_thread) {
			g_critical ("g_thread_create_full failed errno %i: \"%s\"", err->code, err->message);
			goto err_abort;
		}
	}

	g_message ("startup complete.");
	return FALSE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
gpointer
sender_thread (
	gpointer	user_data
	)
{
	pgm_sock_t* tx_sock = (pgm_sock_t*)user_data;
	example::Ping ping;
	string subject("PING.PGM.TEST.");
	char hostname[NI_MAXHOST + 1];
	const long payload_len = 1000;
	char payload[payload_len];
	gpointer buffer = NULL;
	guint64 latency, now, last = 0;

#ifdef CONFIG_HAVE_EPOLL
	const long ev_len = 1;
	struct epoll_event events[ev_len];

	int efd_again = epoll_create (IP_MAX_MEMBERSHIPS);
	if (efd_again < 0) {
		g_error ("epoll_create failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
/* Add write event to epoll domain in order to re-enable as required by return
 * value.  We use one-shot flag to disable ASAP, as we don't want such events
 * until triggered.
 */
	if (pgm_epoll_ctl (tx_sock, efd_again, EPOLL_CTL_ADD, EPOLLOUT | EPOLLONESHOT) < 0) {
		g_error ("pgm_epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
	struct epoll_event event;
	memset (&event, 0, sizeof(event));
	event.events = EPOLLIN;
	event.data.fd = g_quit_pipe[0];
	if (epoll_ctl (efd_again, EPOLL_CTL_ADD, g_quit_pipe[0], &event) < 0) {
		g_error ("epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
#elif defined(CONFIG_HAVE_POLL)
/* does not include ACKs */
	int n_fds = PGM_BUS_SOCKET_WRITE_COUNT;
	struct pollfd fds[ PGM_BUS_SOCKET_WRITE_COUNT + 1 ];
#elif defined(CONFIG_HAVE_WSAPOLL)
	ULONG n_fds = PGM_BUS_SOCKET_WRITE_COUNT;
	WSAPOLLFD fds[ PGM_BUS_SOCKET_WRITE_COUNT + 1 ];
#elif defined(CONFIG_WSA_WAIT)
/* does not include ACKs */
	SOCKET send_sock;
	DWORD cEvents = PGM_BUS_SOCKET_WRITE_COUNT + 1;
	WSAEVENT waitEvents[ PGM_BUS_SOCKET_WRITE_COUNT + 1 ];
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = WSACreateEvent();
	WSAEventSelect (g_quit_socket[0], waitEvents[0], FD_READ);
	waitEvents[1] = WSACreateEvent();
	g_assert (1 == PGM_BUS_SOCKET_WRITE_COUNT);
	pgm_getsockopt (tx_sock, IPPROTO_PGM, PGM_SEND_SOCK, &send_sock, &socklen);
	WSAEventSelect (send_sock, waitEvents[1], FD_WRITE);
#endif /* !CONFIG_HAVE_EPOLL */

	gethostname (hostname, sizeof(hostname));
	subject.append(hostname);
	memset (payload, 0, sizeof(payload));

#ifdef CONFIG_HAVE_SCHEDPARAM
/* realtime scheduling */
	pthread_t thread_id = pthread_self ();
	int policy;
	struct sched_param param;

	if (0 == pthread_getschedparam (thread_id, &policy, ¶m)) {
		policy = SCHED_FIFO;
		param.sched_priority = 50;
		if (0 != pthread_setschedparam (thread_id, policy, ¶m))
			g_warning ("Cannot set thread scheduling parameters.");
	} else
		g_warning ("Cannot get thread scheduling parameters.");
#endif

	ping.mutable_subscription_header()->set_subject (subject);
	ping.mutable_market_data_header()->set_msg_type (example::MarketDataHeader::MSG_VERIFY);
	ping.mutable_market_data_header()->set_rec_type (example::MarketDataHeader::PING);
	ping.mutable_market_data_header()->set_rec_status (example::MarketDataHeader::STATUS_OK);
	ping.set_time (last);

	last = now = pgm_time_update_now();
	do {
		if (g_msg_sent && g_latency_seqno + 1 == g_msg_sent)
			latency = g_latency_current;
		else
			latency = g_odata_interval;

		ping.set_seqno (g_msg_sent);
		ping.set_latency (latency);
		ping.set_payload (payload, sizeof(payload));

		const size_t header_size = pgm_pkt_offset (FALSE, g_pgmcc_family);
		const size_t apdu_size = ping.ByteSize();
		struct pgm_sk_buff_t* skb = pgm_alloc_skb (g_max_tpdu);
		pgm_skb_reserve (skb, header_size);
		pgm_skb_put (skb, apdu_size);

/* wait on packet rate limit */
		if ((last + g_odata_interval) > now) {
#ifndef _WIN32
			const unsigned int usec = g_odata_interval - (now - last);
			usleep (usec);
#else
#	define usecs_to_msecs(t)	( ((t) + 999) / 1000 )
			const DWORD msec = (DWORD)usecs_to_msecs (g_odata_interval - (now - last));
/* Avoid yielding on Windows XP/2000 */ 
			if (msec > 0)
				Sleep (msec);
#endif
			now = pgm_time_update_now();
		}
		last += g_odata_interval;
		ping.set_time (now);
		ping.SerializeToArray (skb->data, skb->len);

		struct timeval tv;
#if defined(CONFIG_HAVE_EPOLL) || defined(CONFIG_HAVE_POLL)
		int timeout;
#elif defined(CONFIG_HAVE_WSAPOLL)
		DWORD dwTimeout;
#elif defined(CONFIG_WSA_WAIT)
		DWORD dwTimeout, dwEvents;
#else
		int n_fds;
		fd_set readfds, writefds;
#endif
		size_t bytes_written;
		int status;
again:
		status = pgm_send_skbv (tx_sock, &skb, 1, TRUE, &bytes_written);
		switch (status) {
/* rate control */
		case PGM_IO_STATUS_RATE_LIMITED:
		{
			socklen_t optlen = sizeof (tv);
			const gboolean status = pgm_getsockopt (tx_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			if (G_UNLIKELY(!status)) {
				g_error ("getting PGM_RATE_REMAIN failed");
				break;
			}
#if defined(CONFIG_HAVE_EPOLL) || defined(CONFIG_HAVE_POLL)
			timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 500) / 1000);
/* busy wait under 2ms */
#	ifdef CONFIG_BUSYWAIT
			if (timeout < 2)
				goto again;
#	else
			if (0 == timeout)
				goto again;
#	endif
#elif defined(CONFIG_HAVE_WSAPOLL) || defined(CONFIG_WSA_WAIT)
/* round up wait */
#	ifdef CONFIG_BUSYWAIT
			dwTimeout = (DWORD)(tv.tv_sec * 1000) + ((tv.tv_usec + 500) / 1000);
#	else
			dwTimeout = (DWORD)(tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000);
#	endif
			if (0 == dwTimeout)
				goto again;
#endif
#if defined(CONFIG_HAVE_EPOLL)
			const int ready = epoll_wait (efd_again, events, G_N_ELEMENTS(events), timeout /* ms */);
#elif defined(CONFIG_HAVE_POLL)
			memset (fds, 0, sizeof(fds));
			fds[0].fd = g_quit_pipe[0];
			fds[0].events = POLLIN;
			n_fds = G_N_ELEMENTS(fds) - 1;
			pgm_poll_info (tx_sock, &fds[1], &n_fds, POLLIN);
			poll (fds, 1 + n_fds, timeout /* ms */);
#elif defined(CONFIG_HAVE_WSAPOLL)
			ZeroMemory (fds, sizeof(WSAPOLLFD) * (n_fds + 1));
			fds[0].fd = g_quit_socket[0];
			fds[0].events = POLLRDNORM;
			n_fds = G_N_ELEMENTS(fds) - 1;
			pgm_poll_info (tx_sock, &fds[1], &n_fds, POLLRDNORM);
			WSAPoll (fds, 1 + n_fds, dwTimeout /* ms */);
#elif defined(CONFIG_WSA_WAIT)
/* only wait for quit or timeout events */
			cEvents = 1;
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			default: break;
			}
#else
			FD_ZERO(&readfds);
#	ifndef _WIN32
			FD_SET(g_quit_pipe[0], &readfds);
			n_fds = g_quit_pipe[0] + 1;		/* highest fd + 1 */
#	else
			FD_SET(g_quit_socket[0], &readfds);
			n_fds = 1;				/* count of fds */
#	endif
			pgm_select_info (g_sock, &readfds, NULL, &n_fds);
			n_fds = select (n_fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#endif /* !CONFIG_HAVE_EPOLL */
			if (G_UNLIKELY(g_quit))
				break;
			goto again;
		}
/* congestion control */
		case PGM_IO_STATUS_CONGESTION:
/* kernel feedback */
		case PGM_IO_STATUS_WOULD_BLOCK:
		{
#ifdef CONFIG_HAVE_EPOLL
#	if 1
/* re-enable write event for one-shot */
			if (pgm_epoll_ctl (tx_sock, efd_again, EPOLL_CTL_MOD, EPOLLOUT | EPOLLONESHOT) < 0)
			{
				g_error ("pgm_epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
				g_main_loop_quit (g_loop);
				return NULL;
			}
			const int ready = epoll_wait (efd_again, events, G_N_ELEMENTS(events), -1 /* ms */);
			if (G_UNLIKELY(g_quit))
				break;
#	else
			const int ready = epoll_wait (efd_again, events, G_N_ELEMENTS(events), -1 /* ms */);
			if (G_UNLIKELY(g_quit))
				break;
			if (ready > 0 &&
			    pgm_epoll_ctl (tx_sock, efd_again, EPOLL_CTL_MOD, EPOLLOUT | EPOLLONESHOT) < 0)
			{
				g_error ("pgm_epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
				g_main_loop_quit (g_loop);
				return NULL;
			}
#	endif
#elif defined(CONFIG_HAVE_POLL)
			memset (fds, 0, sizeof(fds));
			fds[0].fd = g_quit_pipe[0];
			fds[0].events = POLLIN;
			n_fds = G_N_ELEMENTS(fds) - 1;
			pgm_poll_info (g_sock, &fds[1], &n_fds, POLLOUT);
			poll (fds, 1 + n_fds, -1 /* ms */);
#elif defined(CONFIG_HAVE_WSAPOLL)
			ZeroMemory (fds, sizeof(WSAPOLLFD) * (n_fds + 1));
			fds[0].fd = g_quit_socket[0];
			fds[0].events = POLLRDNORM;
			n_fds = G_N_ELEMENTS(fds) - 1;
			pgm_poll_info (tx_sock, &fds[1], &n_fds, POLLWRNORM);
			WSAPoll (fds, 1 + n_fds, -1 /* ms */);
#elif defined(CONFIG_WSA_WAIT)
			cEvents = PGM_BUS_SOCKET_WRITE_COUNT + 1;
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, WSA_INFINITE, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			default: break;
			}
#else
			FD_ZERO(&readfds);
#	ifndef _WIN32
			FD_SET(g_quit_pipe[0], &readfds);
			n_fds = g_quit_pipe[0] + 1;		/* highest fd + 1 */
#	else
			FD_SET(g_quit_socket[0], &readfds);
			n_fds = 1;				/* count of fds */
#	endif
			pgm_select_info (g_sock, &readfds, &writefds, &n_fds);
			n_fds = select (n_fds, &readfds, &writefds, NULL, NULL);
			
#endif /* !CONFIG_HAVE_EPOLL */
			goto again;
		}
/* successful delivery */
		case PGM_IO_STATUS_NORMAL:
//			g_message ("sent payload: %s", ping.DebugString().c_str());
//			g_message ("sent %u bytes", (unsigned)bytes_written);
			break;
		default:
			g_warning ("pgm_send_skbv failed, status:%i", status);
			g_main_loop_quit (g_loop);
			return NULL;
		}
		g_out_total += bytes_written;
		g_msg_sent++;
	} while (G_LIKELY(!g_quit));

#if defined(CONFIG_HAVE_EPOLL)
	close (efd_again);
#elif defined(CONFIG_WSA_WAIT)
	WSACloseEvent (waitEvents[0]);
	WSACloseEvent (waitEvents[1]);
#endif
	return NULL;
}

static
gpointer
receiver_thread (
	gpointer	data
	)
{
	pgm_sock_t* rx_sock = (pgm_sock_t*)data;
	const long iov_len = 20;
	struct pgm_msgv_t msgv[iov_len];
	pgm_time_t lost_tstamp = 0;
	pgm_tsi_t  lost_tsi;
	guint32	   lost_count = 0;

#ifdef CONFIG_HAVE_EPOLL
	const long ev_len = 1;
	struct epoll_event events[ev_len];

	int efd = epoll_create (IP_MAX_MEMBERSHIPS);
	if (efd < 0) {
		g_error ("epoll_create failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
	if (pgm_epoll_ctl (rx_sock, efd, EPOLL_CTL_ADD, EPOLLIN) < 0) {
		g_error ("pgm_epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
	struct epoll_event event;
	memset (&event, 0, sizeof(event));
	event.events = EPOLLIN;
	event.data.fd = g_quit_pipe[0];
	if (epoll_ctl (efd, EPOLL_CTL_ADD, g_quit_pipe[0], &event) < 0) {
		g_error ("epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
#elif defined(CONFIG_HAVE_POLL)
	int n_fds = PGM_BUS_SOCKET_READ_COUNT;
	struct pollfd fds[ PGM_BUS_SOCKET_READ_COUNT + 1 ];
#elif defined(CONFIG_HAVE_WSAPOLL)
	ULONG n_fds = PGM_BUS_SOCKET_READ_COUNT;
	WSAPOLLFD fds[ PGM_BUS_SOCKET_READ_COUNT + 1 ];
#elif defined(CONFIG_WSA_WAIT)
	SOCKET recv_sock, repair_sock, pending_sock;
	DWORD cEvents = PGM_BUS_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ PGM_BUS_SOCKET_READ_COUNT + 1 ];
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = WSACreateEvent();;
	waitEvents[1] = WSACreateEvent();
	waitEvents[2] = WSACreateEvent();
	waitEvents[3] = WSACreateEvent();
	g_assert (3 == PGM_BUS_SOCKET_READ_COUNT);
	WSAEventSelect (g_quit_socket[0], waitEvents[0], FD_READ);
	pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_REPAIR_SOCK, &repair_sock, &socklen);
	WSAEventSelect (repair_sock, waitEvents[2], FD_READ);
	pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[3], FD_READ);
#endif /* !CONFIG_HAVE_EPOLL */

#ifdef CONFIG_HAVE_SCHEDPARAM
/* realtime scheduling */
	pthread_t thread_id = pthread_self ();
	int policy;
	struct sched_param param;

	if (0 == pthread_getschedparam (thread_id, &policy, ¶m)) {
		policy = SCHED_FIFO;
		param.sched_priority = 50;
		if (0 != pthread_setschedparam (thread_id, policy, ¶m))
			g_warning ("Cannot set thread scheduling parameters.");
	} else
		g_warning ("Cannot get thread scheduling parameters.");
#endif

	memset (&lost_tsi, 0, sizeof(lost_tsi));

	do {
		struct timeval tv;
#if defined(CONFIG_HAVE_EPOLL) || defined(CONFIG_HAVE_POLL)
		int timeout;
#elif defined(CONFIG_HAVE_WSAPOLL)
		DWORD dwTimeout;
#elif defined(CONFIG_WSA_WAIT)
		DWORD dwTimeout, dwEvents;
#else
		int n_fds;
		fd_set readfds;
#endif
		size_t len;
		pgm_error_t* pgm_err;
		int status;

again:
		pgm_err = NULL;
		status = pgm_recvmsgv (rx_sock,
				       msgv,
				       G_N_ELEMENTS(msgv),
				       MSG_ERRQUEUE,
				       &len,
				       &pgm_err);
		if (lost_count) {
			pgm_time_t elapsed = pgm_time_update_now() - lost_tstamp;
			if (elapsed >= pgm_secs(1)) {
				g_warning ("pgm data lost %" G_GUINT32_FORMAT " packets detected from %s",
						lost_count, pgm_tsi_print (&lost_tsi));
				lost_count = 0;
			}
		}

		switch (status) {
		case PGM_IO_STATUS_NORMAL:
//			g_message ("recv %u bytes", (unsigned)len);
			on_msgv (msgv, len);
			break;
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				const gboolean status = pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
//g_message ("timer pending %d", ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)));
				if (G_UNLIKELY(!status)) {
					g_error ("getting PGM_TIME_REMAIN failed");
					break;
				}
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				const gboolean status = pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
//g_message ("rate limited %d", ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)));
				if (G_UNLIKELY(!status)) {
					g_error ("getting PGM_RATE_REMAIN failed");
					break;
				}
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
//g_message ("would block");
block:
#if defined(CONFIG_HAVE_EPOLL) || defined(CONFIG_HAVE_POLL)
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + ((tv.tv_usec + 500) / 1000));
/* busy wait under 2ms */
#	ifdef CONFIG_BUSYWAIT
			if (timeout >= 0 && timeout < 2)
				goto again;
#	else
			if (0 == timeout)
				goto again;
#	endif
#elif defined(CONFIG_HAVE_WSAPOLL) || defined(CONFIG_WSA_WAIT)
/* round up wait */
#	ifdef CONFIG_BUSYWAIT
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + ((tv.tv_usec + 500) / 1000));
#	else
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000));
#	endif
			if (0 == dwTimeout)
				goto again;
#endif
#ifdef CONFIG_HAVE_EPOLL
			epoll_wait (efd, events, G_N_ELEMENTS(events), timeout /* ms */);
#elif defined(CONFIG_HAVE_POLL)
			memset (fds, 0, sizeof(fds));
			fds[0].fd = g_quit_pipe[0];
			fds[0].events = POLLIN;
			pgm_poll_info (g_sock, &fds[1], &n_fds, POLLIN);
			poll (fds, 1 + n_fds, timeout /* ms */);
#elif defined(CONFIG_HAVE_WSAPOLL)
			ZeroMemory (fds, sizeof(fds));
			fds[0].fd = g_quit_socket[0];
			fds[0].events = POLLRDNORM;
			pgm_poll_info (g_sock, &fds[1], &n_fds, POLLRDNORM);
			WSAPoll (fds, 1 + n_fds, dwTimeout /* ms */);
#elif defined(CONFIG_WSA_WAIT)
#	ifdef CONFIG_HAVE_IOCP
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, TRUE);
			if (WSA_WAIT_IO_COMPLETION == dwEvents)
#	endif
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			if ((WSA_WAIT_FAILED != dwEvents) && (WSA_WAIT_TIMEOUT != dwEvents)) {
				const DWORD Index = dwEvents - WSA_WAIT_EVENT_0;
/* Do not reset quit event */
				if (Index > 0) WSAResetEvent (waitEvents[Index]);
			}
#else
			FD_ZERO(&readfds);
#	ifndef _WIN32
			FD_SET(g_quit_pipe[0], &readfds);
			n_fds = g_quit_pipe[0] + 1;		/* highest fd + 1 */
#	else
			FD_SET(g_quit_socket[0], &readfds);
			n_fds = 1;				/* count of fds */
#	endif
			pgm_select_info (g_sock, &readfds, NULL, &n_fds);
			n_fds = select (n_fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#endif /* !CONFIG_HAVE_EPOLL */
			break;
		case PGM_IO_STATUS_RESET:
		{
			struct pgm_sk_buff_t* skb = msgv[0].msgv_skb[0];
			lost_tstamp = skb->tstamp;
			if (pgm_tsi_equal (&skb->tsi, &lost_tsi))
				lost_count += skb->sequence;
			else {
				lost_count = skb->sequence;
				memcpy (&lost_tsi, &skb->tsi, sizeof(pgm_tsi_t));
			}
			pgm_free_skb (skb);
			break;
		}
		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			break;
		}
	} while (G_LIKELY(!g_quit));

#if defined(CONFIG_HAVE_EPOLL)
	close (efd);
#elif defined(CONFIG_WSA_WAIT)
	WSACloseEvent (waitEvents[0]);
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
	WSACloseEvent (waitEvents[3]);
#endif
	return NULL;
}

static
int
on_msgv (
	struct pgm_msgv_t*	msgv,		/* an array of msgvs */
	size_t			len
	)
{
	example::Ping ping;
	guint i = 0;
	static pgm_time_t last_time = pgm_time_update_now();

	while (len)
	{
		const struct pgm_sk_buff_t* pskb = msgv[i].msgv_skb[0];
		gsize apdu_len = 0;
		for (unsigned j = 0; j < msgv[i].msgv_len; j++)
			apdu_len += msgv[i].msgv_skb[j]->len;

		if (PGMPING_MODE_REFLECTOR == g_mode)
		{
			int status;
again:
			status = pgm_send (g_sock, pskb->data, pskb->len, NULL);
			switch (status) {
			case PGM_IO_STATUS_RATE_LIMITED:
//g_message ("reflector ratelimit");
				goto again;
			case PGM_IO_STATUS_CONGESTION:
g_message ("reflector congestion");
				goto again;
			case PGM_IO_STATUS_WOULD_BLOCK:
//g_message ("reflector would block");
/* busy wait always as reflector */
				goto again;

			case PGM_IO_STATUS_NORMAL:
				break;

			default:
				g_warning ("pgm_send_skbv failed");
				g_main_loop_quit (g_loop);
				return 0;
			}
			goto next_msg;
		}

/* only parse first fragment of each apdu */
		if (!ping.ParseFromArray (pskb->data, pskb->len))
			goto next_msg;
//		g_message ("payload: %s", ping.DebugString().c_str());

		{
			const pgm_time_t send_time	= ping.time();
			const pgm_time_t recv_time	= pskb->tstamp;
			const guint64 seqno		= ping.seqno();
			const guint64 latency		= ping.latency();

			if (seqno < g_latency_seqno) {
				g_message ("seqno replay?");
				goto next_msg;
			}

			g_in_total += pskb->len;
			g_msg_received++;

/* handle ping */
			const pgm_time_t now = pgm_time_update_now();
			if (send_time > now)
				g_warning ("send time %" PGM_TIME_FORMAT " newer than now %" PGM_TIME_FORMAT,
					   send_time, now);
			if (recv_time > now)
				g_warning ("recv time %" PGM_TIME_FORMAT " newer than now %" PGM_TIME_FORMAT,
					   recv_time, now);
			if (send_time >= recv_time){
				g_message ("timer mismatch, send time = recv time + %.3f ms (last time + %.3f ms)",
					   pgm_to_msecsf(send_time - recv_time),
					   pgm_to_msecsf(last_time - send_time));
				goto next_msg;
			}
			g_latency_current	= pgm_to_secs (recv_time - send_time);
			g_latency_seqno		= seqno;

			const double elapsed    = pgm_to_usecsf (recv_time - send_time);
			g_latency_total	       += elapsed;
			g_latency_square_total += elapsed * elapsed;

			if (elapsed > g_latency_max)
				g_latency_max = elapsed;
			if (elapsed < g_latency_min)
				g_latency_min = elapsed;

			g_latency_running_average += elapsed;
			g_latency_count++;
			last_time = recv_time;

#ifdef CONFIG_WITH_HEATMAP
/* update heatmap slice */
			if (NULL != g_heatmap_file) {
				const guintptr key = (guintptr)((pgm_to_usecs (recv_time - send_time) + (g_heatmap_resolution - 1)) / g_heatmap_resolution) * g_heatmap_resolution;
				g_mutex_lock (g_heatmap_lock);
				guint32* value = (guint32*)g_hash_table_lookup (g_heatmap_slice, (const void*)key);
				if (NULL == value) {
					value = g_slice_new (guint32);
					*value = 1;
					g_hash_table_insert (g_heatmap_slice, (void*)key, (void*)value);
				} else
					(*value)++;
				g_mutex_unlock (g_heatmap_lock);
			}
#endif
		}

/* move onto next apdu */
next_msg:
		i++;
		len -= apdu_len;
	}

	return 0;
}

/* idle log notification
 */

static
gboolean
on_mark (
	G_GNUC_UNUSED gpointer data
	)
{
	const pgm_time_t now = pgm_time_update_now ();
	const double interval = pgm_to_secsf(now - g_interval_start);
	g_interval_start = now;

/* receiving a ping */
	if (g_latency_count)
	{
		const double average = g_latency_total / g_latency_count;
		const double variance = g_latency_square_total / g_latency_count
					- average * average;
		const double standard_deviation = sqrt (variance);

		if (g_latency_count < 10)
		{
			if (average < 1000.0)
				g_message ("seqno=%" G_GUINT64_FORMAT " time=%.01f us",
						g_latency_seqno, average);
			else
				g_message ("seqno=%" G_GUINT64_FORMAT " time=%.01f ms",
						g_latency_seqno, average / 1000);
		}
		else
		{
			double seq_rate = (g_latency_seqno - g_last_seqno) / interval;
			double out_rate = g_out_total * 8.0 / 1000000.0 / interval;
			double  in_rate = g_in_total  * 8.0 / 1000000.0 / interval;
			if (g_latency_min < 1000.0)
				g_message ("s=%.01f avg=%.01f min=%.01f max=%.01f stddev=%0.1f us o=%.2f i=%.2f mbit",
					seq_rate, average, g_latency_min, g_latency_max, standard_deviation, out_rate, in_rate);
			else
				g_message ("s=%.01f avg=%.01f min=%.01f max=%.01f stddev=%0.1f ms o=%.2f i=%.2f mbit",
					seq_rate, average / 1000, g_latency_min / 1000, g_latency_max / 1000, standard_deviation / 1000, out_rate, in_rate);
		}

/* reset interval counters */
		g_latency_total		= 0.0;
		g_latency_square_total	= 0.0;
		g_latency_count		= 0;
		g_last_seqno		= g_latency_seqno;
#ifdef INFINITY
		g_latency_min		= INFINITY;
#else
		g_latency_min		= (double)INT64_MAX;
#endif
		g_latency_max		= 0.0;
		g_out_total		= 0;
		g_in_total		= 0;

#ifdef CONFIG_WITH_HEATMAP
/* serialize heatmap slice */
		if (NULL != g_heatmap_file) {
			GHashTableIter iter;
			gpointer key, value;
			guint32 slice_size;

			g_mutex_lock (g_heatmap_lock);
			slice_size = g_htonl ((guint32)g_hash_table_size (g_heatmap_slice));
			fwrite (&slice_size, sizeof (slice_size), 1, g_heatmap_file);
			g_hash_table_iter_init (&iter, g_heatmap_slice);
			while (g_hash_table_iter_next (&iter, &key, &value)) {
				guint32 words[2];
				words[0] = g_htonl ((guint32)(guintptr)key);
				words[1] = g_htonl (*(guint32*)value);
				fwrite (words, sizeof (guint32), 2, g_heatmap_file);
				g_slice_free (guint32, value);
				g_hash_table_iter_remove (&iter);
			}
			g_mutex_unlock (g_heatmap_lock);
		}
#endif
	}

	return TRUE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/pgmsend.c0000644000175000017500000002133311640407353021163 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple sender using the PGM transport.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#else
#	include "getopt.h"
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_max_rte = 400*1000;
static int		g_sqns = 100;

static gboolean		g_fec = FALSE;
static int		g_k = 8;
static int		g_n = 255;

static pgm_sock_t*	g_sock = NULL;

static gboolean create_pgm_socket (void);


G_GNUC_NORETURN static
void
usage (const char* bin)
{
	fprintf (stderr, "Usage: %s [options] message\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -r        : Regulate to rate bytes per second\n");
	fprintf (stderr, "  -f        : Enable FEC with either proactive or ondemand parity\n");
	fprintf (stderr, "  -K           : Configure Reed-Solomon code (n, k)\n");
	fprintf (stderr, "  -N \n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	fprintf (stderr, "  -i              : List available interfaces\n");
	exit (1);
}

int
main (
	int	argc,
	char   *argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

/* pre-initialise PGM messages module to add hook for GLib logging */
	pgm_messages_init();
	log_init();
	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		pgm_messages_shutdown();
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:r:f:K:N:lih")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'r':	g_max_rte = atoi (optarg); break;

		case 'f':	g_fec = TRUE; break;
		case 'K':	g_k = atoi (optarg); break;
		case 'N':	g_n = atoi (optarg); break;

		case 'l':	g_multicast_loop = TRUE; break;

		case 'i':
			pgm_if_print_all();
			pgm_messages_shutdown();
			return EXIT_SUCCESS;

		case 'h':
		case '?':
			pgm_messages_shutdown();
			usage (binary_name);
		}
	}

	if (g_fec && ( !g_k || !g_n )) {
		pgm_messages_shutdown();
		g_error ("Invalid Reed-Solomon parameters RS(%d, %d).", g_n, g_k);
		usage (binary_name);
	}

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
#ifdef SIGHUP
	signal (SIGHUP, SIG_IGN);
#endif

	if (create_pgm_socket())
	{
		while (optind < argc) {
			const int status = pgm_send (g_sock, argv[optind], strlen(argv[optind]) + 1, NULL);
		        if (PGM_IO_STATUS_NORMAL != status) {
				g_warning ("pgm_send failed.");
		        }
			optind++;
		}
	}

/* cleanup */
	if (g_sock) {
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}
	pgm_shutdown();
	pgm_messages_shutdown();
	return EXIT_SUCCESS;
}

static
gboolean
create_pgm_socket (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into PGM socket address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("Parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("Creating PGM/UDP socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("Creating PGM/IP socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int send_only = 1,
		  ambient_spm = pgm_secs (30),
		  heartbeat_spm[] = { pgm_msecs (100),
				      pgm_msecs (100),
                                      pgm_msecs (100),
				      pgm_msecs (100),
				      pgm_msecs (1300),
				      pgm_secs  (7),
				      pgm_secs  (16),
				      pgm_secs  (25),
				      pgm_secs  (30) };

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_ONLY, &send_only, sizeof(send_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &g_max_rte, sizeof(g_max_rte));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm));
	if (g_fec) {
		struct pgm_fecinfo_t fecinfo; 
		fecinfo.block_size		= g_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= g_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= TRUE;
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("Creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("Binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int blocking = 0,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &blocking, sizeof(blocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("Connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/daytime.c0000644000175000017500000003633611640407353021173 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Daytime broadcast service.
 *
 * Copyright (c) 2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#	include 
#else
#	include 
#	include 
#	include "getopt.h"
#	define snprintf		_snprintf
#endif
#ifdef __APPLE__
#	include 
#endif
#include 


/* globals */
#define TIME_FORMAT	"%a, %d %b %Y %H:%M:%S %z"

static int		port = 0;
static const char*	network = "";
static bool		use_multicast_loop = FALSE;
static int		udp_encap_port = 0;

static int		max_tpdu = 1500;
static int		max_rte = 400*1000;		/* very conservative rate, 2.5mb/s */
static int		sqns = 100;

static bool		use_pgmcc = FALSE;
static bool		use_fec = FALSE;
static bool		use_ondemand_parity = FALSE;
static int		proactive_packets = 0;
static int		rs_k = 8;
static int		rs_n = 255;

static pgm_sock_t*	sock = NULL;
static bool		is_terminated = FALSE;

#ifndef _WIN32
static pthread_t	nak_thread;
static int		terminate_pipe[2];
static void on_signal (int);
static void* nak_routine (void*);
#else
static HANDLE		nak_thread;
static WSAEVENT		terminateEvent;
static BOOL on_console_ctrl (DWORD);
static unsigned __stdcall nak_routine (void*);
#endif
#ifndef _MSC_VER
static void usage (const char*) __attribute__((__noreturn__));
#else
static void usage (const char*);
#endif

static bool on_startup (void);
static bool create_sock (void);
static bool create_nak_thread (void);


static void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -r        : Regulate to rate bytes per second\n");
	fprintf (stderr, "  -c              : Enable PGMCC\n");
	fprintf (stderr, "  -f        : Enable FEC: proactive, ondemand, or both\n");
	fprintf (stderr, "  -N           : Reed-Solomon block size (255)\n");
	fprintf (stderr, "  -K           : Reed-Solomon group size (8)\n");
	fprintf (stderr, "  -P       : Number of pro-active parity packets (h)\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	fprintf (stderr, "  -i              : List available interfaces\n");
	exit (EXIT_SUCCESS);
}

int
main (
	int	argc,
	char   *argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	puts ("PGM daytime service");

	if (!pgm_init (&pgm_err)) {
		fprintf (stderr, "Unable to start PGM engine: %s\n", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
#ifdef _WIN32
	const char* binary_name = strrchr (argv[0], '\\');
#else
	const char* binary_name = strrchr (argv[0], '/');
#endif
	if (NULL == binary_name)	binary_name = argv[0];
	else				binary_name++;

	int c;
	while ((c = getopt (argc, argv, "s:n:p:r:cf:N:K:P:lih")) != -1)
	{
		switch (c) {
		case 'n':	network = optarg; break;
		case 's':	port = atoi (optarg); break;
		case 'p':	udp_encap_port = atoi (optarg); break;
		case 'r':	max_rte = atoi (optarg); break;
		case 'c':	use_pgmcc = TRUE; break;
		case 'f':
			use_fec = TRUE;
			switch (optarg[0]) {
			case 'p':
			case 'P':
				proactive_packets = 1;
				break;
			case 'b':
			case 'B':
				proactive_packets = 1;
			case 'o':
			case 'O':
				use_ondemand_parity = TRUE;
				break;
			}
			break;
		case 'N':	rs_n = atoi (optarg); break;
		case 'K':	rs_k = atoi (optarg); break;
		case 'P':	proactive_packets = atoi (optarg); break;

		case 'l':	use_multicast_loop = TRUE; break;

		case 'i':
			pgm_if_print_all();
			return EXIT_SUCCESS;

		case 'h':
		case '?':
			usage (binary_name);
		}
	}

	if (use_fec && ( !rs_n || !rs_k )) {
		fprintf (stderr, "Invalid Reed-Solomon parameters RS(%d,%d).\n", rs_n, rs_k);
		usage (binary_name);
	}

/* setup signal handlers */
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif
#ifndef _WIN32
	int e = pipe (terminate_pipe);
	assert (0 == e);
	const int flags = fcntl (terminate_pipe[0], F_GETFL);
	fcntl (terminate_pipe[0], F_SETFL, flags | O_NONBLOCK);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#else
	terminateEvent = WSACreateEvent();
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif /* !_WIN32 */

	if (!on_startup()) {
		fprintf (stderr, "Startup failed\n");
		return EXIT_FAILURE;
	}

/* service loop */
	do {
		time_t now;
		time (&now);
		const struct tm* time_ptr = localtime(&now);
#ifndef _WIN32
		char s[1024];
		const size_t slen = strftime (s, sizeof(s), TIME_FORMAT, time_ptr);
		const int status = pgm_send (sock, s, slen + 1, NULL);
#else
		char s[1024];
		const size_t slen = strftime (s, sizeof(s), TIME_FORMAT, time_ptr);
		wchar_t ws[1024];
		size_t wslen = MultiByteToWideChar (CP_ACP, 0, s, slen, ws, 1024);
		char us[1024];
		size_t uslen = WideCharToMultiByte (CP_UTF8, 0, ws, wslen + 1, us, sizeof(us), NULL, NULL);
		const int status = pgm_send (sock, us, uslen + 1, NULL);
#endif
	        if (PGM_IO_STATUS_NORMAL != status) {
			fprintf (stderr, "pgm_send() failed.\n");
		}
#ifndef _WIN32
		sleep (1);
#else
		Sleep (1 * 1000);
#endif
	} while (!is_terminated);

/* cleanup */
	puts ("Waiting for NAK thread.");
#ifndef _WIN32
	pthread_join (nak_thread, NULL);
	close (terminate_pipe[0]);
	close (terminate_pipe[1]);
#else
	WaitForSingleObject (nak_thread, INFINITE);
	CloseHandle (nak_thread);
	WSACloseEvent (terminateEvent);
#endif /* !_WIN32 */

	if (sock) {
		puts ("Closing PGM sock.");
		pgm_close (sock, TRUE);
		sock = NULL;
	}

	puts ("PGM engine shutdown.");
	pgm_shutdown();
	puts ("finished.");
	return EXIT_SUCCESS;
}

#ifndef _WIN32
static
void
on_signal (
	int		signum
	)
{
	printf ("on_signal (signum:%d)\n", signum);
	is_terminated = TRUE;
	const char one = '1';
	const size_t writelen = write (terminate_pipe[1], &one, sizeof(one));
	assert (sizeof(one) == writelen);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	printf ("on_console_ctrl (dwCtrlType:%lu)\n", (unsigned long)dwCtrlType);
	is_terminated = TRUE;
	WSASetEvent (terminateEvent);
	return TRUE;
}
#endif /* !_WIN32 */

static
bool
on_startup (void)
{
	bool status = (create_sock() && create_nak_thread());
	if (status)
		puts ("Startup complete.");
	return status;
}

static
bool
create_sock (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into sock address structure */
	if (!pgm_getaddrinfo (network, NULL, &res, &pgm_err)) {
		fprintf (stderr, "Parsing network parameter: %s\n", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	puts ("Create PGM socket.");
	if (udp_encap_port) {
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			fprintf (stderr, "Creating PGM/UDP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
	} else {
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			fprintf (stderr, "Creating PGM/IP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int send_only = 1,
		  ambient_spm = pgm_secs (30),
		  heartbeat_spm[] = { pgm_msecs (100),
				      pgm_msecs (100),
                                      pgm_msecs (100),
				      pgm_msecs (100),
				      pgm_msecs (1300),
				      pgm_secs  (7),
				      pgm_secs  (16),
				      pgm_secs  (25),
				      pgm_secs  (30) };

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_ONLY, &send_only, sizeof(send_only));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu, sizeof(max_tpdu));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_TXW_SQNS, &sqns, sizeof(sqns));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &max_rte, sizeof(max_rte));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm));

#ifdef I_UNDERSTAND_PGMCC_AND_FEC_ARE_NOT_SUPPORTED
	if (use_pgmcc) {
		struct pgm_pgmccinfo_t pgmccinfo;
		pgmccinfo.ack_bo_ivl		= pgm_msecs (50);
		pgmccinfo.ack_c			= 75;
		pgmccinfo.ack_c_p		= 500;
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_USE_PGMCC, &pgmccinfo, sizeof(pgmccinfo));
	}
	if (use_fec) {
		struct pgm_fecinfo_t fecinfo; 
		fecinfo.block_size		= rs_n;
		fecinfo.proactive_packets	= proactive_packets;
		fecinfo.group_size		= rs_k;
		fecinfo.ondemand_parity_enabled	= use_ondemand_parity;
		fecinfo.var_pktlen_enabled	= TRUE;
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}
#endif

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = port ? port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		fprintf (stderr, "Creating GSI: %s\n", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),        /* tx interface */
			&if_req, sizeof(if_req),        /* rx interface */
			&pgm_err))
	{
		fprintf (stderr, "Binding PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = use_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (sock, &pgm_err)) {
		fprintf (stderr, "Connecting PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

	return TRUE;

err_abort:
	if (NULL != sock) {
		pgm_close (sock, FALSE);
		sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
bool
create_nak_thread (void)
{
#ifndef _WIN32
	const int status = pthread_create (&nak_thread, NULL, &nak_routine, sock);
	if (0 != status) {
		fprintf (stderr, "Creating new thread: %s\n", strerror (status));
		return FALSE;
	}
#else
/* expect warning on MinGW due to lack of native uintptr_t */
	nak_thread = (HANDLE)_beginthreadex (NULL, 0, &nak_routine, sock, 0, NULL);
	const int save_errno = errno;
	if (0 == nak_thread) {
		fprintf (stderr, "Creating new thread: %s\n", strerror (save_errno));
		return FALSE;
	}
#endif /* _WIN32 */
	return TRUE;
}

static
#ifndef _WIN32
void*
#else
unsigned
__stdcall
#endif
nak_routine (
	void*		arg
	)
{
/* dispatch loop */
	pgm_sock_t* nak_sock = (pgm_sock_t*)arg;
#ifndef _WIN32
	int fds;
	fd_set readfds;
#else
	SOCKET recv_sock, repair_sock, pending_sock;
	DWORD cEvents = PGM_SEND_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ PGM_SEND_SOCKET_READ_COUNT + 1 ];
	DWORD dwTimeout, dwEvents;
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = terminateEvent;
	waitEvents[1] = WSACreateEvent();
	waitEvents[2] = WSACreateEvent();
	waitEvents[3] = WSACreateEvent();
	assert (3 == PGM_SEND_SOCKET_READ_COUNT);
	pgm_getsockopt (nak_sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	pgm_getsockopt (nak_sock, IPPROTO_PGM, PGM_REPAIR_SOCK, &repair_sock, &socklen);
	WSAEventSelect (repair_sock, waitEvents[2], FD_READ);
	pgm_getsockopt (nak_sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[3], FD_READ);
#endif /* !_WIN32 */
	do {
		struct timeval tv;
		char buf[4064];
		pgm_error_t* pgm_err = NULL;
		const int status = pgm_recv (nak_sock, buf, sizeof(buf), 0, NULL, &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
		case PGM_IO_STATUS_WOULD_BLOCK:
block:
#ifndef _WIN32
			fds = terminate_pipe[0] + 1;
			FD_ZERO(&readfds);
			FD_SET(terminate_pipe[0], &readfds);
			pgm_select_info (nak_sock, &readfds, NULL, &fds);
			fds = select (fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#else
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break;
			case WSA_WAIT_EVENT_0+3: WSAResetEvent (waitEvents[3]); break;
			default: break;
			}
#endif /* !_WIN32 */
			break;

		default:
			if (pgm_err) {
				fprintf (stderr, "%s\n", pgm_err->message ? pgm_err->message : "(null)");
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!is_terminated);
#ifndef _WIN32
	return NULL;
#else
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
	WSACloseEvent (waitEvents[3]);
	_endthread();
	return 0;
#endif
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/ping.proto0000644000175000017500000000167411640407353021412 0ustar  locallocalpackage example;

message SubscriptionHeader {
	required string subject = 1;
}

message MarketDataHeader {
	enum MsgType {
		MSG_VERIFY = 0;
		MSG_UPDATE = 1;
		MSG_CORRECT = 2;
		MSG_CLOSING = 3;
		MSG_DROP = 4;
		MSG_AGGREGATE = 5;
		MSG_STATUS = 6;
		MSG_CANCEL = 7;
		MSG_INITIAL = 8;
	}
	required MsgType msg_type = 1;
	enum RecType {
		PING = 1;
	}
	required RecType rec_type = 2;
	enum RecStatus {
		STATUS_OK = 0;
		STATUS_BAD_NAME = 1;
		STATUS_BAD_LINE = 2;
		STATUS_CACHE_FULL = 3;
		STATUS_PERMISSION_DENIED = 4;
		STATUS_PREEMPTED = 5;
		STATUS_BAD_ACCESS = 6;
		STATUS_TEMP_UNAVAIL = 7;
		STATUS_REASSIGN = 8;
		STATUS_NOSUBSCRIBERS = 9;
		STATUS_EXPIRED = 10;
	}
	required RecStatus rec_status = 3;
}

message Ping {
	required SubscriptionHeader subscription_header = 1;
	required MarketDataHeader market_data_header = 2;
	required fixed64 time = 3;
	required fixed64 seqno = 4;
	required fixed64 latency = 5;
	required bytes payload = 6;
}
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/pgmtop.c0000644000175000017500000005624011640407353021041 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * PGM packet monitor.
 *
 * Copyright (c) 2006-2007 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 

/* PGM internals */
#include 

/* example dependencies */
#include 
#include 


struct ncurses_window;

typedef void (*paint_func)(struct ncurses_window*);
typedef void (*resize_func)(struct ncurses_window*, int, int);

struct ncurses_window {
	WINDOW*		window;
	PANEL*		panel;
	char*		title;
	paint_func	paint;
	resize_func	resize;
};

struct pgm_stat {
	gulong		count, snap_count;
	gulong		bytes, snap_bytes;
	gulong		tsdu;

	gulong		duplicate;
	gulong		invalid;

	struct timeval	last;
	struct timeval	last_valid;
	struct timeval	last_invalid;
};

struct pgm_netstat {
	struct in_addr	addr;
	gulong		corrupt;
};

struct pgm_hoststat {
	pgm_tsi_t	tsi;

	struct in_addr	last_addr;
	struct in_addr	nla;

	gulong		txw_secs;
	gulong		txw_trail;
	gulong		txw_lead;
	gulong		txw_sqns;

	gulong		rxw_trail;
	gulong		rxw_lead;

	gulong		rxw_trail_init;
	gboolean	window_defined;
	gboolean	rxw_constrained;

	gulong		spm_sqn;

	struct pgm_stat	spm,
			poll,
			polr,
			odata,
			rdata,
			nak,
			nnak,
			ncf,
			spmr,

			general;

	struct timeval	session_start;
};


/* globals */

static int g_port = 7500;
static const char* g_network = "239.192.0.1";
static struct in_addr g_filter = { 0 };

static GIOChannel* g_io_channel = NULL;
static GIOChannel* g_stdin_channel = NULL;

static GMainLoop* g_loop = NULL;

static guint g_status_height = 6;
static guint g_info_width = 10;
static time_t start_time;

static struct ncurses_window *g_peer, *g_info, *g_status, *g_active;
static GList* g_window_list = NULL;
static guint g_paint_interval = ( 1 * 1000 ) / 15;
static guint g_snap_interval = 10 * 1000;
static struct timeval g_last_snap, g_now;

static GList* g_status_list = NULL;

static guint32 g_packets = 0;
static GHashTable *g_hosts = NULL;
static GHashTable *g_nets = NULL;

static void init_ncurses (void);
static void paint_ncurses (void);
static void resize_ncurses (int, int);

static void paint_peer (struct ncurses_window*);
static gboolean tsi_row (gpointer, gpointer, gpointer);

static void paint_info (struct ncurses_window*);
static void paint_status (struct ncurses_window*);
static void resize_peer (struct ncurses_window*, int, int);
static void resize_info (struct ncurses_window*, int, int);
static void resize_status (struct ncurses_window*, int, int);

static void write_status (const gchar*, ...) G_GNUC_PRINTF (1, 2);
static void write_statusv (const gchar*, va_list);

static void on_signal (int, gpointer);
static void on_winch (int);
static gboolean on_startup (gpointer);
static gboolean on_snap (gpointer);
static gboolean on_paint (gpointer);

static gboolean on_io_data (GIOChannel*, GIOCondition, gpointer);
static gboolean on_io_error (GIOChannel*, GIOCondition, gpointer);

static gboolean on_stdin_data (GIOChannel*, GIOCondition, gpointer);

int
main (
	G_GNUC_UNUSED int	argc,
	G_GNUC_UNUSED char     *argv[]
	)
{
	GError* err = NULL;
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("pgmtop");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

	g_loop = g_main_loop_new (NULL, FALSE);

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
	signal (SIGHUP,  SIG_IGN);
	pgm_signal_install (SIGINT,  on_signal, g_loop);
	pgm_signal_install (SIGTERM, on_signal, g_loop);

/* delayed startup */
	g_message ("scheduling startup.n");
	g_timeout_add(0, (GSourceFunc)on_startup, g_loop);

/* dispatch loop */
	g_message ("entering main event loop ...");
	g_main_loop_run (g_loop);

	endwin();
	g_message ("event loop terminated, cleaning up.");

/* cleanup */
	g_main_loop_unref (g_loop);
	g_loop = NULL;
	if (g_io_channel) {
		g_message ("closing socket.");
		g_io_channel_shutdown (g_io_channel, FALSE, &err);
		g_io_channel = NULL;
	}

	if (g_stdin_channel) {
		g_message ("unbinding stdin.");
		g_io_channel_unref (g_stdin_channel);
		g_stdin_channel = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

static struct ncurses_window*
create_window (
	char*		name,
	paint_func	paint,
	resize_func	resize
	)
{
	struct ncurses_window* nw = g_malloc0 (sizeof(struct ncurses_window));
	nw->window = newwin (0, 0, 0, 0);
	nw->panel = new_panel (nw->window);
	nw->title = name;

	nw->paint = paint;
	nw->resize = resize;

	g_window_list = g_list_append (g_window_list, nw);
	return nw;
}

/*  +-Peer list --------------++-Info-+
 *  |                         ||      |
 *  |      < peer window >    || < info window >
 *  |                         ||      |
 *  +-------------------------++------+
 *  +-Status--------------------------+
 *  |        < status window >        |
 *  +---------------------------------+
 */

static void
init_ncurses (void)
{
/* setup ncurses terminal display */
	initscr();		/* init ncurses library */

//	signal_install (SIGWINCH, on_winch);

	noecho();		/* hide entered keys */
	cbreak();

/* setup ncurses windows */
	g_peer = create_window ("Peers", paint_peer, resize_peer);

	g_info = create_window ("Info", paint_info, resize_info);
	start_time = time (0);

	g_status = create_window ("Status", paint_status, resize_status);
	scrollok (g_status->window, 1);

	g_active = g_peer;
	top_panel (g_active->panel);

	paint_ncurses();
}

static void
resize_ncurses (
	int		hsize,
	int		vsize
	)
{
	GList* nw_list = g_window_list;
	while (nw_list)
	{
		struct ncurses_window* nw = (struct ncurses_window*)nw_list->data;

		nw->resize (nw, hsize, vsize);

		nw_list = nw_list->next;
	}
}

static void
paint_ncurses (void)
{
	static int hsize = 0, vsize = 0;

	if (hsize != COLS || vsize != LINES)
	{
		hsize = COLS; vsize = LINES;
		resize_ncurses(hsize, vsize);
	}

	GList* nw_list = g_window_list;
	while (nw_list)
	{
		struct ncurses_window* nw = (struct ncurses_window*)nw_list->data;
		werase (nw->window);

		box (nw->window, ACS_VLINE, ACS_HLINE);
		mvwaddstr (nw->window, 0, 2, nw->title);

		nw->paint (nw);

		nw_list = nw_list->next;
	}

/* have cursor stay at top left of active window */
	wmove (g_active->window, 0, 0);

	update_panels();	/* update virtual screen */
	doupdate();		/* update real screen */
}

/* peer window */

static void
paint_peer (
	struct ncurses_window*	nw
	)
{

/*           1         2         3         4         5         6         7         8
 * 012345678901234567890123456789012345678901234567890123456789012345678901234567890
 *  TSI                            Packets Bytes   Packet/s  Bit/s     Data Inv  Dupe
 *  100.200.300.400.500.600.70000  1,000K  1,000MB 1,000     1,000     100% 100% 100%
 */
	mvwaddstr (nw->window, 1, 1, "TSI");
	mvwaddstr (nw->window, 1, 32, "Packets");
	mvwaddstr (nw->window, 1, 40, "Bytes");
	mvwaddstr (nw->window, 1, 48, "Packet/s");
	mvwaddstr (nw->window, 1, 58, "Bit/s");
	mvwaddstr (nw->window, 1, 68, "Data");
	mvwaddstr (nw->window, 1, 73, "Inv");
	mvwaddstr (nw->window, 1, 78, "Dupe");

	if (g_hosts)
	{
		int row = 2;
		gettimeofday(&g_now, NULL);
		g_hash_table_foreach (g_hosts, (GHFunc)tsi_row, &row);
	}
}

static char*
print_si (
	float*			v
	)
{
	static char prefix[5] = "";

	if (*v > 100 * 1000 * 1000) {
		strcpy (prefix, "G");
		*v /= 1000.0 * 1000.0 * 1000.0;
	} else if (*v > 100 * 1000) {
		strcpy (prefix, "M");
		*v /= 1000.0 * 1000.0;
	} else if (*v > 100) {
		strcpy (prefix, "K");
		*v /= 1000.0;
	} else {
		*prefix = 0;
	}

	return prefix;
}

static gboolean
tsi_row (
	G_GNUC_UNUSED gpointer		key,
	gpointer		value,
	gpointer		user_data
	)
{
	struct pgm_hoststat* hoststat = value;
	int* row = user_data;

	float secs = (g_now.tv_sec - g_last_snap.tv_sec) +
			( (g_now.tv_usec - g_last_snap.tv_usec) / 1000.0 / 1000.0 );

/* TSI */
	char* tsi_string = pgm_tsi_print (&hoststat->tsi);
	mvwaddstr (g_peer->window, *row,  1, tsi_string);

/* Packets */
	char buffer[100];
	float v = hoststat->general.count;
	char* prefix = print_si (&v);
	snprintf (buffer, sizeof(buffer), "%lu%s", (gulong)v, prefix);
	mvwaddstr (g_peer->window, *row, 32, buffer);

/* Bytes */
	v = hoststat->general.bytes;
	prefix = print_si (&v);
	snprintf (buffer, sizeof(buffer), "%lu%s", (gulong)v, prefix);
	mvwaddstr (g_peer->window, *row, 40, buffer);

/* Packet/s */
	v = ( hoststat->general.count - hoststat->general.snap_count ) / secs;
	prefix = print_si (&v);
	snprintf (buffer, sizeof(buffer), "%.1f%s", v, prefix);
	mvwaddstr (g_peer->window, *row, 48, buffer);

/* Bit/s */
	float bitrate = ((float)( hoststat->general.bytes - hoststat->general.snap_bytes ) * 8.0 / secs);
	char* bitprefix = print_si (&bitrate);
	snprintf (buffer, sizeof(buffer), "%.1f%s", bitrate, bitprefix);
	mvwaddstr (g_peer->window, *row, 58, buffer);

/* % Data */
	snprintf (buffer, sizeof(buffer), "%d%%", (int)((100.0 * hoststat->odata.tsdu) / hoststat->general.bytes));
	mvwaddstr (g_peer->window, *row, 68, buffer);

/* % Invalid */
	snprintf (buffer, sizeof(buffer), "%d%%", (int)(hoststat->general.invalid ? (100.0 * hoststat->general.invalid) / hoststat->general.count : 0.0));
	mvwaddstr (g_peer->window, *row, 73, buffer);

/* % Duplicate */
	snprintf (buffer, sizeof(buffer), "%d%%", (int)(hoststat->general.duplicate ? (100.0 * hoststat->general.duplicate) / hoststat->general.count : 0.0));
	mvwaddstr (g_peer->window, *row, 78, buffer);

	*row = *row + 1;
			
	return FALSE;
}

static void
resize_peer (
	struct ncurses_window*	nw,
	int			hsize,	/* COLS */
	int			vsize	/* LINES */
	)
{
	wresize (nw->window, vsize - g_status_height, hsize - g_info_width);
	replace_panel (nw->panel, nw->window);
	move_panel (nw->panel, 0, 0);
}

/* info window */

static void
paint_info (
	struct ncurses_window*	nw
	)
{
	char buffer[20];

	mvwaddstr (nw->window, 1, 2, "Peers");
	snprintf (buffer, sizeof(buffer), "%d", g_hosts ? g_hash_table_size (g_hosts) : 0);
	mvwaddstr (nw->window, 2, 2, buffer);

	mvwaddstr (nw->window, 3, 2, "Packets");
	snprintf (buffer, sizeof(buffer), "%d", g_packets);
	mvwaddstr (nw->window, 4, 2, buffer);

	mvwaddstr (nw->window, LINES - g_status_height - 2, 2, "Elapsed");
	time_t elapsed = time(0) - start_time;
	snprintf (buffer, sizeof(buffer), "%02d:%02d:%02d",
			(int) (elapsed / 60) / 60, (int) (elapsed / 60) % 60,
			(int) elapsed % 60);
	mvwaddstr (nw->window, LINES - g_status_height - 1, 1, buffer);
}

static void
resize_info (
	struct ncurses_window*	nw,
	int			hsize,	/* COLS */
	int			vsize	/* LINES */
	)
{
	wresize (nw->window, vsize - g_status_height, g_info_width);
	replace_panel (nw->panel, nw->window);
	move_panel (nw->panel, 0, hsize - g_info_width);
}

/* status window */

static void
paint_status (
	G_GNUC_UNUSED struct ncurses_window*	nw
	)
{
	if (!g_status_list) return;

	guint len = g_list_length (g_status_list);
	while (len > g_status_height) {
		g_free (g_status_list->data);
		g_status_list = g_list_delete_link (g_status_list, g_status_list);
		len--;
	}
	guint y = 1;
	GList* list = g_status_list;
	while (list) {
		mvwaddstr (g_status->window, y++, 3, (char*)list->data);
		list = list->next;
	}
}

static void
resize_status (
	struct ncurses_window*	nw,
	int			hsize,	/* COLS */
	int			vsize	/* LINES */
	)
{
	wresize (nw->window, g_status_height, hsize);
	replace_panel (nw->panel, nw->window);
	move_panel (nw->panel, vsize - g_status_height, 0);
}

static void
write_status (
	const gchar*		format,
	...
	)
{
	va_list args;

	va_start (args, format);
	write_statusv (format, args);
	va_end (args);
}

static void
write_statusv (
	const gchar*		format,
	va_list			args1
	)
{
	char buffer[1024];
	vsnprintf (buffer, sizeof(buffer), format, args1);

	g_status_list = g_list_append (g_status_list, g_memdup (buffer, strlen(buffer)+1));
}

static
void
on_signal (
	int			signum,
	gpointer		user_data
	)
{
	GMainLoop* loop = (GMainLoop*)user_data;
	puts ("on_signal");
	g_main_loop_quit (loop);
}

/* terminal resize signal
 */

static void
on_winch (
	G_GNUC_UNUSED int	signum
	)
{
	paint_ncurses ();
}

static gboolean
on_startup (
	gpointer		user_data
	)
{
	GMainLoop* loop = (GMainLoop*)user_data;
	int e;

	puts ("startup.");

/* find PGM protocol id */
// TODO: fix valgrind errors
	int ipproto_pgm = IPPROTO_PGM;
#if HAVE_GETPROTOBYNAME_R
	char b[1024];
	struct protoent protobuf, *proto;
	e = getprotobyname_r ("pgm", &protobuf, b, sizeof(b), &proto);
	if (e != -1 && proto != NULL) {
		if (proto->p_proto != ipproto_pgm) {
			print f("Setting PGM protocol number to %i from /etc/protocols.\n", proto->p_proto);
			ipproto_pgm = proto->p_proto;
		}
	}
#else
	struct protoent *proto = getprotobyname ("pgm");
	if (proto != NULL) {
		if (proto->p_proto != ipproto_pgm) {
			printf("Setting PGM protocol number to %i from /etc/protocols.\n", proto->p_proto);
			ipproto_pgm = proto->p_proto;
		}
	}
#endif

/* open socket for snooping */
	puts ("opening raw socket.");
	int sock = socket (PF_INET, SOCK_RAW, ipproto_pgm);
	if (sock < 0) {
		int _e = errno;
		puts ("on_startup() failed");

		if (_e == EPERM && 0 != getuid()) {
			puts ("PGM protocol requires this program to run as superuser.");
		}
		g_main_loop_quit (loop);
		return FALSE;
	}

/* drop out of setuid 0 */
	if (0 == getuid ()) {
		puts ("dropping superuser privileges.");
		setuid ((gid_t)65534);
		setgid ((uid_t)65534);
	}

	char _t = 1;
	e = setsockopt (sock, IPPROTO_IP, IP_HDRINCL, &_t, sizeof(_t));
	if (e < 0) {
		printw ("on_startup() failed\n");
		close (sock);
		g_main_loop_quit (loop);
		return FALSE;
	}

/* buffers */
	int buffer_size = 0;
	socklen_t len = 0;
	e = getsockopt (sock, SOL_SOCKET, SO_RCVBUF, &buffer_size, &len);
	if (e == 0) {
		printf ("receive buffer set at %i bytes.\n", buffer_size);
	}
	e = getsockopt (sock, SOL_SOCKET, SO_SNDBUF, &buffer_size, &len);
	if (e == 0) {
		printf ("send buffer set at %i bytes.\n", buffer_size);
	}

/* bind */
	struct sockaddr_in addr;
	memset (&addr, 0, sizeof(addr));
	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = htonl(INADDR_ANY);

	e = bind (sock, (struct sockaddr*)&addr, sizeof(addr));
	if (e < 0) {
		printw ("on_startup() failed\n");
		close (sock);
		g_main_loop_quit (loop);
		return FALSE;
	}

/* multicast */
	struct ip_mreq mreq;
	memset (&mreq, 0, sizeof(mreq));
	mreq.imr_interface.s_addr = htonl(INADDR_ANY);
	printf ("listening on interface %s.\n", inet_ntoa(mreq.imr_interface));
	mreq.imr_multiaddr.s_addr = inet_addr(g_network);
	printf ("subscription on multicast address %s.\n", inet_ntoa(mreq.imr_multiaddr));
	e = setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
	if (e < 0) {
		printw ("on_startup() failed\n");
		close (sock);
		g_main_loop_quit (loop);
		return FALSE;
	}

/* multicast loopback */
/* multicast ttl */

/* add socket to event manager */
	g_io_channel = g_io_channel_unix_new (sock);
	printf ("socket opened with encoding %s.\n", g_io_channel_get_encoding(g_io_channel));

	/* guint event = */ g_io_add_watch (g_io_channel, G_IO_IN | G_IO_PRI, on_io_data, NULL);
	/* guint event = */ g_io_add_watch (g_io_channel, G_IO_ERR | G_IO_HUP | G_IO_NVAL, on_io_error, NULL);

/* add stdin to event manager */
	g_stdin_channel = g_io_channel_unix_new (fileno(stdin));
	printf ("binding stdin with encoding %s.\n", g_io_channel_get_encoding(g_stdin_channel));

	g_io_add_watch (g_stdin_channel, G_IO_IN | G_IO_PRI, on_stdin_data, NULL);

/* periodic timer to snapshot statistics */
	g_timeout_add (g_snap_interval, (GSourceFunc)on_snap, NULL);

/* period timer to update screen */
	g_timeout_add (g_paint_interval, (GSourceFunc)on_paint, NULL);

	puts ("READY");

	init_ncurses();
	return FALSE;
}

static gboolean
on_paint (
	G_GNUC_UNUSED gpointer data
	)
{
	paint_ncurses();

	return TRUE;
}

static guint
tsi_hash (
        gconstpointer v
        )
{
	return g_str_hash(pgm_tsi_print(v));
}

static gint
tsi_equal (
        gconstpointer   v,
        gconstpointer   v2
        )
{
	return memcmp (v, v2, (6 * sizeof(guint8)) + sizeof(guint16)) == 0;
}

static gboolean
on_io_data (
	GIOChannel* source,
	G_GNUC_UNUSED GIOCondition condition,
	G_GNUC_UNUSED gpointer user_data
	)
{
	struct timeval now;
	struct pgm_sk_buff_t* skb = pgm_alloc_skb (4096);
	struct sockaddr_storage src, dst;
	struct sockaddr_in* sin = (struct sockaddr_in*)&src;
	socklen_t src_addr_len = sizeof(src);
	int fd = g_io_channel_unix_get_fd(source);

	skb->len = recvfrom(fd, skb->head, 4096, MSG_DONTWAIT, (struct sockaddr*)&src, &src_addr_len);

	gettimeofday (&now, NULL);
	g_packets++;

	GError* err = NULL;
	gboolean is_valid = pgm_parse_raw (skb, (struct sockaddr*)&dst, &err);
	if (!is_valid && err && PGM_PACKET_ERROR_CKSUM == err->code)
	{
/* corrupt packet */
		if (!g_nets) {
			g_nets = g_hash_table_new (g_int_hash, g_int_equal);
		}

		struct pgm_netstat* netstat = g_hash_table_lookup (g_nets, &sin->sin_addr);
		if (netstat == NULL) {
			write_status ("new host publishing corrupt data, local nla %s", inet_ntoa(sin->sin_addr));
			netstat = g_malloc0(sizeof(struct pgm_netstat));
			netstat->addr = sin->sin_addr;
			g_hash_table_insert (g_nets, (gpointer)&netstat->addr, (gpointer)netstat);
		}

		netstat->corrupt++;
		pgm_free_skb (skb);
		return TRUE;
	}
	else if (!is_valid)
	{
/* general error */
		pgm_free_skb (skb);
		return TRUE;
	}

/* search for existing session */
	if (!g_hosts) {
		g_hosts = g_hash_table_new (tsi_hash, tsi_equal);
	}

	struct pgm_hoststat* hoststat = g_hash_table_lookup (g_hosts, &skb->tsi);
	if (hoststat == NULL) {
		write_status ("new tsi %s with local nla %s", pgm_tsi_print (&skb->tsi), inet_ntoa(sin->sin_addr));

		hoststat = g_malloc0(sizeof(struct pgm_hoststat));
		memcpy (&hoststat->tsi, &skb->tsi, sizeof(pgm_tsi_t));
		hoststat->session_start = now;

		g_hash_table_insert (g_hosts, (gpointer)&hoststat->tsi, (gpointer)hoststat);
	}

/* increment statistics */
	memcpy (&hoststat->last_addr, &sin->sin_addr, sizeof(sin->sin_addr));
	hoststat->general.count++;
	hoststat->general.bytes += skb->len;
	hoststat->general.last = now;

	skb->data	= (guint8*)skb->data + sizeof(struct pgm_header);
	skb->len       -= sizeof(struct pgm_header);

/* repurpose is_valid for PGM subtype */
	is_valid = FALSE;
	switch (skb->pgm_header->pgm_type) {
	case PGM_SPM:
		hoststat->spm.count++;
		hoststat->spm.bytes += skb->len;
		hoststat->spm.last = now;

		is_valid = pgm_verify_spm (skb);
		if (!is_valid) {
			hoststat->spm.invalid++;
			hoststat->spm.last_invalid = now;
		} else {
			const struct pgm_spm* spm = (struct pgm_spm*)skb->data;

			hoststat->nla.s_addr = spm->spm_nla.s_addr;
			if (pgm_uint32_lte (g_ntohl( spm->spm_sqn ), hoststat->spm_sqn)) {
				hoststat->general.duplicate++;
				break;
			}
			hoststat->spm_sqn = g_ntohl( spm->spm_sqn );
			hoststat->txw_trail = g_ntohl( spm->spm_trail );
			hoststat->txw_lead = g_ntohl( spm->spm_lead );
			hoststat->rxw_trail = hoststat->txw_trail;
			hoststat->window_defined = TRUE;
		}
		break;

	case PGM_ODATA:
		hoststat->odata.count++;
		hoststat->odata.bytes += skb->len;
		hoststat->odata.last = now;

		const struct pgm_data* data = (struct pgm_data*)skb->data;

		if (!hoststat->window_defined) {
			hoststat->rxw_lead = g_ntohl (data->data_sqn) - 1;
			hoststat->rxw_trail = hoststat->rxw_trail_init = hoststat->rxw_lead + 1;
			hoststat->rxw_constrained = TRUE;
			hoststat->window_defined = TRUE;
		} else {
			if (! pgm_uint32_gte( g_ntohl (data->data_sqn) , hoststat->rxw_trail ) )
			{
				hoststat->odata.invalid++;
				hoststat->odata.last_invalid = now;
				break;
			}
			hoststat->rxw_trail = g_ntohl (data->data_trail);
		}

		if (hoststat->rxw_constrained && hoststat->txw_trail > hoststat->rxw_trail_init) {
			hoststat->rxw_constrained = FALSE;
		}

		if ( pgm_uint32_lte ( g_ntohl (data->data_sqn), hoststat->rxw_lead ) ) {
			hoststat->general.duplicate++;
			break;
		} else {
			hoststat->rxw_lead = g_ntohl (data->data_sqn);

			hoststat->odata.tsdu += g_ntohs (skb->pgm_header->pgm_tsdu_length);
		}
		break;

	case PGM_RDATA:
		hoststat->rdata.count++;
		hoststat->rdata.bytes += skb->len;
		hoststat->rdata.last = now;
		break;

	case PGM_POLL:
		hoststat->poll.count++;
		hoststat->poll.bytes += skb->len;
		hoststat->poll.last = now;
		break;

	case PGM_POLR:
		hoststat->polr.count++;
		hoststat->polr.bytes += skb->len;
		hoststat->polr.last = now;
		break;

	case PGM_NAK:
		hoststat->nak.count++;
		hoststat->nak.bytes += skb->len;
		hoststat->nak.last = now;

		is_valid = pgm_verify_nak (skb);
		if (!is_valid) {
			hoststat->nak.invalid++;
			hoststat->nak.last_invalid = now;
		}
		break;

	case PGM_NNAK:
		hoststat->nnak.count++;
		hoststat->nnak.bytes += skb->len;
		hoststat->nnak.last = now;
		break;

	case PGM_NCF:
		hoststat->ncf.count++;
		hoststat->ncf.bytes += skb->len;
		hoststat->ncf.last = now;
		break;

	case PGM_SPMR:
		hoststat->spmr.count++;
		hoststat->spmr.bytes += skb->len;
		hoststat->spmr.last = now;

		is_valid = pgm_verify_spmr (skb);
		if (!is_valid) {
			hoststat->spmr.invalid++;
			hoststat->spmr.last_invalid = now;
		}
		break;

	default:
		break;
	}

	if (!is_valid) {
		hoststat->general.invalid++;
		hoststat->general.last_invalid = now;
	} else {
		hoststat->general.last_valid = now;
	}

	pgm_free_skb (skb);
	return TRUE;
}

static gboolean
on_io_error (
	GIOChannel* source,
	G_GNUC_UNUSED GIOCondition condition,
	G_GNUC_UNUSED gpointer data
	)
{
	puts ("on_error.");

	GError *err;
	g_io_channel_shutdown (source, FALSE, &err);

/* remove event */
	return FALSE;
}

/* process input commands from stdin/fd 
 */

static gboolean
on_stdin_data (
	G_GNUC_UNUSED GIOChannel*	source,
	G_GNUC_UNUSED GIOCondition	condition,
	G_GNUC_UNUSED gpointer	data
	)
{
	int ch = wgetch (g_active->window);
	if (ch == ERR) {
		goto out;
	}

/* force redraw */
	if (ch == 12) {
		clearok (curscr, TRUE);
		paint_ncurses ();
		goto out;
	}

	if (ch == 'q') {
		g_main_loop_quit(g_loop);
	}

out:
	return TRUE;
}

static gboolean
snap_stat (
	G_GNUC_UNUSED gpointer	key,
	gpointer	value,
	G_GNUC_UNUSED gpointer	user_data
	)
{
	struct pgm_hoststat* hoststat = value;

#define SNAP_STAT(name) \
	{ \
		hoststat->name.snap_count = hoststat->name.count; \
		hoststat->name.snap_bytes = hoststat->name.bytes; \
	}

	SNAP_STAT(spm);
	SNAP_STAT(poll);
	SNAP_STAT(polr);
	SNAP_STAT(odata);
	SNAP_STAT(rdata);
	SNAP_STAT(nak);
	SNAP_STAT(nnak);
	SNAP_STAT(ncf);
	SNAP_STAT(spmr);

	SNAP_STAT(general);

	return FALSE;
}

static gboolean
on_snap (
	gpointer	data
	)
{
	if (!g_hosts) return TRUE;

	gettimeofday (&g_last_snap, NULL);
	g_hash_table_foreach (g_hosts, (GHFunc)snap_stat, NULL);

	return TRUE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/blocksyncrecv.c0000644000175000017500000002255711640407353022406 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple PGM receiver: blocking synchronous receiver 
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#ifndef G_OS_WIN32
#	include 
#else
#	include "getopt.h"
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static gboolean		g_quit = FALSE;

#ifdef G_OS_UNIX
static void on_signal (int);
#else
static BOOL on_console_ctrl (DWORD);
#endif
static gboolean on_startup (void);
static int on_data (gconstpointer, size_t, struct pgm_sockaddr_t*);


G_GNUC_NORETURN static
void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("blocksyncrecv");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:lh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'l':	g_multicast_loop = TRUE; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}

/* setup signal handlers */
	signal(SIGSEGV, on_sigsegv);
#ifdef SIGHUP
	signal(SIGHUP,  SIG_IGN);
#endif
#ifdef G_OS_UNIX
	signal(SIGINT,  on_signal);
	signal(SIGTERM, on_signal);
#else
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif

	on_startup();

/* dispatch loop */
	g_message ("entering PGM message loop ... ");
	do {
		char buffer[4096];
		size_t len;
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof(from);
		const int status = pgm_recvfrom (g_sock,
					         buffer,
					         sizeof(buffer),
					         0,
					         &len,
					         &from,
						 &fromlen,
					         &pgm_err);
		if (PGM_IO_STATUS_NORMAL == status)
			on_data (buffer, len, &from);
		else {
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

	g_message ("message loop terminated, cleaning up.");

/* cleanup */
	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

#ifdef G_OS_UNIX
static
void
on_signal (
	int		signum
	)
{
	g_message ("on_signal (signum:%d)", signum);
	g_quit = TRUE;
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType);
	g_quit = TRUE;
	return TRUE;
}
#endif /* !G_OS_UNIX */

static
gboolean
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int blocking = 0,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &blocking, sizeof(blocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	g_message ("startup complete.");
	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_data (
	gconstpointer		data,
	size_t			len,
	struct pgm_sockaddr_t*	from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN( sizeof(buf) - 1, len );
	strncpy (buf, data, buflen);
	buf[buflen] = '\0';
	pgm_tsi_print_r (&from->sa_addr, tsi, sizeof(tsi));

	g_message ("\"%s\" (%u bytes from %s)",
			buf,
			(unsigned)len,
			tsi);

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/pgmrecv.c0000644000175000017500000004250211640407353021172 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple receiver using the PGM transport, based on enonblocksyncrecvmsgv :/
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef CONFIG_HAVE_EPOLL
#	include 
#endif
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#	include 
#else
#	include "getopt.h"
#endif
#include 
#ifdef CONFIG_WITH_HTTP
#	include 
#endif
#ifdef CONFIG_WITH_SNMP
#	include 
#endif

/* example dependencies */
#include 
#include 
#include 


/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static const char*	g_source = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static GThread*		g_thread = NULL;
static GMainLoop*	g_loop = NULL;
static gboolean		g_quit;
#ifdef G_OS_UNIX
static int		g_quit_pipe[2];
static void on_signal (int, gpointer);
#else
static HANDLE		g_quit_event;
static BOOL on_console_ctrl (DWORD);
#endif

static gboolean on_startup (gpointer);
static gboolean on_mark (gpointer);

static gpointer receiver_thread (gpointer);
static int on_msgv (struct pgm_msgv_t*, size_t);


G_GNUC_NORETURN static void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -a  : Source unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
#ifdef CONFIG_WITH_HTTP
	fprintf (stderr, "  -H              : Enable HTTP administrative interface\n");
#endif
#ifdef CONFIG_WITH_SNMP
	fprintf (stderr, "  -S              : Enable SNMP interface\n");
#endif
	fprintf (stderr, "  -i              : List available interfaces\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;
#ifdef CONFIG_WITH_HTTP
	gboolean enable_http = FALSE;
#endif
#ifdef CONFIG_WITH_SNMP
	gboolean enable_snmpx = FALSE;
#endif

	setlocale (LC_ALL, "");

/* pre-initialise PGM messages module to add hook for GLib logging */
	pgm_messages_init();
	log_init ();
	g_message ("pgmrecv");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", (pgm_err && pgm_err->message) ? pgm_err->message : "(null)");
		pgm_error_free (pgm_err);
		pgm_messages_shutdown();
		return EXIT_FAILURE;
	}

	g_thread_init (NULL);

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "a:s:n:p:lih"
#ifdef CONFIG_WITH_HTTP
					"H"
#endif
#ifdef CONFIG_WITH_SNMP
					"S"
#endif
					)) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 'a':	g_source = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;

		case 'l':	g_multicast_loop = TRUE; break;
#ifdef CONFIG_WITH_HTTP
		case 'H':	enable_http = TRUE; break;
#endif
#ifdef CONFIG_WITH_SNMP
		case 'S':	enable_snmpx = TRUE; break;
#endif

		case 'i':
			pgm_if_print_all();
			pgm_messages_shutdown();
			return EXIT_SUCCESS;

		case 'h':
		case '?':
			pgm_messages_shutdown();
			usage (binary_name);
		}
	}

#ifdef CONFIG_WITH_HTTP
	if (enable_http) {
		if (!pgm_http_init (PGM_HTTP_DEFAULT_SERVER_PORT, &pgm_err)) {
			g_error ("Unable to start HTTP interface: %s", pgm_err->message);
			pgm_error_free (pgm_err);
			pgm_shutdown();
			pgm_messages_shutdown();
			return EXIT_FAILURE;
		}
	}
#endif
#ifdef CONFIG_WITH_SNMP
	if (enable_snmpx) {
		if (!pgm_snmp_init (&pgm_err)) {
			g_error ("Unable to start SNMP interface: %s", pgm_err->message);
			pgm_error_free (pgm_err);
#ifdef CONFIG_WITH_HTTP
			if (enable_http)
				pgm_http_shutdown ();
#endif
			pgm_shutdown ();
			pgm_messages_shutdown();
	 		return EXIT_FAILURE;
		}
	}
#endif

	g_loop = g_main_loop_new (NULL, FALSE);

	g_quit = FALSE;

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif
#ifdef G_OS_UNIX
	const int e = pipe (g_quit_pipe);
	g_assert (0 == e);
	pgm_signal_install (SIGINT,  on_signal, g_loop);
	pgm_signal_install (SIGTERM, on_signal, g_loop);
#else
	g_quit_event = CreateEvent (NULL, TRUE, FALSE, TEXT("QuitEvent"));
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif

/* delayed startup */
	g_message ("scheduling startup.");
	g_timeout_add (0, (GSourceFunc)on_startup, NULL);

/* dispatch loop */
	g_message ("entering main event loop ... ");
	g_main_loop_run (g_loop);

	g_message ("event loop terminated, cleaning up.");

/* cleanup */
	g_quit = TRUE;
#ifdef G_OS_UNIX
	const char one = '1';
	const size_t writelen = write (g_quit_pipe[1], &one, sizeof(one));
	g_assert (sizeof(one) == writelen);
	g_thread_join (g_thread);
	close (g_quit_pipe[0]);
	close (g_quit_pipe[1]);
#else
	WSASetEvent (g_quit_event);
	g_thread_join (g_thread);
	WSACloseEvent (g_quit_event);
#endif

	g_main_loop_unref (g_loop);
	g_loop = NULL;

	if (g_sock) {
		g_message ("closing PGM socket.");

		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

#ifdef CONFIG_WITH_HTTP
	if (enable_http)
		pgm_http_shutdown();
#endif
#ifdef CONFIG_WITH_SNMP
	if (enable_snmpx)
		pgm_snmp_shutdown();
#endif

	g_message ("PGM engine shutdown.");
	pgm_shutdown();
	g_message ("finished.");
	pgm_messages_shutdown();
	return EXIT_SUCCESS;
}

#ifdef G_OS_UNIX
static
void
on_signal (
	int		signum,
	gpointer	user_data
	)
{
	GMainLoop* loop = (GMainLoop*)user_data;
	g_message ("on_signal (signum:%d user_data:%p)",
		   signum, user_data);
	g_main_loop_quit (loop);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType);
	g_main_loop_quit (g_loop);
	return TRUE;
}
#endif /* !G_OS_UNIX */

static
gboolean
on_startup (
	G_GNUC_UNUSED gpointer data
	)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* create receiver thread */
	GError* glib_err = NULL;
	g_thread = g_thread_create_full (receiver_thread,
					 g_sock,
					 0,
					 TRUE,
					 TRUE,
					 G_THREAD_PRIORITY_HIGH,
					 &glib_err);
	if (!g_thread) {
		g_error ("g_thread_create_full failed errno %i: \"%s\"", glib_err->code, glib_err->message);
		g_error_free (glib_err);
		goto err_abort;
	}

/* period timer to indicate some form of life */
// TODO: Gnome 2.14: replace with g_timeout_add_seconds()
	g_timeout_add(10 * 1000, (GSourceFunc)on_mark, NULL);

	g_message ("startup complete.");
	return FALSE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	g_main_loop_quit (g_loop);
	return FALSE;
}

/* idle log notification
 */

static
gboolean
on_mark (
	G_GNUC_UNUSED gpointer data
	)
{
	g_message ("-- MARK --");
	return TRUE;
}

static
gpointer
receiver_thread (
	gpointer	data
	)
{
	pgm_sock_t* rx_sock = (pgm_sock_t*)data;
	const long iov_len = 20;
	const long ev_len  = 1;
	struct pgm_msgv_t msgv[iov_len];

#ifdef CONFIG_HAVE_EPOLL
	struct epoll_event events[ev_len];	/* wait for maximum 1 event */
	const int efd = epoll_create (IP_MAX_MEMBERSHIPS);
	if (efd < 0) {
		g_error ("epoll_create failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}

	if (pgm_epoll_ctl (rx_sock, efd, EPOLL_CTL_ADD, EPOLLIN) < 0)
	{
		g_error ("pgm_epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
	struct epoll_event event;
	event.events = EPOLLIN;
	event.data.fd = g_quit_pipe[0];
	if (epoll_ctl (efd, EPOLL_CTL_ADD, g_quit_pipe[0], &event) < 0)
	{
		g_error ("epoll_ctl failed errno %i: \"%s\"", errno, strerror(errno));
		g_main_loop_quit (g_loop);
		return NULL;
	}
#elif defined(CONFIG_HAVE_POLL)
	int n_fds = 2;
	struct pollfd fds[ 1 + n_fds ];
#elif defined(G_OS_UNIX) /* HAVE_SELECT */
	int n_fds;
	fd_set readfds;
#else /* G_OS_WIN32 */
	SOCKET recv_sock, pending_sock;
	DWORD cEvents = PGM_RECV_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ PGM_RECV_SOCKET_READ_COUNT + 1 ];
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = g_quit_event;
	waitEvents[1] = WSACreateEvent ();
	pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	waitEvents[2] = WSACreateEvent ();
	pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[2], FD_READ);
#endif /* !CONFIG_HAVE_EPOLL */

	do {
		struct timeval tv;
#ifndef _WIN32
		int timeout;
#else
		DWORD dwTimeout, dwEvents;
#endif
		size_t len;
		pgm_error_t* pgm_err = NULL;
		const int status = pgm_recvmsgv (rx_sock,
					         msgv,
					         G_N_ELEMENTS(msgv),
					         0,
					         &len,
					         &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_msgv (msgv, len);
			break;
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
block:
#ifdef CONFIG_HAVE_EPOLL
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			epoll_wait (efd, events, G_N_ELEMENTS(events), timeout /* ms */);
#elif defined(CONFIG_HAVE_POLL)
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			memset (fds, 0, sizeof(fds));
			fds[0].fd = g_quit_pipe[0];
			fds[0].events = POLLIN;
			pgm_poll_info (rx_sock, &fds[1], &n_fds, POLLIN);
			poll (fds, 1 + n_fds, timeout /* ms */);
#elif defined(G_OS_UNIX) /* HAVE_SELECT */
			FD_ZERO(&readfds);
			FD_SET(g_quit_pipe[0], &readfds);
			n_fds = g_quit_pipe[0] + 1;
			pgm_select_info (rx_sock, &readfds, NULL, &n_fds);
			select (n_fds, &readfds, NULL, NULL, PGM_IO_STATUS_RATE_LIMITED == status ? &tv : NULL);
#else /* G_OS_WIN32 */
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break;
			default: break;
			}
#endif /* !CONFIG_HAVE_EPOLL */
			break;

		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

#ifdef CONFIG_HAVE_EPOLL
	close (efd);
#elif defined(G_OS_WIN32)
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
#  if (__STDC_VERSION__ < 199901L)
	g_free (waitHandles);
#  endif
#endif
	return NULL;
}

static
int
on_msgv (
	struct pgm_msgv_t*	msgv,		/* an array of msgvs */
	size_t			len
	)
{
        g_message ("(%u bytes)",
                        (unsigned)len);

        guint i = 0;
/* for each apdu */
	do {
                const struct pgm_sk_buff_t* pskb = msgv[i].msgv_skb[0];
		gsize apdu_len = 0;
		for (unsigned j = 0; j < msgv[i].msgv_len; j++)
			apdu_len += msgv[i].msgv_skb[j]->len;
/* truncate to first fragment to make GLib printing happy */
		char buf[2048], tsi[PGM_TSISTRLEN];
		const gsize buflen = MIN(sizeof(buf) - 1, pskb->len);
		strncpy (buf, (const char*)pskb->data, buflen);
		buf[buflen] = '\0';
		pgm_tsi_print_r (&pskb->tsi, tsi, sizeof(tsi));
		if (msgv[i].msgv_len > 1)
			g_message ("\t%u: \"%s\" ... (%" G_GSIZE_FORMAT " bytes from %s)",
				   i, buf, apdu_len, tsi);
		else
			g_message ("\t%u: \"%s\" (%" G_GSIZE_FORMAT " bytes from %s)",
				   i, buf, apdu_len, tsi);
		i++;
		len -= apdu_len;
        } while (len);

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/purinrecv.c0000644000175000017500000003345111640407353021547 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * プリン PGM receiver
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/* MSVC secure CRT */
#define _CRT_SECURE_NO_WARNINGS		1

#include 
#include 
#include 
#include 
#include 
#ifdef _MSC_VER
#	include 
#endif
#ifndef _WIN32
#	include 
#else
#	include "getopt.h"
#endif
#ifdef __APPLE__
#	include 
#endif
#include 


/* globals */

static int		port = 0;
static const char*	network = "";
static bool		use_multicast_loop = FALSE;
static int		udp_encap_port = 0;

static int		max_tpdu = 1500;
static int		sqns = 100;

static bool		use_pgmcc = FALSE;
static bool		use_fec = FALSE;
static int		rs_k = 8;
static int		rs_n = 255;

static pgm_sock_t*	sock = NULL;
static bool		is_terminated = FALSE;

#ifndef _WIN32
static int		terminate_pipe[2];
static void on_signal (int);
#else
static WSAEVENT		terminateEvent;
static BOOL on_console_ctrl (DWORD);
#endif
#ifndef _MSC_VER
static void usage (const char*) __attribute__((__noreturn__));
#else
static void usage (const char*);
#endif

static bool on_startup (void);
static int on_data (const void*restrict, const size_t, const struct pgm_sockaddr_t*restrict);


static void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -c              : Enable PGMCC\n");
	fprintf (stderr, "  -f        : Enable FEC with either proactive or ondemand parity\n");
	fprintf (stderr, "  -K           : Configure Reed-Solomon code (n, k)\n");
	fprintf (stderr, "  -N \n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	fprintf (stderr, "  -i              : List available interfaces\n");
	exit (EXIT_SUCCESS);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

#if !defined(_WIN32)
	puts ("プリン プリン");
#else
/* Windows consoles have incredibly limited Unicode support */
	puts ("purin purin");
#endif
	if (!pgm_init (&pgm_err)) {
		fprintf (stderr, "Unable to start PGM engine: %s\n", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
#ifdef _WIN32
	const char* binary_name = strrchr (argv[0], '\\');
#else
	const char* binary_name = strrchr (argv[0], '/');
#endif
	if (NULL == binary_name)	binary_name = argv[0];
	else				binary_name++;

	int c;
	while ((c = getopt (argc, argv, "s:n:p:cf:K:N:lih")) != -1)
	{
		switch (c) {
		case 'n':	network = optarg; break;
		case 's':	port = atoi (optarg); break;
		case 'p':	udp_encap_port = atoi (optarg); break;
		case 'c':	use_pgmcc = TRUE; break;
		case 'f':	use_fec = TRUE; break;
		case 'K':	rs_k = atoi (optarg); break;
		case 'N':	rs_n = atoi (optarg); break;
		case 'l':	use_multicast_loop = TRUE; break;

		case 'i':
			pgm_if_print_all();
			return EXIT_SUCCESS;

		case 'h':
		case '?': usage (binary_name);
		}
	}

	if (use_fec && ( !rs_n || !rs_k )) {
		fprintf (stderr, "Invalid Reed-Solomon parameters RS(%d,%d).\n", rs_n, rs_k);
		usage (binary_name);
	}

/* setup signal handlers */
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif
#ifndef _WIN32
	int e = pipe (terminate_pipe);
	assert (0 == e);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#else
	terminateEvent = WSACreateEvent();
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif /* !_WIN32 */

	if (!on_startup()) {
		fprintf (stderr, "Startup failed\n");
		return EXIT_FAILURE;
	}

/* dispatch loop */
#ifndef _WIN32
	int fds;
	fd_set readfds;
#else
	SOCKET recv_sock, pending_sock;
	DWORD cEvents = PGM_RECV_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ PGM_RECV_SOCKET_READ_COUNT + 1 ];
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = terminateEvent;
	waitEvents[1] = WSACreateEvent();
	waitEvents[2] = WSACreateEvent();
	assert (2 == PGM_RECV_SOCKET_READ_COUNT);
	pgm_getsockopt (sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	pgm_getsockopt (sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[2], FD_READ);
#endif /* !_WIN32 */
	puts ("Entering PGM message loop ... ");
	do {
		struct timeval tv;
#ifdef _WIN32
		DWORD dwTimeout, dwEvents;
#endif
		char buffer[4096];
		size_t len;
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof (from);
		const int status = pgm_recvfrom (sock,
					         buffer,
					         sizeof(buffer),
					         0,
					         &len,
					         &from,
						 &fromlen,
					         &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_data (buffer, len, &from);
			break;
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
		case PGM_IO_STATUS_WOULD_BLOCK:
/* select for next event */
block:
#ifndef _WIN32
			fds = terminate_pipe[0] + 1;
			FD_ZERO(&readfds);
			FD_SET(terminate_pipe[0], &readfds);
			pgm_select_info (sock, &readfds, NULL, &fds);
			fds = select (fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#else
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break;
			default: break;
			}
#endif /* !_WIN32 */
			break;

		default:
			if (pgm_err) {
				fprintf (stderr, "%s\n", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!is_terminated);

	puts ("Message loop terminated, cleaning up.");

/* cleanup */
#ifndef _WIN32
	close (terminate_pipe[0]);
	close (terminate_pipe[1]);
#else
	WSACloseEvent (waitEvents[0]);
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
#endif /* !_WIN32 */

	if (sock) {
		puts ("Destroying PGM socket.");
		pgm_close (sock, TRUE);
		sock = NULL;
	}

	puts ("PGM engine shutdown.");
	pgm_shutdown ();
	puts ("finished.");
	return EXIT_SUCCESS;
}

#ifndef _WIN32
static
void
on_signal (
	int		signum
	)
{
	printf ("on_signal (signum:%d)\n", signum);
	is_terminated = TRUE;
	const char one = '1';
	const size_t writelen = write (terminate_pipe[1], &one, sizeof(one));
	assert (sizeof(one) == writelen);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	printf ("on_console_ctrl (dwCtrlType:%lu)\n", (unsigned long)dwCtrlType);
	is_terminated = TRUE;
	WSASetEvent (terminateEvent);
	return TRUE;
}
#endif /* !_WIN32 */

static
bool
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into PGM socket address structure */
	if (!pgm_getaddrinfo (network, NULL, &res, &pgm_err)) {
		fprintf (stderr, "Parsing network parameter: %s\n", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (udp_encap_port) {
		puts ("Create PGM/UDP socket.");
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			fprintf (stderr, "Creating PGM/UDP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
	} else {
		puts ("Create PGM/IP socket.");
		if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			fprintf (stderr, "Creating PGM/IP socket: %s\n", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu, sizeof(max_tpdu));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_RXW_SQNS, &sqns, sizeof(sqns));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

#ifdef I_UNDERSTAND_PGMCC_AND_FEC_ARE_NOT_SUPPORTED
	if (use_pgmcc) {
		struct pgm_pgmccinfo_t pgmccinfo;
		pgmccinfo.ack_bo_ivl 		= pgm_msecs (50);
		pgmccinfo.ack_c			= 75;
		pgmccinfo.ack_c_p		= 500;
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_USE_PGMCC, &pgmccinfo, sizeof(pgmccinfo));
	}
	if (use_fec) {
		struct pgm_fecinfo_t fecinfo;
		fecinfo.block_size		= rs_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= rs_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= FALSE;
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}
#endif

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = port ? port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		fprintf (stderr, "Creating GSI: %s\n", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		fprintf (stderr, "Binding PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = use_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (sock, &pgm_err)) {
		fprintf (stderr, "Connecting PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

	puts ("Startup complete.");
	return TRUE;

err_abort:
	if (NULL != sock) {
		pgm_close (sock, FALSE);
		sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	if (NULL != sock) {
		pgm_close (sock, FALSE);
		sock = NULL;
	}
	return FALSE;
}

static
int
on_data (
	const void*     	     restrict data,
	const size_t		  	      len,
	const struct pgm_sockaddr_t* restrict from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN(sizeof(buf) - 1, len);
#ifndef CONFIG_HAVE_SECURITY_ENHANCED_CRT
	strncpy (buf, (const char*)data, buflen);
	buf[buflen] = '\0';
#else
	strncpy_s (buf, buflen, (const char*)data, _TRUNCATE);
#endif
	pgm_tsi_print_r (&from->sa_addr, tsi, sizeof(tsi));
#ifndef _WIN32
	printf ("\"%s\" (%zu bytes from %s)\n",
			buf, len, tsi);
#else
/* Microsoft CRT will crash on %zu */
	printf ("\"%s\" (%lu bytes from %s)\n",
			buf, (unsigned long)len, tsi);
#endif
	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/enonblocksyncrecvmsg.c0000644000175000017500000002456511640407353023776 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple PGM receiver: blocking synchronous receiver with scatter/gather io
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static gboolean		g_quit = FALSE;

static void on_signal (int);
static gboolean on_startup (void);

static int on_datav (struct pgm_msgv_t*, size_t);


G_GNUC_NORETURN static
void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("enonblocksyncrecvmsg");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:lh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'l':	g_multicast_loop = TRUE; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif

	if (!on_startup ()) {
		g_error ("startup failed");
		return EXIT_FAILURE;
	}

/* epoll file descriptor */
	int efd = epoll_create (IP_MAX_MEMBERSHIPS);
	if (efd < 0) {
		g_error ("epoll_create failed errno %i: \"%s\"", errno, strerror(errno));
		return EXIT_FAILURE;
	}

	int retval = pgm_epoll_ctl (g_sock, efd, EPOLL_CTL_ADD, EPOLLIN);
	if (retval < 0) {
		g_error ("pgm_epoll_ctl failed.");
		return EXIT_FAILURE;
	}

/* incoming message buffer */
	struct pgm_msgv_t msgv;
	struct epoll_event events[1];	/* wait for maximum 1 event */

/* dispatch loop */
	g_message ("entering PGM message loop ... ");
	do {
		struct timeval tv;
		int timeout;
		size_t len;
		const int status = pgm_recvmsg (g_sock,
					        &msgv,
					        0,
					        &len,
					        &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_datav (&msgv, len);
			break;

		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			epoll_wait (efd, events, G_N_ELEMENTS(events), timeout /* ms */);
			break;

		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

	g_message ("message loop terminated, cleaning up.");

/* cleanup */
	close (efd);
	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

static
void
on_signal (
	int		signum
	)
{
	g_message ("on_signal (signum:%d)", signum);
	g_quit = TRUE;
}

static
gboolean
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	g_message ("startup complete.");
	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_datav (
	struct pgm_msgv_t*	datav,			/* one msgv object */
	size_t			len
	)
{
	char tsi[PGM_TSISTRLEN];
	pgm_tsi_print_r (&datav->msgv_skb[0]->tsi, tsi, sizeof(tsi));
	g_message ("(%u bytes from %s)", (unsigned)len, tsi);

/* protect against non-null terminated strings */
	const struct pgm_sk_buff_t* skb = datav->msgv_skb[0];
	int i = 0;
	while (len)
	{
		char buf[1024];
		const size_t buflen = MIN( sizeof(buf) - 1, skb->len );
		strncpy (buf, (const char*)skb->data, buflen);
		buf[buflen] = '\0';
		g_message ("\t%i: %s (%" G_GUINT16_FORMAT " bytes)", ++i, buf, skb->len);
		len -= skb->len;
		skb++;
	}

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/pgmdump.c0000644000175000017500000001465511640407353021210 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Dump PGM packets to the console.
 *
 * Copyright (c) 2006-2007 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#endif

#include 

#define GETTEXT_PACKAGE		"pgmdump"

/* PGM internals */
#include 

/* example dependencies */
#include 
#include 


/* globals */

static const char* g_network = "239.192.0.1";

static GIOChannel* g_io_channel = NULL;
static GMainLoop* g_loop = NULL;


static void on_signal (int);
static gboolean on_startup (gpointer);
static gboolean on_mark (gpointer);

static gboolean on_io_data (GIOChannel*, GIOCondition, gpointer);


int
main (
	G_GNUC_UNUSED int	argc,
	G_GNUC_UNUSED char   *argv[]
	)
{
	GError* err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("pgmdump");

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
	signal (SIGINT, on_signal);
	signal (SIGTERM, on_signal);
#ifdef SIGHUP
	signal (SIGHUP, SIG_IGN);
#endif

/* delayed startup */
	g_message ("scheduling startup.");
	g_timeout_add (0, (GSourceFunc)on_startup, NULL);

/* dispatch loop */
	g_loop = g_main_loop_new (NULL, FALSE);

	g_message ("entering main event loop ... ");
	g_main_loop_run (g_loop);

	g_message ("event loop terminated, cleaning up.");

/* cleanup */
	g_main_loop_unref (g_loop);
	g_loop = NULL;

	if (g_io_channel) {
		g_message ("closing socket.");
		g_io_channel_shutdown (g_io_channel, FALSE, &err);
		g_io_channel = NULL;
	}

	g_message ("finished.");
	return EXIT_SUCCESS;
}

static void
on_signal (
	G_GNUC_UNUSED int signum
	)
{
	puts ("on_signal");

	g_main_loop_quit(g_loop);
}

static
gboolean
on_startup (
	G_GNUC_UNUSED gpointer data
	)
{
	int e;

	g_message ("startup.");

/* find PGM protocol id */
// TODO: fix valgrind errors
	int ipproto_pgm = IPPROTO_PGM;
#ifdef HAVE_GETPROTOBYNAME_R
	char b[1024];
	struct protoent protobuf, *proto;
	e = getprotobyname_r ("pgm", &protobuf, b, sizeof(b), &proto);
	if (e != -1 && proto != NULL) {
		if (proto->p_proto != ipproto_pgm) {
			g_message ("Setting PGM protocol number to %i from /etc/protocols.\n");
			ipproto_pgm = proto->p_proto;
		}
	}
#else
	struct protoent *proto = getprotobyname ("pgm");
	if (proto != NULL) {
		if (proto->p_proto != ipproto_pgm) {
			g_message ("Setting PGM protocol number to %i from /etc/protocols.\n", proto
->p_proto);
			ipproto_pgm = proto->p_proto;
		}
	}
#endif

/* open socket for snooping */
	g_message ("opening raw socket.");
	int sock = socket (PF_INET, SOCK_RAW, ipproto_pgm);
	if (sock < 0) {
		perror("on_startup() failed");
#ifdef G_OS_UNIX
		if (EPERM == errno && 0 != getuid()) {
			g_message ("PGM protocol requires this program to run as superuser.");
		}
#endif
		g_main_loop_quit (g_loop);
		return FALSE;
	}

	int _t = 1;
	e = setsockopt (sock, IPPROTO_IP, IP_HDRINCL, (const char*)&_t, sizeof(_t));
	if (e < 0) {
		perror ("on_startup() failed");
		close (sock);
		g_main_loop_quit (g_loop);
		return FALSE;
	}

#ifdef G_OS_UNIX
/* drop out of setuid 0 */
	if (0 == getuid ()) {
		g_message ("dropping superuser privileges.");
		setuid ((gid_t)65534);
		setgid ((uid_t)65534);
	}
#endif

/* buffers */
	int buffer_size = 0;
	socklen_t len = 0;
	e = getsockopt (sock, SOL_SOCKET, SO_RCVBUF, (char*)&buffer_size, &len);
	if (e == 0) {
		g_message ("receive buffer set at %i bytes.\n", buffer_size);
	}
	e = getsockopt (sock, SOL_SOCKET, SO_SNDBUF, (char*)&buffer_size, &len);
	if (e == 0) {
		g_message ("send buffer set at %i bytes.\n", buffer_size);
	}

/* bind */
	struct sockaddr_in addr;
	memset (&addr, 0, sizeof(addr));
	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = htonl(INADDR_ANY);

	e = bind (sock, (struct sockaddr*)&addr, sizeof(addr));
	if (e < 0) {
		perror ("on_startup() failed");
		close (sock);
		g_main_loop_quit (g_loop);
		return FALSE;
	}

/* multicast */
	struct ip_mreq mreq;
	memset (&mreq, 0, sizeof(mreq));
	mreq.imr_interface.s_addr = htonl (INADDR_ANY);
	g_message ("listening on interface %s.\n", inet_ntoa (mreq.imr_interface));
	mreq.imr_multiaddr.s_addr = inet_addr (g_network);
	g_message ("subscription on multicast address %s.\n", inet_ntoa (mreq.imr_multiaddr));
	e = setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&mreq, sizeof(mreq));
	if (e < 0) {
		perror ("on_startup() failed");
		close (sock);
		g_main_loop_quit (g_loop);
		return FALSE;
	}

/* multicast loopback */
/* multicast ttl */

/* add socket to event manager */
	g_io_channel = g_io_channel_unix_new (sock);
	g_message ("socket opened with encoding %s.\n", g_io_channel_get_encoding (g_io_channel));

	/* guint event = */ g_io_add_watch (g_io_channel, G_IO_IN | G_IO_PRI, on_io_data, NULL);

/* period timer to indicate some form of life */
// TODO: Gnome 2.14: replace with g_timeout_add_seconds()
	g_timeout_add (10 * 1000, (GSourceFunc)on_mark, NULL);

	g_message ("startup complete.");
	return FALSE;
}

static gboolean
on_mark (
	G_GNUC_UNUSED gpointer data
	)
{
	g_message ("-- MARK --");
	return TRUE;
}

static gboolean
on_io_data (
	GIOChannel* source,
	G_GNUC_UNUSED GIOCondition condition,
	G_GNUC_UNUSED gpointer data
	)
{
	char buffer[4096];

	int fd = g_io_channel_unix_get_fd (source);
	struct sockaddr_in addr;
	socklen_t addr_len = sizeof(addr);
	int len = recvfrom (fd, buffer, sizeof(buffer), MSG_DONTWAIT, (struct sockaddr*)&addr, &addr_len);

	g_message ("%i bytes received from %s.\n", len, inet_ntoa (addr.sin_addr));

	if (!pgm_print_packet (buffer, len)) {
		g_message ("invalid packet :(");
	}

	fflush (stdout);

	return TRUE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/purinsendcc.cc0000644000175000017500000001755011640407353022214 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * プリン PGM sender
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#ifndef _WIN32
#	include 
#	include 
#else
#	include "getopt.h"
#endif
#include 


/* globals */

static int		port = 0;
static const char*	network = "";
static bool		use_multicast_loop = FALSE;
static int		udp_encap_port = 0;

static int		max_tpdu = 1500;
static int		max_rte = 400*1000;		/* very conservative rate, 2.5mb/s */
static int		sqns = 100;

static bool		use_fec = FALSE;
static int		rs_k = 8;
static int		rs_n = 255;

static ip::pgm::endpoint* endpoint = NULL;
static ip::pgm::socket* sock = NULL;

#ifndef _MSC_VER
static void usage (const char*) __attribute__((__noreturn__));
#else
static void usage (const char*);
#endif
static bool create_sock (void);


static void
usage (
	const char*	bin
	)
{
	std::cerr << "Usage: " << bin << " [options] message" << std::endl;
	std::cerr << "  -n     : Multicast group or unicast IP address" << std::endl;
	std::cerr << "  -s        : IP port" << std::endl;
	std::cerr << "  -p        : Encapsulate PGM in UDP on IP port" << std::endl;
	std::cerr << "  -r        : Regulate to rate bytes per second" << std::endl;
	std::cerr << "  -f        : Enable FEC with either proactive or ondemand parity" << std::endl;
	std::cerr << "  -K           : Configure Reed-Solomon code (n, k)" << std::endl;
	std::cerr << "  -N " << std::endl;
	std::cerr << "  -l              : Enable multicast loopback and address sharing" << std::endl;
	std::cerr << "  -i              : List available interfaces" << std::endl;
	exit (EXIT_SUCCESS);
}

int
main (
	int	argc,
	char   *argv[]
	)
{
	cpgm::pgm_error_t* pgm_err = NULL;

	std::setlocale (LC_ALL, "");

	if (!cpgm::pgm_init (&pgm_err)) {
		std::cerr << "Unable to start PGM engine: " << pgm_err->message << std::endl;
		cpgm::pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:r:f:K:N:lih")) != -1)
	{
		switch (c) {
		case 'n':	network = optarg; break;
		case 's':	port = atoi (optarg); break;
		case 'p':	udp_encap_port = atoi (optarg); break;
		case 'r':	max_rte = atoi (optarg); break;
		case 'f':	use_fec = TRUE; break;
		case 'K':	rs_k = atoi (optarg); break;
		case 'N':	rs_n = atoi (optarg); break;

		case 'l':	use_multicast_loop = TRUE; break;

		case 'i':
			cpgm::pgm_if_print_all();
			return EXIT_SUCCESS;

		case 'h':
		case '?':
			usage (binary_name);
		}
	}

	if (use_fec && ( !rs_n || !rs_k )) {
		std::cerr << "Invalid Reed-Solomon parameters RS(" << rs_n << "," << rs_k << ")." << std::endl;
		usage (binary_name);
	}

	if (create_sock())
	{
		while (optind < argc) {
			const int status = sock->send (argv[optind], strlen (argv[optind]) + 1, NULL);
		        if (cpgm::PGM_IO_STATUS_NORMAL != status) {
				std::cerr << "pgm_send() failed.." << std::endl;
		        }
			optind++;
		}
	}

/* cleanup */
	if (sock) {
		sock->close (TRUE);
		sock = NULL;
	}
	cpgm::pgm_shutdown();
	return EXIT_SUCCESS;
}

static
bool
create_sock (void)
{
	struct cpgm::pgm_addrinfo_t* res = NULL;
	cpgm::pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

/* parse network parameter into PGM socket address structure */
	if (!cpgm::pgm_getaddrinfo (network, NULL, &res, &pgm_err)) {
		std::cerr << "Parsing network parameter: " << pgm_err->message << std::endl;
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	sock = new ip::pgm::socket();

	if (udp_encap_port) {
		if (!sock->open (sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			std::cerr << "Creating PGM/UDP socket: " << pgm_err->message << std::endl;
			goto err_abort;
		}
		sock->set_option (IPPROTO_PGM, cpgm::PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, sizeof(udp_encap_port));
	} else {
		if (!sock->open (sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			std::cerr << "Creating PGM/IP socket: " << pgm_err->message << std::endl;
			goto err_abort;
		}
	}

	{
/* Use RFC 2113 tagging for PGM Router Assist */
		const int no_router_assist = 0;
		sock->set_option (IPPROTO_PGM, cpgm::PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));
	}

	cpgm::pgm_drop_superuser();

	{
/* set PGM parameters */
		const int send_only = 1,
			  ambient_spm = pgm_secs (30),
			  heartbeat_spm[] = { pgm_msecs (100),
					      pgm_msecs (100),
       		                              pgm_msecs (100),
					      pgm_msecs (100),
					      pgm_msecs (1300),
					      pgm_secs  (7),
					      pgm_secs  (16),
					      pgm_secs  (25),
					      pgm_secs  (30) };

		sock->set_option (IPPROTO_PGM, cpgm::PGM_SEND_ONLY, &send_only, sizeof(send_only));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_MTU, &max_tpdu, sizeof(max_tpdu));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_TXW_SQNS, &sqns, sizeof(sqns));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_TXW_MAX_RTE, &max_rte, sizeof(max_rte));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm));
	}
	if (use_fec) {
		struct cpgm::pgm_fecinfo_t fecinfo; 
		fecinfo.block_size		= rs_n;
		fecinfo.proactive_packets	= 0;
		fecinfo.group_size		= rs_k;
		fecinfo.ondemand_parity_enabled	= TRUE;
		fecinfo.var_pktlen_enabled	= TRUE;
		sock->set_option (IPPROTO_PGM, cpgm::PGM_USE_FEC, &fecinfo, sizeof(fecinfo));
	}

/* create global session identifier */
	endpoint = new ip::pgm::endpoint (DEFAULT_DATA_DESTINATION_PORT);

/* assign socket to specified address */
	if (!sock->bind (*endpoint, &pgm_err)) {
		std::cerr << "Binding PGM socket: " << pgm_err->message << std::endl;
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		sock->set_option (IPPROTO_PGM, cpgm::PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	sock->set_option (IPPROTO_PGM, cpgm::PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	cpgm::pgm_freeaddrinfo (res);

	{
/* set IP parameters */
		const int blocking = 0,
			  multicast_loop = use_multicast_loop ? 1 : 0,
			  multicast_hops = 16,
			  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

		sock->set_option (IPPROTO_PGM, cpgm::PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_TOS, &dscp, sizeof(dscp));
		sock->set_option (IPPROTO_PGM, cpgm::PGM_NOBLOCK, &blocking, sizeof(blocking));
	}

	if (!sock->connect (&pgm_err)) {
		fprintf (stderr, "Connecting PGM socket: %s\n", pgm_err->message);
		goto err_abort;
	}

	return TRUE;

err_abort:
	if (NULL != sock) {
		sock->close (FALSE);
		sock = NULL;
	}
	if (NULL != res) {
		cpgm::pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		cpgm::pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/snonblocksyncrecv.c0000644000175000017500000002762311640407353023303 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple PGM receiver: select based non-blocking synchronous receiver.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static gboolean		g_quit;

#ifdef G_OS_UNIX
static int		g_quit_pipe[2];
static void on_signal (int);
#else
static WSAEVENT		g_quit_event;
static BOOL on_console_ctrl (DWORD);
#endif

static gboolean on_startup (void);

static int on_data (gconstpointer, size_t, struct pgm_sockaddr_t*);


G_GNUC_NORETURN static
void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	int e;
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("snonblocksyncrecv");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:lh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'l':	g_multicast_loop = TRUE; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}

	g_quit = FALSE;

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif
#ifdef G_OS_UNIX
	e = pipe (g_quit_pipe);
	g_assert (0 == e);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#else
	g_quit_event = WSACreateEvent();
	SetConsoleCtrlHandler ((PHANDLER_ROUTINE)on_console_ctrl, TRUE);
	setvbuf (stdout, (char *) NULL, _IONBF, 0);
#endif /* !G_OS_UNIX */

	if (!on_startup()) {
		g_error ("startup failed");
		exit(1);
	}

/* dispatch loop */
#ifdef G_OS_UNIX
	int fds;
	fd_set readfds;
#else
	SOCKET recv_sock, pending_sock;
	DWORD cEvents = PGM_RECV_SOCKET_READ_COUNT + 1;
	WSAEVENT waitEvents[ cEvents ];
	socklen_t socklen = sizeof (SOCKET);

	waitEvents[0] = g_quit_event;
	waitEvents[1] = WSACreateEvent();
	waitEvents[2] = WSACreateEvent();
	g_assert (2 == PGM_RECV_SOCKET_READ_COUNT);
	pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen);
	WSAEventSelect (recv_sock, waitEvents[1], FD_READ);
	pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen);
	WSAEventSelect (pending_sock, waitEvents[2], FD_READ);
#endif /* !G_OS_UNIX */
	g_message ("entering PGM message loop ... ");
	do {
		struct timeval tv;
#ifdef _WIN32
		DWORD dwTimeout, dwEvents;
#endif
		char buffer[4096];
		size_t len;
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof(from);
		const int status = pgm_recvfrom (g_sock,
					         buffer,
					         sizeof(buffer),
					         0,
					         &len,
					         &from,
					         &fromlen,
					         &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_data (buffer, len, &from);
			break;
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
/* select for next event */
block:
#ifdef G_OS_UNIX
			fds = g_quit_pipe[0] + 1;
			FD_ZERO(&readfds);
			FD_SET(g_quit_pipe[0], &readfds);
			pgm_select_info (g_sock, &readfds, NULL, &fds);
			fds = select (fds, &readfds, NULL, NULL, PGM_IO_STATUS_WOULD_BLOCK == status ? NULL : &tv);
#else
			dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE);
			switch (dwEvents) {
			case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break;
			case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break;
			default: break;
			}
#endif /* !G_OS_UNIX */
			break;

		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

	g_message ("message loop terminated, cleaning up.");

/* cleanup */
#ifdef G_OS_UNIX
	close (g_quit_pipe[0]);
	close (g_quit_pipe[1]);
#else
	WSACloseEvent (waitEvents[0]);
	WSACloseEvent (waitEvents[1]);
	WSACloseEvent (waitEvents[2]);
#endif /* !G_OS_UNIX */

	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

#ifdef G_OS_UNIX
static
void
on_signal (
	int		signum
	)
{
	g_message ("on_signal (signum:%d)", signum);
	g_quit = TRUE;
	const char one = '1';
	const size_t writelen = write (g_quit_pipe[1], &one, sizeof(one));
	g_assert (sizeof(one) == writelen);
}
#else
static
BOOL
on_console_ctrl (
	DWORD		dwCtrlType
	)
{
	g_message ("on_console_ctrl (dwCtrlType:%lu)", (unsigned long)dwCtrlType);
	WSASetEvent (g_quit_event);
	return TRUE;
}
#endif /* !G_OS_UNIX */

static
gboolean
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	g_message ("startup complete.");
	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_data (
	gconstpointer		data,
	size_t			len,
	struct pgm_sockaddr_t*	from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN(sizeof(buf) - 1, len);
	strncpy (buf, (const char*)data, buflen);
	buf[buflen] = '\0';
	pgm_tsi_print_r (&from->sa_addr, tsi, sizeof(tsi));

	g_message ("\"%s\" (%u bytes from %s)",
			buf,
			(unsigned)len,
			tsi);

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/SConscript890000644000175000017500000000223711640407353021557 0ustar  locallocal# -*- mode: python -*-
# OpenPGM build script
# $Id$

import os;

Import('env');
e = env.Clone();
e.Prepend(LIBS = ['libpgm89']);
p = e.Clone();
if '-DCONFIG_HAVE_GETOPT' in env['CCFLAGS']:
	getopt = []
else:
	getopt = ['getopt.c']

c89source = Builder(action = 'perl -p -e "s/%z(u|d)/%l\\1/g" $SOURCE > $TARGET',
		    suffix = '.c89.c',
		    src_suffix = '.c',
		    single_source = 1);
p.Append(BUILDERS = {'C89Source' : c89source})

for c99file in ['purinsend.c', 'purinrecv.c']:
	p.C89Source(c99file);

p.Program('purinsend', ['purinsend.c89.c'] + getopt)
p.Program('purinrecv', ['purinrecv.c89.c'] + getopt)

# Vanilla C++ example
if e['WITH_CC'] == 'true':
	pcc = p.Clone();
	newCCFLAGS = [];
	for flag in pcc['CCFLAGS']:
		if ("-W" != flag[:2]) and ("-std=gnu99" != flag[:10]) and ("-pedantic" != flag[:9]) and ("-D_XOPEN_SOURCE=600" != flag[:19]) and ("-xc99=all" != flag[:9]):
			newCCFLAGS.append(flag);
		if ("-D_XOPEN_SOURCE=600" == flag[:19]):
			newCCFLAGS.append("-D_XOPEN_SOURCE=500");
	pcc['CCFLAGS'] = newCCFLAGS;
	pcc.Program('purinsendcc', ['purinsendcc.cc'] + p.Object(getopt))
	pcc.Program('purinrecvcc', ['purinrecvcc.cc'] + p.Object(getopt))

# end of file
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/async.h0000644000175000017500000000413511640407353020651 0ustar  locallocal/* vim:ts=8:sts=4:sw=4:noai:noexpandtab
 * 
 * Asynchronous receive thread helper
 *
 * Copyright (c) 2006-2009 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __PGM_ASYNC_H__
#define __PGM_ASYNC_H__

struct async_event_t;

#include 
#ifdef __APPLE__
#	include 
#endif
#include 

#ifdef  __cplusplus
extern "C" {
#endif

struct async_t {
	pgm_sock_t*		sock;
#ifndef _WIN32
	pthread_t		thread;
	int			notify_pipe[2];
	int			destroy_pipe[2];
	pthread_mutex_t		pthread_mutex;
#else
	HANDLE			thread;
	WSAEVENT		notifyEvent;
	WSAEVENT		destroyEvent;
	HANDLE			win32_mutex;
#endif
	struct async_event_t    *head, *tail;
	unsigned		length;
	bool			is_destroyed;
};
typedef struct async_t async_t;

int async_create (async_t** restrict, pgm_sock_t*const restrict);
int async_destroy (async_t* const);
ssize_t async_recv (async_t*const restrict, void* restrict, size_t);
ssize_t async_recvfrom (async_t*const restrict, void*restrict, size_t, struct pgm_sockaddr_t*restrict, socklen_t*restrict);

#ifndef _WIN32
static inline int async_get_socket (async_t* async)
{
	if (NULL == async) {
		errno = EINVAL;
		return -1;
	}
	return async->notify_pipe[0];
}
#else
static inline WSAEVENT async_get_event (async_t* async)
{
	if (NULL == async) {
		WSASetLastError (WSAEINVAL);
		return NULL;
	}
	return async->notifyEvent;
}
#endif /* _WIN32 */

#ifdef  __cplusplus
}
#endif

#endif /* __PGM_ASYNC_H__ */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/heatmap.c0000644000175000017500000000575011640407353021152 0ustar  locallocal#include 
#include 
#include 
#include 

const char header[] =
	"set title \"PGM Latency Heat Map\"\n"
	"unset key\n"
	"set tic scale 0\n"
	"\n"
	"# Colour runs from white to green\n"
	"set palette rgbformula -6,2,-3\n"
	"set cbrange [0:25]\n"
	"set cblabel \"Density\"\n"
	"unset cbtics\n"
	"\n"
	"set xrange [-0.5:%u.5]\n"
	"set yrange [-0.5:%u.5]\n"
	"\n"
	"set view map\n"
	"plot '-' using 1:2:3 with image\n";
const char footer[] =
	"e\n";

const unsigned yrange_max = 2*1000;
const unsigned yrange_ivl = 10;

static
int
key_compare (
	const void*	p1,
	const void*	p2
	)
{
	const uint32_t i = *((uint32_t*)p1);
	const uint32_t j = *((uint32_t*)p2);

	if (i > j)
		return 1;
	if (i < j)
		return -1;
	return 0;
}

int main (void) {
	const char src[] = "/tmp/heat.dmp";
	FILE* fh;
	uint32_t slice_count, alloc_count = 0;
	uint32_t* words;
	unsigned slice = 0, xrange_max = 0, density_max = 0;

	if (NULL == (fh = fopen (src, "r"))) {
		perror ("fopen");
		return EXIT_FAILURE;
	}

/* find time period of dump */
	while (1) {
		if (1 != fread (&slice_count, sizeof (slice_count), 1, fh)) {
			break;
		}
		slice_count = ntohl (slice_count);
		if (0 == alloc_count) {
			alloc_count = slice_count;
			words = malloc (alloc_count * sizeof (uint32_t) * 2);
		} else if (slice_count > alloc_count) {
			alloc_count = slice_count;
			words = realloc (words, alloc_count * sizeof (uint32_t) * 2);
		}
		if (slice_count != fread (words, sizeof (uint32_t) * 2, slice_count, fh)) {
			perror ("words");
			goto abort;
		}
		for (int_fast32_t i = slice_count - 1; i >= 0; i--) {
			const unsigned density = ntohl (words[(2*i)+1]);
			if (density > density_max)
				density_max = density;
		}
		xrange_max++;
	}
	rewind (fh);

	printf (header, xrange_max - 1, yrange_max - yrange_ivl);

	while (1) {
		if (1 != fread (&slice_count, sizeof (slice_count), 1, fh)) {
			break;
		}
		slice_count = ntohl (slice_count);
		if (slice_count != fread (words, sizeof (uint32_t) * 2, slice_count, fh)) {
			perror ("words");
			goto abort;
		}
		for (int_fast32_t i = slice_count - 1; i >= 0; i--) {
			words[(2*i)+0] = ntohl (words[(2*i)+0]);
			words[(2*i)+1] = ((ntohl (words[(2*i)+1]) * 25) + (density_max - 1)) / density_max;
		}
		qsort ((void*)words, slice_count, sizeof (uint32_t) * 2, key_compare);
		for (int_fast32_t i = 0, j = 0; i < slice_count; i++) {
			while ((j * yrange_ivl) < words[(2*i)+0]) {
				if ((j * yrange_ivl) >= yrange_max)
					goto end_slice;
				printf ("%u %u 0\n",
					(unsigned)slice,
					(unsigned)(j * yrange_ivl));
				j++;
			}
			if ((j * yrange_ivl) >= yrange_max)
				goto end_slice;
			printf ("%u %u %u\n",
				(unsigned)slice,
				(unsigned)(j * yrange_ivl),
				(unsigned)words[(2*i)+1]);
			j++;
		}
		for (int_fast32_t j = words[(2*(slice_count-1))+0] + yrange_ivl; j < yrange_max; j += yrange_ivl) {
			printf ("%u %u 0\n",
				(unsigned)slice,
				(unsigned)(j));
		}
end_slice:
		putchar ('\n');
		slice++;
	}

	puts (footer);

abort:
	fclose (fh);
	return EXIT_SUCCESS;
}
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/pnonblocksyncrecv.c0000644000175000017500000002444411640407353023276 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple PGM receiver: poll based non-blocking synchronous receiver.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static gboolean		g_quit;
static int		g_quit_pipe[2];

static void on_signal (int);
static gboolean on_startup (void);

static int on_data (gconstpointer, size_t, struct pgm_sockaddr_t*);


G_GNUC_NORETURN static
void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	int e;
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("pnonblocksyncrecv");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:lh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'l':	g_multicast_loop = TRUE; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}

	g_quit = FALSE;
	e = pipe (g_quit_pipe);
	g_assert (0 == e);

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif

	if (!on_startup()) {
		g_error ("startup failed");
		exit(1);
	}

/* dispatch loop */
	g_message ("entering PGM message loop ... ");
	do {
		struct timeval tv;
		int timeout;
		int n_fds = 2;
		struct pollfd fds[ 1 + n_fds ];
		char buffer[4096];
		size_t len;
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof(from);
		const int status = pgm_recvfrom (g_sock,
					         buffer,
					         sizeof(buffer),
						 0,
					         &len,
					         &from,
					         &fromlen,
					         &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_data (buffer, len, &from);
			break;
		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			memset (fds, 0, sizeof(fds));
			fds[0].fd = g_quit_pipe[0];
			fds[0].events = POLLIN;
			pgm_poll_info (g_sock, &fds[1], &n_fds, POLLIN);
			poll (fds, 1 + n_fds, timeout /* ms */);
			break;
		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

	g_message ("message loop terminated, cleaning up.");

/* cleanup */
	close (g_quit_pipe[0]);
	close (g_quit_pipe[1]);

	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

static
void
on_signal (
	int		signum
	)
{
	g_message ("on_signal (signum:%d)", signum);
	g_quit = TRUE;
	const char one = '1';
	const size_t writelen = write (g_quit_pipe[1], &one, sizeof(one));
	g_assert (sizeof(one) == writelen);
}

static
gboolean
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	g_message ("startup complete.");
	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_data (
	gconstpointer		data,
	size_t			len,
	struct pgm_sockaddr_t*	from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN(sizeof(buf) - 1, len);
	strncpy (buf, (const char*)data, buflen);
	buf[buflen] = '\0';
	pgm_tsi_print_r (&from->sa_addr, tsi, sizeof(tsi));

	g_message ("\"%s\" (%u bytes from %s)",
			buf,
			(unsigned)len,
			tsi);

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/SConscript0000644000175000017500000000541711640407353021401 0ustar  locallocal# -*- mode: python -*-
# OpenPGM build script
# $Id$

import os;

Import('env');
e = env.Clone();
e.Prepend(LIBS = ['libpgm']);
p = e.Clone();
if '-DCONFIG_HAVE_GETOPT' in env['CCFLAGS']:
	getopt = []
else:
	getopt = ['getopt.c']

if e['WITH_GLIB'] == 'true':
	e.Prepend(LIBS = ['libpgmex']);
	e.MergeFlags(env['GLIB_FLAGS']);
	e2 = e.Clone();
	if e2['WITH_SNMP'] == 'true':
		e2.Append(CCFLAGS = ['-DCONFIG_WITH_SNMP']);
		e2.Prepend(LIBS = ['libpgmsnmp']);
		e2.MergeFlags(e['SNMP_FLAGS']);
	if e2['WITH_HTTP'] == 'true':
		e2.Append(CCFLAGS = ['-DCONFIG_WITH_HTTP']);
		e2.Prepend(LIBS = ['libpgmhttp']);

# core preferred examples
	e.Program(['pgmdump.c'])
	e2.Program(['pgmsend.c'])
	e2.Program(['pgmrecv.c'])

# sync examples
	e.Program(['blocksyncrecv.c'])
	e.Program(['snonblocksyncrecv.c'])
	if '-DCONFIG_HAVE_POLL' in e['CCFLAGS']:
		e.Program(['pnonblocksyncrecv.c'])

# epoll based examples
	if '-DCONFIG_HAVE_EPOLL' in e['CCFLAGS']:
		e.Program(['enonblocksyncrecv.c'])
		e.Program(['enonblocksyncrecvmsg.c'])
		e.Program(['enonblocksyncrecvmsgv.c'])

# ncurses examples
	if e['WITH_NCURSES'] == 'true':
		en = e.Clone()
		en.Append(LIBS = ['panel', 'ncurses']);
		en.Program(['pgmtop.c'])

# Google Protocol Buffer example
	if e['WITH_PROTOBUF'] == 'true':
		ep = e2.Clone();
		newCCFLAGS = [];
		for flag in ep['CCFLAGS']:
			if ("-W" != flag[:2]) and ("-std=gnu99" != flag[:10]) and ("-pedantic" != flag[:9]) and ("-D_XOPEN_SOURCE=600" != flag[:19]) and ("-xc99=all" != flag[:9]):
				newCCFLAGS.append(flag);
			if ("-D_XOPEN_SOURCE=600" == flag[:19]):
				newCCFLAGS.append("-D_XOPEN_SOURCE=500");
		ep['CCFLAGS'] = newCCFLAGS;
		ep.Append(CPPPATH = '.');
		ep.Append(CCFLAGS = ep['PROTOBUF_CCFLAGS']);
		protobuf = Builder(action = 'cd ${SOURCE.dir} && %s ${SOURCE.file} --cpp_out=../${TARGET.dir}' % ep['PROTOBUF_PROTOC'])
		ep.Append(BUILDERS = {'Protobuf' : protobuf})
		ep.Program(['pgmping.cc', 'ping.pb.cc', ep['PROTOBUF_LIBS']])
		protobuf = ep.Protobuf('ping.pb.cc', 'ping.proto')
		ep.Requires(ep.Object('pgmping.cc'), protobuf);

# Vanilla example
p.Program(['purinsend.c'] + getopt)
p.Program(['purinrecv.c'] + getopt)
p.Program(['daytime.c'] + getopt)
p.Program(['shortcakerecv.c', 'async.c'] + getopt)

# Vanilla C++ example
if e['WITH_CC'] == 'true':
	pcc = p.Clone();
	newCCFLAGS = [];
	for flag in pcc['CCFLAGS']:
		if ("-W" != flag[:2]) and ("-std=gnu99" != flag[:10]) and ("-pedantic" != flag[:9]) and ("-D_XOPEN_SOURCE=600" != flag[:19]) and ("-xc99=all" != flag[:9]) and ("-std=c99" != flag[:8]):
			newCCFLAGS.append(flag);
		if ("-D_XOPEN_SOURCE=600" == flag[:19]):
			newCCFLAGS.append("-D_XOPEN_SOURCE=500");
	pcc['CCFLAGS'] = newCCFLAGS;
	pcc.Program('purinsendcc', ['purinsendcc.cc'] + p.Object(getopt))
	pcc.Program('purinrecvcc', ['purinrecvcc.cc'] + p.Object(getopt))

# end of file
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/enonblocksyncrecv.c0000644000175000017500000002445611640407353023266 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple PGM receiver: epoll based non-blocking synchronous receiver.
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static gboolean		g_quit = FALSE;

static void on_signal (int);
static gboolean on_startup (void);

static int on_data (gconstpointer, size_t, struct pgm_sockaddr_t*);


G_GNUC_NORETURN static
void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("enonblocksyncrecv");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:lh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'l':	g_multicast_loop = TRUE; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}


/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif

	if (!on_startup ()) {
		g_error ("startup failed");
		return EXIT_FAILURE;
	}

/* epoll file descriptor */
	int efd = epoll_create (IP_MAX_MEMBERSHIPS);
	if (efd < 0) {
		g_error ("epoll_create failed errno %i: \"%s\"", errno, strerror(errno));
		return EXIT_FAILURE;
	}

	int retval = pgm_epoll_ctl (g_sock, efd, EPOLL_CTL_ADD, EPOLLIN);
	if (retval < 0) {
		g_error ("pgm_epoll_ctl failed.");
		return EXIT_FAILURE;
	}

	struct epoll_event events[1];	/* wait for maximum 1 event */

/* dispatch loop */
	g_message ("entering PGM message loop ... ");
	do {
		struct timeval tv;
		int timeout;
		char buffer[4096];
		size_t len;
		struct pgm_sockaddr_t from;
		socklen_t fromlen = sizeof(from);
		const int status = pgm_recvfrom (g_sock,
					         buffer,
					         sizeof(buffer),
					         0,
					         &len,
					         &from,
					         &fromlen,
					         &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_data (buffer, len, &from);
			break;

		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			epoll_wait (efd, events, G_N_ELEMENTS(events), timeout /* ms */);
			break;

		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

	g_message ("message loop terminated, cleaning up.");

/* cleanup */
	close (efd);
	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

static
void
on_signal (
	int		signum
	)
{
	g_message ("on_signal (signum:%d)", signum);
	g_quit = TRUE;
}

static
gboolean
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	g_message ("startup complete.");
	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_data (
	gconstpointer		data,
	size_t			len,
	struct pgm_sockaddr_t*	from
	)
{
/* protect against non-null terminated strings */
	char buf[1024], tsi[PGM_TSISTRLEN];
	const size_t buflen = MIN(sizeof(buf) - 1, len);
	strncpy (buf, (const char*)data, buflen);
	buf[buflen] = '\0';
	pgm_tsi_print_r (&from->sa_addr, tsi, sizeof(tsi));

	g_message ("\"%s\" (%u bytes from %s)",
			buf,
			(unsigned)len,
			tsi);

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/examples/enonblocksyncrecvmsgv.c0000644000175000017500000002567611640407353024170 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * Simple PGM receiver: epoll based non-blocking synchronous receiver with scatter/gather io
 *
 * Copyright (c) 2006-2010 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef G_OS_UNIX
#	include 
#	include 
#	include 
#	include 
#	include 
#endif
#include 

/* example dependencies */
#include 
#include 


/* typedefs */

/* globals */

static int		g_port = 0;
static const char*	g_network = "";
static gboolean		g_multicast_loop = FALSE;
static int		g_udp_encap_port = 0;

static int		g_max_tpdu = 1500;
static int		g_sqns = 100;

static pgm_sock_t*	g_sock = NULL;
static gboolean		g_quit = FALSE;

static void on_signal (int);
static gboolean on_startup (void);

static int on_msgv (struct pgm_msgv_t*, size_t);


G_GNUC_NORETURN static
void
usage (
	const char*	bin
	)
{
	fprintf (stderr, "Usage: %s [options]\n", bin);
	fprintf (stderr, "  -n     : Multicast group or unicast IP address\n");
	fprintf (stderr, "  -s        : IP port\n");
	fprintf (stderr, "  -p        : Encapsulate PGM in UDP on IP port\n");
	fprintf (stderr, "  -l              : Enable multicast loopback and address sharing\n");
	exit (1);
}

int
main (
	int		argc,
	char*		argv[]
	)
{
	pgm_error_t* pgm_err = NULL;

	setlocale (LC_ALL, "");

	log_init ();
	g_message ("enonblocksyncrecvmsgv");

	if (!pgm_init (&pgm_err)) {
		g_error ("Unable to start PGM engine: %s", pgm_err->message);
		pgm_error_free (pgm_err);
		return EXIT_FAILURE;
	}

/* parse program arguments */
	const char* binary_name = strrchr (argv[0], '/');
	int c;
	while ((c = getopt (argc, argv, "s:n:p:lh")) != -1)
	{
		switch (c) {
		case 'n':	g_network = optarg; break;
		case 's':	g_port = atoi (optarg); break;
		case 'p':	g_udp_encap_port = atoi (optarg); break;
		case 'l':	g_multicast_loop = TRUE; break;

		case 'h':
		case '?': usage (binary_name);
		}
	}

/* setup signal handlers */
	signal (SIGSEGV, on_sigsegv);
	signal (SIGINT,  on_signal);
	signal (SIGTERM, on_signal);
#ifdef SIGHUP
	signal (SIGHUP,  SIG_IGN);
#endif

	if (!on_startup ()) {
		g_error ("startup failed");
		return EXIT_FAILURE;
	}

/* incoming message buffer, iov_len must be less than SC_IOV_MAX */
	const long iov_len = 8;
	const long ev_len  = 1;
	g_message ("Using iov_len %li ev_len %li", iov_len, ev_len);

	struct pgm_msgv_t msgv[iov_len];
	struct epoll_event events[ev_len];	/* wait for maximum 1 event */

/* epoll file descriptor */
	const int efd = epoll_create (IP_MAX_MEMBERSHIPS);
	if (efd < 0) {
		g_error ("epoll_create failed errno %i: \"%s\"", errno, strerror(errno));
		return EXIT_FAILURE;
	}

	const int retval = pgm_epoll_ctl (g_sock, efd, EPOLL_CTL_ADD, EPOLLIN);
	if (retval < 0) {
		g_error ("pgm_epoll_ctl failed.");
		return EXIT_FAILURE;
	}

/* dispatch loop */
	g_message ("entering PGM message loop ... ");
	do {
		struct timeval tv;
		int timeout;
		size_t len;
		const int status = pgm_recvmsgv (g_sock,
					         msgv,
					         iov_len,
						 0,
					         &len,
					         &pgm_err);
		switch (status) {
		case PGM_IO_STATUS_NORMAL:
			on_msgv (msgv, len);
			break;

		case PGM_IO_STATUS_TIMER_PENDING:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
			}
			goto block;
		case PGM_IO_STATUS_RATE_LIMITED:
			{
				socklen_t optlen = sizeof (tv);
				pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
			}
/* fall through */
		case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
			timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 :  ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
			epoll_wait (efd, events, G_N_ELEMENTS(events), timeout /* ms */);
			break;

		default:
			if (pgm_err) {
				g_warning ("%s", pgm_err->message);
				pgm_error_free (pgm_err);
				pgm_err = NULL;
			}
			if (PGM_IO_STATUS_ERROR == status)
				break;
		}
	} while (!g_quit);

	g_message ("message loop terminated, cleaning up.");

/* cleanup */
	close (efd);
	if (g_sock) {
		g_message ("closing PGM socket.");
		pgm_close (g_sock, TRUE);
		g_sock = NULL;
	}

	g_message ("PGM engine shutdown.");
	pgm_shutdown ();
	g_message ("finished.");
	return EXIT_SUCCESS;
}

static
void
on_signal (
	int		signum
	)
{
	g_message ("on_signal (signum:%d)", signum);
	g_quit = TRUE;
}

static
gboolean
on_startup (void)
{
	struct pgm_addrinfo_t* res = NULL;
	pgm_error_t* pgm_err = NULL;
	sa_family_t sa_family = AF_UNSPEC;

	g_message ("startup.");

/* parse network parameter into transport address structure */
	if (!pgm_getaddrinfo (g_network, NULL, &res, &pgm_err)) {
		g_error ("parsing network parameter: %s", pgm_err->message);
		goto err_abort;
	}

	sa_family = res->ai_send_addrs[0].gsr_group.ss_family;

	if (g_udp_encap_port) {
		g_message ("create PGM/UDP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT, &g_udp_encap_port, sizeof(g_udp_encap_port));
	} else {
		g_message ("create PGM/IP socket.");
		if (!pgm_socket (&g_sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
			g_error ("socket: %s", pgm_err->message);
			goto err_abort;
		}
	}

/* Use RFC 2113 tagging for PGM Router Assist */
	const int no_router_assist = 0;
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &no_router_assist, sizeof(no_router_assist));

	pgm_drop_superuser();

/* set PGM parameters */
	const int recv_only = 1,
		  passive = 0,
		  peer_expiry = pgm_secs (300),
		  spmr_expiry = pgm_msecs (250),
		  nak_bo_ivl = pgm_msecs (50),
		  nak_rpt_ivl = pgm_secs (2),
		  nak_rdata_ivl = pgm_secs (2),
		  nak_data_retries = 50,
		  nak_ncf_retries = 50;

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PASSIVE, &passive, sizeof(passive));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MTU, &g_max_tpdu, sizeof(g_max_tpdu));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_RXW_SQNS, &g_sqns, sizeof(g_sqns));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));

/* create global session identifier */
	struct pgm_sockaddr_t addr;
	memset (&addr, 0, sizeof(addr));
	addr.sa_port = g_port ? g_port : DEFAULT_DATA_DESTINATION_PORT;
	addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
	if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) {
		g_error ("creating GSI: %s", pgm_err->message);
		goto err_abort;
	}

/* assign socket to specified address */
	struct pgm_interface_req_t if_req;
	memset (&if_req, 0, sizeof(if_req));
	if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
	if_req.ir_scope_id  = 0;
	if (AF_INET6 == sa_family) {
		struct sockaddr_in6 sa6;
		memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
		if_req.ir_scope_id = sa6.sin6_scope_id;
	}
	if (!pgm_bind3 (g_sock,
			&addr, sizeof(addr),
			&if_req, sizeof(if_req),	/* tx interface */
			&if_req, sizeof(if_req),	/* rx interface */
			&pgm_err))
	{
		g_error ("binding PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

/* join IP multicast groups */
	for (unsigned i = 0; i < res->ai_recv_addrs_len; i++)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req));
	pgm_freeaddrinfo (res);

/* set IP parameters */
	const int nonblocking = 1,
		  multicast_loop = g_multicast_loop ? 1 : 0,
		  multicast_hops = 16,
		  dscp = 0x2e << 2;		/* Expedited Forwarding PHB for network elements, no ECN. */

	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
	if (AF_INET6 != sa_family)
		pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_TOS, &dscp, sizeof(dscp));
	pgm_setsockopt (g_sock, IPPROTO_PGM, PGM_NOBLOCK, &nonblocking, sizeof(nonblocking));

	if (!pgm_connect (g_sock, &pgm_err)) {
		g_error ("connecting PGM socket: %s", pgm_err->message);
		goto err_abort;
	}

	g_message ("startup complete.");
	return TRUE;

err_abort:
	if (NULL != g_sock) {
		pgm_close (g_sock, FALSE);
		g_sock = NULL;
	}
	if (NULL != res) {
		pgm_freeaddrinfo (res);
		res = NULL;
	}
	if (NULL != pgm_err) {
		pgm_error_free (pgm_err);
		pgm_err = NULL;
	}
	return FALSE;
}

static
int
on_msgv (
	struct pgm_msgv_t*	msgv,		/* an array of msgv's */
	size_t			len		/* total size of all msgv's */
	)
{
	g_message ("(%u bytes)",
			(unsigned)len);

	guint i = 0;

/* for each apdu display each fragment */
	do {
		const struct pgm_sk_buff_t* pskb = msgv[i].msgv_skb[0];
		gsize apdu_len = 0;
		for (unsigned j = 0; j < msgv[i].msgv_len; j++)
			apdu_len += msgv[i].msgv_skb[j]->len;
/* truncate to first fragment to make GLib printing happy */
		char buf[1024], tsi[PGM_TSISTRLEN];
		const size_t buflen = MIN( sizeof(buf) - 1, pskb->len );
		strncpy (buf, (const char*)pskb->data, buflen);
		buf[buflen] = '\0';
		pgm_tsi_print_r (&pskb->tsi, tsi, sizeof(tsi));
		if (msgv[i].msgv_len > 1) {
			g_message ("\t%u: \"%s\" ... (%" G_GSIZE_FORMAT " bytes from %s)", i, buf, apdu_len, tsi);
		} else {
			g_message ("\t%u: \"%s\" (%" G_GSIZE_FORMAT " bytes from %s)", i, buf, apdu_len, tsi);
		}
		i++;
		len -= apdu_len;
	} while (len);

	return 0;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/rxw.c0000644000175000017500000017124211640407354016536 0ustar  locallocal/* vim:ts=8:sts=8:sw=4:noai:noexpandtab
 *
 * A basic receive window: pointer array implementation.
 *
 * Copyright (c) 2006-2011 Miru Limited.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include 
#include 
#include 


//#define RXW_DEBUG

#ifndef RXW_DEBUG
#	define PGM_DISABLE_ASSERT
#endif


/* testing function: is TSI null
 *
 * returns TRUE if null, returns FALSE if not null.
 */

static inline
bool
_pgm_tsi_is_null (
	const void*const	tsi
	)
{
	const union {
		pgm_tsi_t	tsi;
		uint32_t	l[2];
	} *u = tsi;

/* pre-conditions */
	pgm_assert (NULL != tsi);

	return (0 == u->l[0] && 0 == u->l[1]);
}

/* sequence state must be smaller than PGM skbuff control buffer */
PGM_STATIC_ASSERT(sizeof(struct pgm_rxw_state_t) <= sizeof(((struct pgm_sk_buff_t*)0)->cb));

static void _pgm_rxw_define (pgm_rxw_t*const, const uint32_t);
static void _pgm_rxw_update_trail (pgm_rxw_t*const, const uint32_t);
static inline uint32_t _pgm_rxw_update_lead (pgm_rxw_t*const, const uint32_t, const pgm_time_t, const pgm_time_t);
static inline uint32_t _pgm_rxw_tg_sqn (pgm_rxw_t*const, const uint32_t);
static inline uint32_t _pgm_rxw_pkt_sqn (pgm_rxw_t*const, const uint32_t);
static inline bool _pgm_rxw_is_first_of_tg_sqn (pgm_rxw_t*const, const uint32_t);
static inline bool _pgm_rxw_is_last_of_tg_sqn (pgm_rxw_t*const, const uint32_t);
static int _pgm_rxw_insert (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict);
static int _pgm_rxw_append (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict, const pgm_time_t);
static int _pgm_rxw_add_placeholder_range (pgm_rxw_t*const, const uint32_t, const pgm_time_t, const pgm_time_t);
static void _pgm_rxw_unlink (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict);
static uint32_t _pgm_rxw_remove_trail (pgm_rxw_t*const);
static void _pgm_rxw_state (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict, const int);
static inline void _pgm_rxw_shuffle_parity (pgm_rxw_t*const restrict, struct pgm_sk_buff_t*const restrict);
static inline ssize_t _pgm_rxw_incoming_read (pgm_rxw_t*const restrict, struct pgm_msgv_t**restrict, uint32_t);
static bool _pgm_rxw_is_apdu_complete (pgm_rxw_t*const, const uint32_t);
static inline ssize_t _pgm_rxw_incoming_read_apdu (pgm_rxw_t*const restrict, struct pgm_msgv_t**restrict);
static inline int _pgm_rxw_recovery_update (pgm_rxw_t*const, const uint32_t, const pgm_time_t);
static inline int _pgm_rxw_recovery_append (pgm_rxw_t*const, const pgm_time_t, const pgm_time_t);


/* returns the pointer at the given index of the window.
 */

static
struct pgm_sk_buff_t*
_pgm_rxw_peek (
	const pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	if (pgm_rxw_is_empty (window))
		return NULL;

	if (pgm_uint32_gte (sequence, window->trail) && pgm_uint32_lte (sequence, window->lead))
	{
		const uint_fast32_t index_ = sequence % pgm_rxw_max_length (window);
		struct pgm_sk_buff_t* skb = window->pdata[index_];
/* availability only guaranteed inside commit window */
		if (pgm_uint32_lt (sequence, window->commit_lead)) {
			pgm_assert (NULL != skb);
			pgm_assert (pgm_skb_is_valid (skb));
			pgm_assert (!_pgm_tsi_is_null (&skb->tsi));
		}
		return skb;
	}

	return NULL;
}

/* sections of the receive window:
 * 
 *  |     Commit       |   Incoming   |
 *  |<---------------->|<------------>|
 *  |                  |              |
 * trail         commit-lead        lead
 *
 * commit buffers are currently held by the application, the window trail
 * cannot be advanced if packets remain in the commit buffer.
 *
 * incoming buffers are waiting to be passed to the application.
 */

static inline
uint32_t
_pgm_rxw_commit_length (
	const pgm_rxw_t* const	window
	)
{
	pgm_assert (NULL != window);
	return window->commit_lead - window->trail;
}

static inline
bool
_pgm_rxw_commit_is_empty (
	const pgm_rxw_t* const	window
	)
{
	pgm_assert (NULL != window);
	return (_pgm_rxw_commit_length (window) == 0);
}

static inline
uint32_t
_pgm_rxw_incoming_length (
	const pgm_rxw_t* const	window
	)
{
	pgm_assert (NULL != window);
	return ( 1 + window->lead ) - window->commit_lead;
}

static inline
bool
_pgm_rxw_incoming_is_empty (
	const pgm_rxw_t* const	window
	)
{
	pgm_assert (NULL != window);
	return (_pgm_rxw_incoming_length (window) == 0);
}

/* constructor for receive window.  zero-length windows are not permitted.
 *
 * returns pointer to window.
 */

PGM_GNUC_INTERNAL
pgm_rxw_t*
pgm_rxw_create (
	const pgm_tsi_t*const	tsi,
	const uint16_t		tpdu_size,
	const unsigned		sqns,		/* receive window size in sequence numbers */
	const unsigned		secs,		/* size in seconds */
	const ssize_t		max_rte,	/* max bandwidth */
	const uint32_t		ack_c_p
	)
{
	pgm_rxw_t* window;

/* pre-conditions */
	pgm_assert (NULL != tsi);
	pgm_assert_cmpuint (tpdu_size, >, 0);
	if (sqns) {
		pgm_assert_cmpuint (sqns, >, 0);
		pgm_assert_cmpuint (sqns & PGM_UINT32_SIGN_BIT, ==, 0);
		pgm_assert_cmpuint (secs, ==, 0);
		pgm_assert_cmpuint (max_rte, ==, 0);
	} else {
		pgm_assert_cmpuint (secs, >, 0);
		pgm_assert_cmpuint (max_rte, >, 0);
	}

	pgm_debug ("create (tsi:%s max-tpdu:%" PRIu16 " sqns:%" PRIu32  " secs %u max-rte %" PRIzd " ack-c_p %" PRIu32 ")",
		pgm_tsi_print (tsi), tpdu_size, sqns, secs, max_rte, ack_c_p);

/* calculate receive window parameters */
	pgm_assert (sqns || (secs && max_rte));
	const unsigned alloc_sqns = sqns ? sqns : (unsigned)( (secs * max_rte) / tpdu_size );
	window = pgm_malloc0 (sizeof(pgm_rxw_t) + ( alloc_sqns * sizeof(struct pgm_sk_buff_t*) ));

	window->tsi		= tsi;
	window->max_tpdu	= tpdu_size;

/* empty state:
 *
 * trail = 0, lead = -1
 * commit_trail = commit_lead = rxw_trail = rxw_trail_init = 0
 */
	window->lead = -1;
	window->trail = window->lead + 1;

/* limit retransmit requests on late session joining */
	window->is_constrained = TRUE;

/* minimum value of RS::k = 1 */
	window->tg_size = 1;

/* PGMCC filter weight */
	window->ack_c_p = pgm_fp16 (ack_c_p);
	window->bitmap = 0xffffffff;

/* pointer array */
	window->alloc = alloc_sqns;

/* post-conditions */
	pgm_assert_cmpuint (pgm_rxw_max_length (window), ==, alloc_sqns);
	pgm_assert_cmpuint (pgm_rxw_length (window), ==, 0);
	pgm_assert_cmpuint (pgm_rxw_size (window), ==, 0);
	pgm_assert (pgm_rxw_is_empty (window));
	pgm_assert (!pgm_rxw_is_full (window));

	return window;
}

/* destructor for receive window.  must not be called more than once for same window.
 */

PGM_GNUC_INTERNAL
void
pgm_rxw_destroy (
	pgm_rxw_t* const	window
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert_cmpuint (window->alloc, >, 0);

	pgm_debug ("destroy (window:%p)", (const void*)window);

/* contents of window */
	while (!pgm_rxw_is_empty (window)) {
		_pgm_rxw_remove_trail (window);
	}

/* window must now be empty */
	pgm_assert_cmpuint (pgm_rxw_length (window), ==, 0);
	pgm_assert_cmpuint (pgm_rxw_size (window), ==, 0);
	pgm_assert (pgm_rxw_is_empty (window));
	pgm_assert (!pgm_rxw_is_full (window));

/* window */
	pgm_free (window);
}

/* add skb to receive window.  window has fixed size and will not grow.
 * PGM skbuff data/tail pointers must point to the PGM payload, and hence skb->len
 * is allowed to be zero.
 *
 * if the skb sequence number indicates lost packets placeholders will be defined
 * for each missing entry in the window.
 *
 * side effects:
 *
 * 1) sequence number is set in skb from PGM header value.
 * 2) window may be updated with new skb.
 * 3) placeholders may be created for detected lost packets.
 * 4) parity skbs may be shuffled to accomodate original data.
 *
 * returns:
 * PGM_RXW_INSERTED - packet filled a waiting placeholder, skb consumed.
 * PGM_RXW_APPENDED - packet advanced window lead, skb consumed.
 * PGM_RXW_MISSING - missing packets detected whilst window lead was adanced, skb consumed.
 * PGM_RXW_DUPLICATE - re-transmission of previously seen packet.
 * PGM_RXW_MALFORMED - corrupted or invalid packet.
 * PGM_RXW_BOUNDS - packet out of window.
 *
 * it is an error to try to free the skb after adding to the window.
 */

PGM_GNUC_INTERNAL
int
pgm_rxw_add (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb,
	const pgm_time_t		     now,
	const pgm_time_t		     nak_rb_expiry	/* calculated expiry time for this skb */
	)
{
	pgm_rxw_state_t* const state = (pgm_rxw_state_t*)&skb->cb;
	int status;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);
	pgm_assert_cmpuint (nak_rb_expiry, >, 0);
	pgm_assert_cmpuint (pgm_rxw_max_length (window), >, 0);
	pgm_assert (pgm_skb_is_valid (skb));
	pgm_assert (((const pgm_list_t*)skb)->next == NULL);
	pgm_assert (((const pgm_list_t*)skb)->prev == NULL);
	pgm_assert (!_pgm_tsi_is_null (&skb->tsi));
	pgm_assert ((char*)skb->data > (char*)skb->head);
	pgm_assert (sizeof(struct pgm_header) + sizeof(struct pgm_data) <= (size_t)((char*)skb->data - (char*)skb->head));
	pgm_assert (skb->len == ((char*)skb->tail - (char*)skb->data));

	pgm_debug ("add (window:%p skb:%p nak_rb_expiry:%" PGM_TIME_FORMAT ")",
		(const void*)window, (const void*)skb, nak_rb_expiry);

	skb->sequence = ntohl (skb->pgm_data->data_sqn);

/* protocol sanity check: tsdu size */
	if (PGM_UNLIKELY(skb->len != ntohs (skb->pgm_header->pgm_tsdu_length)))
		return PGM_RXW_MALFORMED;

/* protocol sanity check: valid trail pointer wrt. sequence */
	if (PGM_UNLIKELY(skb->sequence - ntohl (skb->pgm_data->data_trail) >= ((UINT32_MAX/2)-1)))
		return PGM_RXW_MALFORMED;

/* verify fragment header for original data, parity packets include a
 * parity fragment header
 */
	if (!(skb->pgm_header->pgm_options & PGM_OPT_PARITY) &&
	    skb->pgm_opt_fragment)
	{
/* protocol sanity check: single fragment APDU */
		if (PGM_UNLIKELY(ntohl (skb->of_apdu_len) == skb->len))
			skb->pgm_opt_fragment = NULL;

/* protocol sanity check: minimum APDU length */
		if (PGM_UNLIKELY(ntohl (skb->of_apdu_len) < skb->len))
			return PGM_RXW_MALFORMED;

/* protocol sanity check: sequential ordering */
		if (PGM_UNLIKELY(pgm_uint32_gt (ntohl (skb->of_apdu_first_sqn), skb->sequence)))
			return PGM_RXW_MALFORMED;

/* protocol sanity check: maximum APDU length */
		if (PGM_UNLIKELY(ntohl (skb->of_apdu_len) > PGM_MAX_APDU))
			return PGM_RXW_MALFORMED;
	}

/* first packet of a session defines the window */
	if (PGM_UNLIKELY(!window->is_defined))
		_pgm_rxw_define (window, skb->sequence - 1);	/* previous_lead needed for append to occur */
	else
		_pgm_rxw_update_trail (window, ntohl (skb->pgm_data->data_trail));

/* bounds checking for parity data occurs at the transmission group sequence number */
	if (skb->pgm_header->pgm_options & PGM_OPT_PARITY)
	{
		if (pgm_uint32_lt (_pgm_rxw_tg_sqn (window, skb->sequence), _pgm_rxw_tg_sqn (window, window->commit_lead)))
			return PGM_RXW_DUPLICATE;

		if (pgm_uint32_lt (_pgm_rxw_tg_sqn (window, skb->sequence), _pgm_rxw_tg_sqn (window, window->lead))) {
			window->has_event = 1;
			return _pgm_rxw_insert (window, skb);
		}

		const struct pgm_sk_buff_t* const first_skb = _pgm_rxw_peek (window, _pgm_rxw_tg_sqn (window, skb->sequence));
		const pgm_rxw_state_t* const first_state = (pgm_rxw_state_t*)&first_skb->cb;

		if (_pgm_rxw_tg_sqn (window, skb->sequence) == _pgm_rxw_tg_sqn (window, window->lead)) {
			window->has_event = 1;
			if (NULL == first_state || first_state->is_contiguous) {
				state->is_contiguous = 1;
				return _pgm_rxw_append (window, skb, now);
			} else
				return _pgm_rxw_insert (window, skb);
		}

		pgm_assert (NULL != first_state);
		status = _pgm_rxw_add_placeholder_range (window, _pgm_rxw_tg_sqn (window, skb->sequence), now, nak_rb_expiry);
	}
	else
	{
		if (pgm_uint32_lt (skb->sequence, window->commit_lead)) {
			if (pgm_uint32_gte (skb->sequence, window->trail))
				return PGM_RXW_DUPLICATE;
			else
				return PGM_RXW_BOUNDS;
		}

		if (pgm_uint32_lte (skb->sequence, window->lead)) {
			window->has_event = 1;
			return _pgm_rxw_insert (window, skb);
		}

		if (skb->sequence == pgm_rxw_next_lead (window)) {
			window->has_event = 1;
			if (_pgm_rxw_is_first_of_tg_sqn (window, skb->sequence))
				state->is_contiguous = 1;
			return _pgm_rxw_append (window, skb, now);
		}

		status = _pgm_rxw_add_placeholder_range (window, skb->sequence, now, nak_rb_expiry);
	}

	if (PGM_RXW_APPENDED == status) {
		status = _pgm_rxw_append (window, skb, now);
		if (PGM_RXW_APPENDED == status)
			status = PGM_RXW_MISSING;
	}
	return status;
}

/* trail is the next packet to commit upstream, lead is the leading edge
 * of the receive window with possible gaps inside, rxw_trail is the transmit
 * window trail for retransmit requests.
 */

/* define window by parameters of first data packet.
 */

static
void
_pgm_rxw_define (
	pgm_rxw_t* const	window,
	const uint32_t		lead
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (pgm_rxw_is_empty (window));
	pgm_assert (_pgm_rxw_commit_is_empty (window));
	pgm_assert (_pgm_rxw_incoming_is_empty (window));
	pgm_assert (!window->is_defined);

	window->lead = lead;
	window->commit_lead = window->rxw_trail = window->rxw_trail_init = window->trail = window->lead + 1;
	window->is_constrained = window->is_defined = TRUE;

/* post-conditions */
	pgm_assert (pgm_rxw_is_empty (window));
	pgm_assert (_pgm_rxw_commit_is_empty (window));
	pgm_assert (_pgm_rxw_incoming_is_empty (window));
	pgm_assert (window->is_defined);
	pgm_assert (window->is_constrained);
}

/* update window with latest transmitted parameters.
 *
 * returns count of placeholders added into window, used to start sending naks.
 */

PGM_GNUC_INTERNAL
unsigned
pgm_rxw_update (
	pgm_rxw_t* const	window,
	const uint32_t		txw_lead,
	const uint32_t		txw_trail,
	const pgm_time_t	now,
	const pgm_time_t	nak_rb_expiry		/* packet expiration time */
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert_cmpuint (nak_rb_expiry, >, 0);

	pgm_debug ("pgm_rxw_update (window:%p txw-lead:%" PRIu32 " txw-trail:%" PRIu32 " nak-rb-expiry:%" PGM_TIME_FORMAT ")",
		(void*)window, txw_lead, txw_trail, nak_rb_expiry);

	if (PGM_UNLIKELY(!window->is_defined)) {
		_pgm_rxw_define (window, txw_lead);
		return 0;
	}

	_pgm_rxw_update_trail (window, txw_trail);
	return _pgm_rxw_update_lead (window, txw_lead, now, nak_rb_expiry);
}

/* update trailing edge of receive window
 */

static
void
_pgm_rxw_update_trail (
	pgm_rxw_t* const	window,
	const uint32_t		txw_trail
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

/* advertised trail is less than the current value */
	if (PGM_UNLIKELY(pgm_uint32_lte (txw_trail, window->rxw_trail)))
		return;

/* protocol sanity check: advertised trail jumps too far ahead */
	if (PGM_UNLIKELY(txw_trail - window->rxw_trail > ((UINT32_MAX/2)-1)))
		return;

/* retransmissions requests are constrained on startup until the advertised trail advances
 * beyond the first data sequence number.
 */
	if (PGM_UNLIKELY(window->is_constrained))
	{
		if (pgm_uint32_gt (txw_trail, window->rxw_trail_init))
			window->is_constrained = FALSE;
		else
			return;
	}

	window->rxw_trail = txw_trail;

/* new value doesn't affect window */
	if (PGM_UNLIKELY(pgm_uint32_lte (window->rxw_trail, window->trail)))
		return;

/* jump remaining sequence numbers if window is empty */
	if (pgm_rxw_is_empty (window))
	{
		const uint32_t distance = (int32_t)(window->rxw_trail) - (int32_t)(window->trail);
		window->commit_lead = window->trail += distance;
		window->lead += distance;

/* add loss to bitmap */
		if (distance > 32)	window->bitmap = 0;
		else			window->bitmap <<= distance;

/* update the Exponential Moving Average (EMA) data loss with long jump:
 *  s_t = α × (p₁ + (1 - α) × p₂ + (1 - α)² × p₃ + ⋯)
 * omitting the weight by stopping after k terms,
 *      = α × ((1 - α)^^k + (1 - α)^^{k+1} +(1 - α)^^{k+1} + ⋯)
 *      = α × (1 - α)^^k × (1 + (1 - α) + (1 - α)² + ⋯)
 *      = (1 - α)^^k
 */
		window->data_loss = pgm_fp16mul (window->data_loss, pgm_fp16pow (pgm_fp16 (1) - window->ack_c_p, distance));

		window->cumulative_losses += distance;
		pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Data loss due to trailing edge update, fragment count %" PRIu32 "."),window->fragment_count);
		pgm_assert (pgm_rxw_is_empty (window));
		pgm_assert (_pgm_rxw_commit_is_empty (window));
		pgm_assert (_pgm_rxw_incoming_is_empty (window));
		return;
	}

/* remove all buffers between commit lead and advertised rxw_trail */
	for (uint32_t sequence = window->commit_lead;
	     pgm_uint32_gt (window->rxw_trail, sequence) && pgm_uint32_gte (window->lead, sequence);
	     sequence++)
	{
		struct pgm_sk_buff_t* skb;
		pgm_rxw_state_t* state;

		skb = _pgm_rxw_peek (window, sequence);
		pgm_assert (NULL != skb);
		state = (pgm_rxw_state_t*)&skb->cb;

		switch (state->pkt_state) {
		case PGM_PKT_STATE_HAVE_DATA:
		case PGM_PKT_STATE_HAVE_PARITY:
		case PGM_PKT_STATE_LOST_DATA:
			break;

		case PGM_PKT_STATE_ERROR:
			pgm_assert_not_reached();

		default:
			pgm_rxw_lost (window, sequence);
			break;
		}
	}

/* post-conditions: only after flush */
//	pgm_assert (!pgm_rxw_is_full (window));
}

/* update FEC parameters
 */

PGM_GNUC_INTERNAL
void
pgm_rxw_update_fec (
	pgm_rxw_t* const	window,
	const uint8_t		rs_k
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert_cmpuint (rs_k, >, 1);

	pgm_debug ("pgm_rxw_update_fec (window:%p rs(k):%u)",
		(void*)window, rs_k);

	if (window->is_fec_available) {
		if (rs_k == window->rs.k) return;
		pgm_rs_destroy (&window->rs);
	} else
		window->is_fec_available = 1;
	pgm_rs_create (&window->rs, PGM_RS_DEFAULT_N, rs_k);
	window->tg_sqn_shift = pgm_power2_log2 (rs_k);
	window->tg_size = window->rs.k;
}

/* add one placeholder to leading edge due to detected lost packet.
 */

static
void
_pgm_rxw_add_placeholder (
	pgm_rxw_t* const	window,
	const pgm_time_t	now,
	const pgm_time_t	nak_rb_expiry
	)
{
	struct pgm_sk_buff_t* skb;
	pgm_rxw_state_t* state;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (!pgm_rxw_is_full (window));

/* advance lead */
	window->lead++;

/* add loss to bitmap */
	window->bitmap <<= 1;

/* update the Exponential Moving Average (EMA) data loss with loss:
 *     s_t = α × x_{t-1} + (1 - α) × s_{t-1}
 * x_{t-1} = 1
 *   ∴ s_t = α + (1 - α) × s_{t-1}
 */
	window->data_loss = window->ack_c_p + pgm_fp16mul ((pgm_fp16 (1) - window->ack_c_p), window->data_loss);

	skb			= pgm_alloc_skb (window->max_tpdu);
	state			= (pgm_rxw_state_t*)&skb->cb;
	skb->tstamp		= now;
	skb->sequence		= window->lead;
	state->timer_expiry	= nak_rb_expiry;

	if (!_pgm_rxw_is_first_of_tg_sqn (window, skb->sequence))
	{
		struct pgm_sk_buff_t* first_skb = _pgm_rxw_peek (window, _pgm_rxw_tg_sqn (window, skb->sequence));
		if (first_skb) {
			pgm_rxw_state_t* first_state = (pgm_rxw_state_t*)&first_skb->cb;
			first_state->is_contiguous = 0;
		}
	}

/* add skb to window */
	const uint_fast32_t index_	= skb->sequence % pgm_rxw_max_length (window);
	window->pdata[index_]		= skb;

	pgm_rxw_state (window, skb, PGM_PKT_STATE_BACK_OFF);

/* post-conditions */
	pgm_assert_cmpuint (pgm_rxw_length (window), >, 0);
	pgm_assert_cmpuint (pgm_rxw_length (window), <=, pgm_rxw_max_length (window));
	pgm_assert_cmpuint (_pgm_rxw_incoming_length (window), >, 0);
}

/* add a range of placeholders to the window.
 */

static
int
_pgm_rxw_add_placeholder_range (
	pgm_rxw_t* const	window,
	const uint32_t		sequence,
	const pgm_time_t	now,
	const pgm_time_t	nak_rb_expiry
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (pgm_uint32_gt (sequence, pgm_rxw_lead (window)));

/* check bounds of commit window */
	const uint32_t new_commit_sqns = ( 1 + sequence ) - window->trail;
        if ( !_pgm_rxw_commit_is_empty (window) &&
	     (new_commit_sqns >= pgm_rxw_max_length (window)) )
        {
		_pgm_rxw_update_lead (window, sequence, now, nak_rb_expiry);
		return PGM_RXW_BOUNDS;		/* effectively a slow consumer */
        }

	if (pgm_rxw_is_full (window)) {
		pgm_assert (_pgm_rxw_commit_is_empty (window));
		pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Receive window full on placeholder sequence."));
		_pgm_rxw_remove_trail (window);
	}

/* if packet is non-contiguous to current leading edge add place holders
 * TODO: can be rather inefficient on packet loss looping through dropped sequence numbers
 */
	while (pgm_rxw_next_lead (window) != sequence)
	{
		_pgm_rxw_add_placeholder (window, now, nak_rb_expiry);
		if (pgm_rxw_is_full (window)) {
			pgm_assert (_pgm_rxw_commit_is_empty (window));
			pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Receive window full on placeholder sequence."));
			_pgm_rxw_remove_trail (window);
		}
	}

/* post-conditions */
	pgm_assert (!pgm_rxw_is_full (window));

	return PGM_RXW_APPENDED;
}

/* update leading edge of receive window.
 *
 * returns number of place holders added.
 */

static
unsigned
_pgm_rxw_update_lead (
	pgm_rxw_t* const	window,
	const uint32_t		txw_lead,
	const pgm_time_t	now,
	const pgm_time_t	nak_rb_expiry
	)
{
	uint32_t lead;
	unsigned lost = 0;

/* pre-conditions */
	pgm_assert (NULL != window);

/* advertised lead is less than the current value */
	if (PGM_UNLIKELY(pgm_uint32_lte (txw_lead, window->lead)))
		return 0;

/* committed packets limit constrain the lead until they are released */
	if (!_pgm_rxw_commit_is_empty (window) &&
	    (txw_lead - window->trail) >= pgm_rxw_max_length (window))
	{
		lead = window->trail + pgm_rxw_max_length (window) - 1;
		if (lead == window->lead)
			return 0;
	}
	else
		lead = txw_lead;

/* count lost sequences */
	while (window->lead != lead)
	{
/* slow consumer or fast producer */
		if (pgm_rxw_is_full (window)) {
			pgm_assert (_pgm_rxw_commit_is_empty (window));
			pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Receive window full on window lead advancement."));
			_pgm_rxw_remove_trail (window);
		}
		_pgm_rxw_add_placeholder (window, now, nak_rb_expiry);
		lost++;
	}

	return lost;
}

/* checks whether an APDU is unrecoverable due to lost TPDUs.
 */

static inline
bool
_pgm_rxw_is_apdu_lost (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb
	)
{
	const pgm_rxw_state_t* state = (pgm_rxw_state_t*)&skb->cb;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);

/* lost is lost */
	if (PGM_PKT_STATE_LOST_DATA == state->pkt_state)
		return TRUE;

/* by definition, a single-TPDU APDU is complete */
	if (!skb->pgm_opt_fragment)
		return FALSE;

	const uint32_t apdu_first_sqn = ntohl (skb->of_apdu_first_sqn);

/* by definition, first fragment indicates APDU is available */
	if (apdu_first_sqn == skb->sequence)
		return FALSE;

	const struct pgm_sk_buff_t* const first_skb = _pgm_rxw_peek (window, apdu_first_sqn);
/* first fragment out-of-bounds */
	if (NULL == first_skb)
		return TRUE;

	const pgm_rxw_state_t* first_state = (pgm_rxw_state_t*)&first_skb->cb;
	if (PGM_PKT_STATE_LOST_DATA == first_state->pkt_state)
		return TRUE;

	return FALSE;
}

/* return the first missing packet sequence in the specified transmission
 * group or NULL if not required.
 */

static inline
struct pgm_sk_buff_t*
_pgm_rxw_find_missing (
	pgm_rxw_t* const		window,
	const uint32_t			tg_sqn		/* tg_sqn | pkt_sqn */
	)
{
	struct pgm_sk_buff_t* skb;
	pgm_rxw_state_t* state;

/* pre-conditions */
	pgm_assert (NULL != window);

	for (uint32_t i = tg_sqn, j = 0; j < window->tg_size; i++, j++)
	{
		skb = _pgm_rxw_peek (window, i);
		pgm_assert (NULL != skb);
		state = (pgm_rxw_state_t*)&skb->cb;
		switch (state->pkt_state) {
		case PGM_PKT_STATE_BACK_OFF:
		case PGM_PKT_STATE_WAIT_NCF:
		case PGM_PKT_STATE_WAIT_DATA:
		case PGM_PKT_STATE_LOST_DATA:
			return skb;

		case PGM_PKT_STATE_HAVE_DATA:
		case PGM_PKT_STATE_HAVE_PARITY:
			break;

		default: pgm_assert_not_reached(); break;
		}
	}

	return NULL;
}

/* returns TRUE if skb is a parity packet with packet length not
 * matching the transmission group length without the variable-packet-length
 * flag set.
 */

static inline
bool
_pgm_rxw_is_invalid_var_pktlen (
	pgm_rxw_t*		    const restrict window,
	const struct pgm_sk_buff_t* const restrict skb
	)
{
	const struct pgm_sk_buff_t* first_skb;

/* pre-conditions */
	pgm_assert (NULL != window);

	if (!window->is_fec_available)
		return FALSE;

	if (skb->pgm_header->pgm_options & PGM_OPT_VAR_PKTLEN)
		return FALSE;

	const uint32_t tg_sqn = _pgm_rxw_tg_sqn (window, skb->sequence);
	if (tg_sqn == skb->sequence)
		return FALSE;

	first_skb = _pgm_rxw_peek (window, tg_sqn);
	if (NULL == first_skb)
		return TRUE;	/* transmission group unrecoverable */

	if (first_skb->len == skb->len)
		return FALSE;

	return TRUE;
}

static inline
bool
_pgm_rxw_has_payload_op (
	const struct pgm_sk_buff_t* const	skb
	)
{
/* pre-conditions */
	pgm_assert (NULL != skb);
	pgm_assert (NULL != skb->pgm_header);

	return skb->pgm_opt_fragment || skb->pgm_header->pgm_options & PGM_OP_ENCODED;
}

/* returns TRUE is skb options are invalid when compared to the transmission group
 */

static inline
bool
_pgm_rxw_is_invalid_payload_op (
	pgm_rxw_t*		    const restrict window,
	const struct pgm_sk_buff_t* const restrict skb
	)
{
	const struct pgm_sk_buff_t* first_skb;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);

	if (!window->is_fec_available)
		return FALSE;

	const uint32_t tg_sqn = _pgm_rxw_tg_sqn (window, skb->sequence);
	if (tg_sqn == skb->sequence)
		return FALSE;

	first_skb = _pgm_rxw_peek (window, tg_sqn);
	if (NULL == first_skb)
		return TRUE;	/* transmission group unrecoverable */

	if (_pgm_rxw_has_payload_op (first_skb) == _pgm_rxw_has_payload_op (skb))
		return FALSE;

	return TRUE;
}

/* insert skb into window range, discard if duplicate.  window will have placeholder,
 * parity, or data packet already matching sequence.
 *
 * returns:
 * PGM_RXW_INSERTED - packet filled a waiting placeholder, skb consumed.
 * PGM_RXW_DUPLICATE - re-transmission of previously seen packet.
 * PGM_RXW_MALFORMED - corrupted or invalid packet.
 * PGM_RXW_BOUNDS - packet out of window.
 */

static
int
_pgm_rxw_insert (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict new_skb
	)
{
	struct pgm_sk_buff_t* skb;
	pgm_rxw_state_t* state;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != new_skb);
	pgm_assert (!_pgm_rxw_incoming_is_empty (window));

	if (PGM_UNLIKELY(_pgm_rxw_is_invalid_var_pktlen (window, new_skb) ||
	    _pgm_rxw_is_invalid_payload_op (window, new_skb)))
		return PGM_RXW_MALFORMED;

	if (new_skb->pgm_header->pgm_options & PGM_OPT_PARITY)
	{
		skb = _pgm_rxw_find_missing (window, new_skb->sequence);
		if (NULL == skb)
			return PGM_RXW_DUPLICATE;
		state = (pgm_rxw_state_t*)&skb->cb;
	}
	else
	{
		skb = _pgm_rxw_peek (window, new_skb->sequence);
		pgm_assert (NULL != skb);
		state = (pgm_rxw_state_t*)&skb->cb;

		if (state->pkt_state == PGM_PKT_STATE_HAVE_DATA)
			return PGM_RXW_DUPLICATE;
	}

/* APDU fragments are already declared lost */
	if (new_skb->pgm_opt_fragment &&
	    _pgm_rxw_is_apdu_lost (window, new_skb))
	{
		pgm_rxw_lost (window, skb->sequence);
		return PGM_RXW_BOUNDS;
	}

/* verify placeholder state */
	switch (state->pkt_state) {
	case PGM_PKT_STATE_BACK_OFF:
	case PGM_PKT_STATE_WAIT_NCF:
	case PGM_PKT_STATE_WAIT_DATA:
	case PGM_PKT_STATE_LOST_DATA:
		break;

	case PGM_PKT_STATE_HAVE_PARITY:
		_pgm_rxw_shuffle_parity (window, skb);
		break;

	default: pgm_assert_not_reached(); break;
	}

/* statistics */
	const uint32_t fill_time = (uint32_t)(new_skb->tstamp - skb->tstamp);
	PGM_HISTOGRAM_TIMES("Rx.RepairTime", fill_time);
	PGM_HISTOGRAM_COUNTS("Rx.NakTransmits", state->nak_transmit_count);
	PGM_HISTOGRAM_COUNTS("Rx.NcfRetries", state->ncf_retry_count);
	PGM_HISTOGRAM_COUNTS("Rx.DataRetries", state->data_retry_count);
	if (!window->max_fill_time) {
		window->max_fill_time = window->min_fill_time = fill_time;
	}
	else
	{
		if (fill_time > window->max_fill_time)
			window->max_fill_time = fill_time;
		else if (fill_time < window->min_fill_time)
			window->min_fill_time = fill_time;

		if (!window->max_nak_transmit_count) {
			window->max_nak_transmit_count = window->min_nak_transmit_count = state->nak_transmit_count;
		} else {
			if (state->nak_transmit_count > window->max_nak_transmit_count)
				window->max_nak_transmit_count = state->nak_transmit_count;
			else if (state->nak_transmit_count < window->min_nak_transmit_count)
				window->min_nak_transmit_count = state->nak_transmit_count;
		}
	}

/* add packet to bitmap */
	const uint_fast32_t pos = window->lead - new_skb->sequence;
	if (pos < 32) {
		window->bitmap |= 1 << pos;
	}

/* update the Exponential Moving Average (EMA) data loss with repair data.
 *     s_t = α × x_{t-1} + (1 - α) × s_{t-1}
 * x_{t-1} = 0
 *   ∴ s_t = (1 - α) × s_{t-1}
 */
	const uint_fast32_t s = pgm_fp16pow (pgm_fp16 (1) - window->ack_c_p, pos);
	if (s > window->data_loss)	window->data_loss = 0;
	else				window->data_loss -= s;

/* replace place holder skb with incoming skb */
	memcpy (new_skb->cb, skb->cb, sizeof(skb->cb));
	state = (void*)new_skb->cb;
	state->pkt_state = PGM_PKT_STATE_ERROR;
	_pgm_rxw_unlink (window, skb);
	pgm_free_skb (skb);
	const uint_fast32_t index_ = new_skb->sequence % pgm_rxw_max_length (window);
	window->pdata[index_] = new_skb;
	if (new_skb->pgm_header->pgm_options & PGM_OPT_PARITY)
		_pgm_rxw_state (window, new_skb, PGM_PKT_STATE_HAVE_PARITY);
	else
		_pgm_rxw_state (window, new_skb, PGM_PKT_STATE_HAVE_DATA);
	window->size += new_skb->len;

	return PGM_RXW_INSERTED;
}

/* shuffle parity packet at skb->sequence to any other needed spot.
 */

static inline
void
_pgm_rxw_shuffle_parity (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb
	)
{
	struct pgm_sk_buff_t* restrict missing;
	char cb[48];

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);

	missing = _pgm_rxw_find_missing (window, skb->sequence);
	if (NULL == missing)
		return;

/* replace place holder skb with parity skb */
	_pgm_rxw_unlink (window, missing);
	memcpy (cb, skb->cb, sizeof(skb->cb));
	memcpy (skb->cb, missing->cb, sizeof(skb->cb));
	memcpy (missing->cb, cb, sizeof(skb->cb));
	const uint32_t parity_index = skb->sequence % pgm_rxw_max_length (window);
	window->pdata[parity_index] = skb;
	const uint32_t missing_index = missing->sequence % pgm_rxw_max_length (window);
	window->pdata[missing_index] = missing;
}

/* skb advances the window lead.
 *
 * returns:
 * PGM_RXW_APPENDED - packet advanced window lead, skb consumed.
 * PGM_RXW_MALFORMED - corrupted or invalid packet.
 * PGM_RXW_BOUNDS - packet out of window.
 */

static
int
_pgm_rxw_append (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb,
	const pgm_time_t		     now
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);
	if (skb->pgm_header->pgm_options & PGM_OPT_PARITY) {
		pgm_assert (_pgm_rxw_tg_sqn (window, skb->sequence) == _pgm_rxw_tg_sqn (window, pgm_rxw_lead (window)));
	} else {
		pgm_assert (skb->sequence == pgm_rxw_next_lead (window));
	}

	if (PGM_UNLIKELY(_pgm_rxw_is_invalid_var_pktlen (window, skb) ||
	    _pgm_rxw_is_invalid_payload_op (window, skb)))
		return PGM_RXW_MALFORMED;

	if (pgm_rxw_is_full (window)) {
		if (_pgm_rxw_commit_is_empty (window)) {
			pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Receive window full on new data."));
			_pgm_rxw_remove_trail (window);
		} else {
			return PGM_RXW_BOUNDS;		/* constrained by commit window */
		}
	}

/* advance leading edge */
	window->lead++;

/* add packet to bitmap */
	window->bitmap = (window->bitmap << 1) | 1;

/* update the Exponential Moving Average (EMA) data loss with data:
 *     s_t = α × x_{t-1} + (1 - α) × s_{t-1}
 * x_{t-1} = 0
 *   ∴ s_t = (1 - α) × s_{t-1}
 */
	window->data_loss = pgm_fp16mul (window->data_loss, pgm_fp16 (1) - window->ack_c_p);

/* APDU fragments are already declared lost */
	if (PGM_UNLIKELY(skb->pgm_opt_fragment &&
	    _pgm_rxw_is_apdu_lost (window, skb)))
	{
		struct pgm_sk_buff_t* lost_skb	= pgm_alloc_skb (window->max_tpdu);
		lost_skb->tstamp		= now;
		lost_skb->sequence		= skb->sequence;

/* add lost-placeholder skb to window */
		const uint_fast32_t index_	= lost_skb->sequence % pgm_rxw_max_length (window);
		window->pdata[index_]		= lost_skb;

		_pgm_rxw_state (window, lost_skb, PGM_PKT_STATE_LOST_DATA);
		return PGM_RXW_BOUNDS;
	}

/* add skb to window */
	if (skb->pgm_header->pgm_options & PGM_OPT_PARITY)
	{
		const uint_fast32_t index_	= skb->sequence % pgm_rxw_max_length (window);
		window->pdata[index_]		= skb;
		_pgm_rxw_state (window, skb, PGM_PKT_STATE_HAVE_PARITY);
	}
	else
	{
		const uint_fast32_t index_	= skb->sequence % pgm_rxw_max_length (window);
		window->pdata[index_]		= skb;
		_pgm_rxw_state (window, skb, PGM_PKT_STATE_HAVE_DATA);
	}

/* statistics */
	window->size += skb->len;

	return PGM_RXW_APPENDED;
}

/* remove references to all commit packets not in the same transmission group
 * as the commit-lead
 */

PGM_GNUC_INTERNAL
void
pgm_rxw_remove_commit (
	pgm_rxw_t* const	window
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	const uint32_t tg_sqn_of_commit_lead = _pgm_rxw_tg_sqn (window, window->commit_lead);

	while (!_pgm_rxw_commit_is_empty (window) &&
	       tg_sqn_of_commit_lead != _pgm_rxw_tg_sqn (window, window->trail))
	{
		_pgm_rxw_remove_trail (window);
	}
}

/* flush packets but instead of calling on_data append the contiguous data packets
 * to the provided scatter/gather vector.
 *
 * when transmission groups are enabled, packets remain in the windows tagged committed
 * until the transmission group has been completely committed.  this allows the packet
 * data to be used in parity calculations to recover the missing packets.
 *
 * returns -1 on nothing read, returns length of bytes read, 0 is a valid read length.
 *
 * PGM skbuffs will have an increased reference count and must be unreferenced by the 
 * calling application.
 */

PGM_GNUC_INTERNAL
ssize_t
pgm_rxw_readv (
	pgm_rxw_t*    const restrict window,
	struct pgm_msgv_t** restrict pmsg,		/* message array, updated as messages appended */
	const unsigned		     pmsglen		/* number of items in pmsg */
	)
{
	const struct pgm_msgv_t* msg_end;
	struct pgm_sk_buff_t* skb;
	pgm_rxw_state_t* state;
	ssize_t bytes_read;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != pmsg);
	pgm_assert_cmpuint (pmsglen, >, 0);

	pgm_debug ("readv (window:%p pmsg:%p pmsglen:%u)",
		(void*)window, (void*)pmsg, pmsglen);

	msg_end = *pmsg + pmsglen - 1;

	if (_pgm_rxw_incoming_is_empty (window))
		return -1;

	skb = _pgm_rxw_peek (window, window->commit_lead);
	pgm_assert (NULL != skb);

	state = (pgm_rxw_state_t*)&skb->cb;
	switch (state->pkt_state) {
	case PGM_PKT_STATE_HAVE_DATA:
		bytes_read = _pgm_rxw_incoming_read (window, pmsg, (unsigned)(msg_end - *pmsg + 1));
		break;

	case PGM_PKT_STATE_LOST_DATA:
/* do not purge in situ sequence */
		if (_pgm_rxw_commit_is_empty (window)) {
			pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Removing lost trail from window"));
			_pgm_rxw_remove_trail (window);
		} else {
			pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Locking trail at commit window"));
		}
/* fall through */
	case PGM_PKT_STATE_BACK_OFF:
	case PGM_PKT_STATE_WAIT_NCF:
	case PGM_PKT_STATE_WAIT_DATA:
	case PGM_PKT_STATE_HAVE_PARITY:
		bytes_read = -1;
		break;

	case PGM_PKT_STATE_COMMIT_DATA:
	case PGM_PKT_STATE_ERROR:
	default:
		pgm_assert_not_reached();
		break;
	}

	return bytes_read;
}

/* remove lost sequences from the trailing edge of the window.  lost sequence
 * at lead of commit window invalidates all parity-data packets as any 
 * transmission group is now unrecoverable.
 *
 * returns number of sequences purged.
 */

static
unsigned
_pgm_rxw_remove_trail (
	pgm_rxw_t* const	window
	)
{
	struct pgm_sk_buff_t* skb;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (!pgm_rxw_is_empty (window));

	skb = _pgm_rxw_peek (window, window->trail);
	pgm_assert (NULL != skb);
	_pgm_rxw_unlink (window, skb);
	window->size -= skb->len;
/* remove reference to skb */
	if (PGM_UNLIKELY(pgm_mem_gc_friendly)) {
		const uint_fast32_t index_ = skb->sequence % pgm_rxw_max_length (window);
		window->pdata[index_] = NULL;
	}
	pgm_free_skb (skb);
	if (window->trail++ == window->commit_lead) {
/* data-loss */
		window->commit_lead++;
		window->cumulative_losses++;
		pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Data loss due to pulled trailing edge, fragment count %" PRIu32 "."),window->fragment_count);
		return 1;
	}
	return 0;
}

PGM_GNUC_INTERNAL
unsigned
pgm_rxw_remove_trail (
	pgm_rxw_t* const	window
	)
{
	pgm_debug ("remove_trail (window:%p)", (const void*)window);
	return _pgm_rxw_remove_trail (window);
}

/* read contiguous APDU-grouped sequences from the incoming window.
 *
 * side effects:
 *
 * 1) increments statics for window messages and bytes read.
 *
 * returns count of bytes read.
 */

static inline
ssize_t
_pgm_rxw_incoming_read (
	pgm_rxw_t*    const restrict window,
	struct pgm_msgv_t** restrict pmsg,		/* message array, updated as messages appended */
	unsigned		     pmsglen		/* number of items in pmsg */
	)
{
	const struct pgm_msgv_t* msg_end;
	struct pgm_sk_buff_t* skb;
	ssize_t bytes_read = 0;
	size_t  data_read  = 0;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != pmsg);
	pgm_assert_cmpuint (pmsglen, >, 0);
	pgm_assert (!_pgm_rxw_incoming_is_empty (window));

	pgm_debug ("_pgm_rxw_incoming_read (window:%p pmsg:%p pmsglen:%u)",
		 (void*)window, (void*)pmsg, pmsglen);

	msg_end = *pmsg + pmsglen - 1;
	do {
		skb = _pgm_rxw_peek (window, window->commit_lead);
		pgm_assert (NULL != skb);
		if (_pgm_rxw_is_apdu_complete (window,
					      skb->pgm_opt_fragment ? ntohl (skb->of_apdu_first_sqn) : skb->sequence))
		{
			bytes_read += _pgm_rxw_incoming_read_apdu (window, pmsg);
			data_read  ++;
		}
		else
		{
			break;
		}
	} while (*pmsg <= msg_end && !_pgm_rxw_incoming_is_empty (window));

	window->bytes_delivered += bytes_read;
	window->msgs_delivered  += data_read;
	return data_read > 0 ? bytes_read : -1;
}

/* returns TRUE if transmission group is lost.
 *
 * checking is lightly limited to bounds.
 */

static inline
bool
_pgm_rxw_is_tg_sqn_lost (
	pgm_rxw_t* const	window,
	const uint32_t		tg_sqn		/* transmission group sequence */
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert_cmpuint (_pgm_rxw_pkt_sqn (window, tg_sqn), ==, 0);

	if (pgm_rxw_is_empty (window))
		return TRUE;

	if (pgm_uint32_lt (tg_sqn, window->trail))
		return TRUE;

	return FALSE;
}

/* reconstruct missing sequences in a transmission group using embedded parity data.
 */

static
void
_pgm_rxw_reconstruct (
	pgm_rxw_t* const	window,
	const uint32_t		tg_sqn		/* transmission group sequence */
	)
{
	struct pgm_sk_buff_t	*skb;
	pgm_rxw_state_t		*state;
	struct pgm_sk_buff_t   **tg_skbs;
	pgm_gf8_t	       **tg_data, **tg_opts;
	uint8_t			*offsets;
	uint8_t			 rs_h = 0;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (1 == window->is_fec_available);
	pgm_assert_cmpuint (_pgm_rxw_pkt_sqn (window, tg_sqn), ==, 0);

/* use stack memory */
	tg_skbs = pgm_newa (struct pgm_sk_buff_t*, window->rs.n);
	tg_data = pgm_newa (pgm_gf8_t*, window->rs.n);
	tg_opts = pgm_newa (pgm_gf8_t*, window->rs.n);
	offsets = pgm_newa (uint8_t, window->rs.k);

	skb = _pgm_rxw_peek (window, tg_sqn);
	pgm_assert (NULL != skb);

	const bool is_var_pktlen = skb->pgm_header->pgm_options & PGM_OPT_VAR_PKTLEN;
	const bool is_op_encoded = skb->pgm_header->pgm_options & PGM_OPT_PRESENT;
	const uint16_t parity_length = ntohs (skb->pgm_header->pgm_tsdu_length);

	for (uint32_t i = tg_sqn, j = 0; i != (tg_sqn + window->rs.k); i++, j++)
	{
		skb = _pgm_rxw_peek (window, i);
		pgm_assert (NULL != skb);
		state = (pgm_rxw_state_t*)&skb->cb;
		switch (state->pkt_state) {
		case PGM_PKT_STATE_HAVE_DATA:
			tg_skbs[ j ] = skb;
			tg_data[ j ] = skb->data;
			tg_opts[ j ] = (pgm_gf8_t*)skb->pgm_opt_fragment;
			offsets[ j ] = j;
			break;

		case PGM_PKT_STATE_HAVE_PARITY:
			tg_skbs[ window->rs.k + rs_h ] = skb;
			tg_data[ window->rs.k + rs_h ] = skb->data;
			tg_opts[ window->rs.k + rs_h ] = (pgm_gf8_t*)skb->pgm_opt_fragment;
			offsets[ j ] = window->rs.k + rs_h;
			++rs_h;
/* fall through and alloc new skb for reconstructed data */
		case PGM_PKT_STATE_BACK_OFF:
		case PGM_PKT_STATE_WAIT_NCF:
		case PGM_PKT_STATE_WAIT_DATA:
		case PGM_PKT_STATE_LOST_DATA:
			skb = pgm_alloc_skb (window->max_tpdu);
			pgm_skb_reserve (skb, sizeof(struct pgm_header) + sizeof(struct pgm_data));
			skb->pgm_header = skb->head;
			skb->pgm_data = (void*)( skb->pgm_header + 1 );
			if (is_op_encoded) {
				const uint16_t opt_total_length = sizeof(struct pgm_opt_length) +
								 sizeof(struct pgm_opt_header) +
								 sizeof(struct pgm_opt_fragment);
				pgm_skb_reserve (skb, opt_total_length);
				skb->pgm_opt_fragment = (void*)( skb->pgm_data + 1 );
				pgm_skb_put (skb, parity_length);
				memset (skb->pgm_opt_fragment, 0, opt_total_length + parity_length);
			} else {
				pgm_skb_put (skb, parity_length);
				memset (skb->data, 0, parity_length);
			}
			tg_skbs[ j ] = skb;
			tg_data[ j ] = skb->data;
			tg_opts[ j ] = (void*)skb->pgm_opt_fragment;
			break;

		default: pgm_assert_not_reached(); break;
		}

		if (!skb->zero_padded) {
			memset (skb->tail, 0, parity_length - skb->len);
			skb->zero_padded = 1;
		}

	}

/* reconstruct payload */
	pgm_rs_decode_parity_appended (&window->rs,
				       tg_data,
				       offsets,
				       parity_length);

/* reconstruct opt_fragment option */
	if (is_op_encoded)
		pgm_rs_decode_parity_appended (&window->rs,
					       tg_opts,
					       offsets,
					       sizeof(struct pgm_opt_fragment));

/* swap parity skbs with reconstructed skbs */
	for (uint_fast8_t i = 0; i < window->rs.k; i++)
	{
		struct pgm_sk_buff_t* repair_skb;

		if (offsets[i] < window->rs.k)
			continue;

		repair_skb = tg_skbs[i];

		if (is_var_pktlen)
		{
			const uint16_t pktlen = *(uint16_t*)( (char*)repair_skb->tail - sizeof(uint16_t));
			if (pktlen > parity_length) {
				pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Invalid encoded variable packet length in reconstructed packet, dropping entire transmission group."));
				pgm_free_skb (repair_skb);
				for (uint_fast8_t j = i; j < window->rs.k; j++)
				{
					if (offsets[j] < window->rs.k)
						continue;
					pgm_rxw_lost (window, tg_skbs[offsets[j]]->sequence);
				}
				break;
			}
			const uint16_t padding = parity_length - pktlen;
			repair_skb->len -= padding;
			repair_skb->tail = (char*)repair_skb->tail - padding;
		}

#ifdef PGM_DISABLE_ASSERT
		_pgm_rxw_insert (window, repair_skb);
#else
		pgm_assert_cmpint (_pgm_rxw_insert (window, repair_skb), ==, PGM_RXW_INSERTED);
#endif
	}
}

/* check every TPDU in an APDU and verify that the data has arrived
 * and is available to commit to the application.
 *
 * if APDU sits in a transmission group that can be reconstructed use parity
 * data then the entire group will be decoded and any missing data packets
 * replaced by the recovery calculation.
 *
 * packets with single fragment fragment headers must be normalised as regular
 * packets before calling.
 *
 * APDUs exceeding PGM_MAX_FRAGMENTS or PGM_MAX_APDU length will be discarded.
 *
 * returns FALSE if APDU is incomplete or longer than max_len sequences.
 */

static
bool
_pgm_rxw_is_apdu_complete (
	pgm_rxw_t* const	window,
	const uint32_t		first_sequence
	)
{
	struct pgm_sk_buff_t	*skb;
	unsigned		 contiguous_tpdus = 0;
	size_t			 contiguous_size = 0;
	bool			 check_parity = FALSE;

/* pre-conditions */
	pgm_assert (NULL != window);

	pgm_debug ("_pgm_rxw_is_apdu_complete (window:%p first-sequence:%" PRIu32 ")",
		(const void*)window, first_sequence);

	skb = _pgm_rxw_peek (window, first_sequence);
	if (PGM_UNLIKELY(NULL == skb)) {
		return FALSE;
	}

	const size_t apdu_size = skb->pgm_opt_fragment ? ntohl (skb->of_apdu_len) : skb->len;
	const uint32_t  tg_sqn = _pgm_rxw_tg_sqn (window, first_sequence);

	pgm_assert_cmpuint (apdu_size, >=, skb->len);

/* protocol sanity check: maximum length */
	if (PGM_UNLIKELY(apdu_size > PGM_MAX_APDU)) {
		pgm_rxw_lost (window, first_sequence);
		return FALSE;
	}

	for (uint32_t sequence = first_sequence;
	     skb;
	     skb = _pgm_rxw_peek (window, ++sequence))
	{
		pgm_rxw_state_t* state = (pgm_rxw_state_t*)&skb->cb;

		if (!check_parity &&
		    PGM_PKT_STATE_HAVE_DATA != state->pkt_state)
		{
			if (window->is_fec_available &&
			    !_pgm_rxw_is_tg_sqn_lost (window, tg_sqn) )
			{
				check_parity = TRUE;
/* pre-seed committed sequence count */
				if (pgm_uint32_lte (tg_sqn, window->commit_lead))
					contiguous_tpdus += window->commit_lead - tg_sqn;
			}
			else
			{
				return FALSE;
			}
		}

		if (check_parity)
		{
			if (PGM_PKT_STATE_HAVE_DATA == state->pkt_state ||
			    PGM_PKT_STATE_HAVE_PARITY == state->pkt_state)
				++contiguous_tpdus;

/* have sufficient been received for reconstruction */
			if (contiguous_tpdus >= window->tg_size) {
				_pgm_rxw_reconstruct (window, tg_sqn);
				return _pgm_rxw_is_apdu_complete (window, first_sequence);
			}
		}
		else
		{
/* single packet APDU, already complete */
			if (PGM_PKT_STATE_HAVE_DATA == state->pkt_state &&
			    !skb->pgm_opt_fragment)
				return TRUE;

/* protocol sanity check: matching first sequence reference */
			if (PGM_UNLIKELY(ntohl (skb->of_apdu_first_sqn) != first_sequence)) {
				pgm_rxw_lost (window, first_sequence);
				return FALSE;
			}

/* protocol sanity check: matching apdu length */
			if (PGM_UNLIKELY(ntohl (skb->of_apdu_len) != apdu_size)) {
				pgm_rxw_lost (window, first_sequence);
				return FALSE;
			}

/* protocol sanity check: maximum number of fragments per apdu */
			if (PGM_UNLIKELY(++contiguous_tpdus > PGM_MAX_FRAGMENTS)) {
				pgm_rxw_lost (window, first_sequence);
				return FALSE;
			}

			contiguous_size += skb->len;
			if (apdu_size == contiguous_size)
				return TRUE;
			else if (PGM_UNLIKELY(apdu_size < contiguous_size)) {
				pgm_rxw_lost (window, first_sequence);
				return FALSE;
			}
		}
	}

/* pending */
	return FALSE;
}

/* read one APDU consisting of one or more TPDUs.  target array is guaranteed
 * to be big enough to store complete APDU.
 */

static inline
ssize_t
_pgm_rxw_incoming_read_apdu (
	pgm_rxw_t*    const restrict window,
	struct pgm_msgv_t** restrict pmsg		/* message array, updated as messages appended */
	)
{
	struct pgm_sk_buff_t *skb;
	size_t		      contiguous_len = 0;
	unsigned	      count = 0;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != pmsg);

	pgm_debug ("_pgm_rxw_incoming_read_apdu (window:%p pmsg:%p)",
		(const void*)window, (const void*)pmsg);

	skb = _pgm_rxw_peek (window, window->commit_lead);
	pgm_assert (NULL != skb);

	const size_t apdu_len = skb->pgm_opt_fragment ? ntohl (skb->of_apdu_len) : skb->len;
	pgm_assert_cmpuint (apdu_len, >=, skb->len);

	do {
		_pgm_rxw_state (window, skb, PGM_PKT_STATE_COMMIT_DATA);
		(*pmsg)->msgv_skb[ count++ ] = skb;
		contiguous_len += skb->len;
		window->commit_lead++;
		if (apdu_len == contiguous_len)
			break;
		skb = _pgm_rxw_peek (window, window->commit_lead);
	} while (apdu_len > contiguous_len);

	(*pmsg)->msgv_len = count;
	(*pmsg)++;

/* post-conditions */
	pgm_assert (!_pgm_rxw_commit_is_empty (window));

	return contiguous_len;
}

/* returns transmission group sequence (TG_SQN) from sequence (SQN).
 */

static inline
uint32_t
_pgm_rxw_tg_sqn (
	pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	const uint32_t tg_sqn_mask = 0xffffffff << window->tg_sqn_shift;
	return sequence & tg_sqn_mask;
}

/* returns packet number (PKT_SQN) from sequence (SQN).
 */

static inline
uint32_t
_pgm_rxw_pkt_sqn (
	pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	const uint32_t tg_sqn_mask = 0xffffffff << window->tg_sqn_shift;
	return sequence & ~tg_sqn_mask;
}

/* returns TRUE when the sequence is the first of a transmission group.
 */

static inline
bool
_pgm_rxw_is_first_of_tg_sqn (
	pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	return _pgm_rxw_pkt_sqn (window, sequence) == 0;
}

/* returns TRUE when the sequence is the last of a transmission group
 */

static inline
bool
_pgm_rxw_is_last_of_tg_sqn (
	pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	return _pgm_rxw_pkt_sqn (window, sequence) == window->tg_size - 1;
}

/* set PGM skbuff to new FSM state.
 */

static
void
_pgm_rxw_state (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb,
	const int			     new_pkt_state
	)
{
	pgm_rxw_state_t* state;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);

	state = (pgm_rxw_state_t*)&skb->cb;

/* remove current state */
	if (PGM_PKT_STATE_ERROR != state->pkt_state)
		_pgm_rxw_unlink (window, skb);

	switch (new_pkt_state) {
	case PGM_PKT_STATE_BACK_OFF:
		pgm_queue_push_head_link (&window->nak_backoff_queue, (pgm_list_t*)skb);
		break;

	case PGM_PKT_STATE_WAIT_NCF:
		pgm_queue_push_head_link (&window->wait_ncf_queue, (pgm_list_t*)skb);
		break;

	case PGM_PKT_STATE_WAIT_DATA:
		pgm_queue_push_head_link (&window->wait_data_queue, (pgm_list_t*)skb);
		break;

	case PGM_PKT_STATE_HAVE_DATA:
		window->fragment_count++;
		pgm_assert_cmpuint (window->fragment_count, <=, pgm_rxw_length (window));
		break;

	case PGM_PKT_STATE_HAVE_PARITY:
		window->parity_count++;
		pgm_assert_cmpuint (window->parity_count, <=, pgm_rxw_length (window));
		break;

	case PGM_PKT_STATE_COMMIT_DATA:
		window->committed_count++;
		pgm_assert_cmpuint (window->committed_count, <=, pgm_rxw_length (window));
		break;

	case PGM_PKT_STATE_LOST_DATA:
		window->lost_count++;
		window->cumulative_losses++;
		window->has_event = 1;
		pgm_assert_cmpuint (window->lost_count, <=, pgm_rxw_length (window));
		break;

	case PGM_PKT_STATE_ERROR:
		break;

	default: pgm_assert_not_reached(); break;
	}

	state->pkt_state = new_pkt_state;
}

PGM_GNUC_INTERNAL
void
pgm_rxw_state (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb,
	const int			     new_pkt_state
	)
{
	pgm_debug ("state (window:%p skb:%p new_pkt_state:%s)",
		(const void*)window, (const void*)skb, pgm_pkt_state_string (new_pkt_state));
	_pgm_rxw_state (window, skb, new_pkt_state);
}

/* remove current state from sequence.
 */

static
void
_pgm_rxw_unlink (
	pgm_rxw_t*	      const restrict window,
	struct pgm_sk_buff_t* const restrict skb
	)
{
	pgm_rxw_state_t* state;
	pgm_queue_t* queue;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (NULL != skb);

	state = (pgm_rxw_state_t*)&skb->cb;

	switch (state->pkt_state) {
	case PGM_PKT_STATE_BACK_OFF:
		pgm_assert (!pgm_queue_is_empty (&window->nak_backoff_queue));
		queue = &window->nak_backoff_queue;
		goto unlink_queue;

	case PGM_PKT_STATE_WAIT_NCF:
		pgm_assert (!pgm_queue_is_empty (&window->wait_ncf_queue));
		queue = &window->wait_ncf_queue;
		goto unlink_queue;

	case PGM_PKT_STATE_WAIT_DATA:
		pgm_assert (!pgm_queue_is_empty (&window->wait_data_queue));
		queue = &window->wait_data_queue;
unlink_queue:
		pgm_queue_unlink (queue, (pgm_list_t*)skb);
		break;

	case PGM_PKT_STATE_HAVE_DATA:
		pgm_assert_cmpuint (window->fragment_count, >, 0);
		window->fragment_count--;
		break;

	case PGM_PKT_STATE_HAVE_PARITY:
		pgm_assert_cmpuint (window->parity_count, >, 0);
		window->parity_count--;
		break;

	case PGM_PKT_STATE_COMMIT_DATA:
		pgm_assert_cmpuint (window->committed_count, >, 0);
		window->committed_count--;
		break;

	case PGM_PKT_STATE_LOST_DATA:
		pgm_assert_cmpuint (window->lost_count, >, 0);
		window->lost_count--;
		break;

	case PGM_PKT_STATE_ERROR:
		break;

	default: pgm_assert_not_reached(); break;
	}

	state->pkt_state = PGM_PKT_STATE_ERROR;
	pgm_assert (((pgm_list_t*)skb)->next == NULL);
	pgm_assert (((pgm_list_t*)skb)->prev == NULL);
}

/* returns the pointer at the given index of the window.
 */

PGM_GNUC_INTERNAL
struct pgm_sk_buff_t*
pgm_rxw_peek (
	pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
	pgm_debug ("peek (window:%p sequence:%" PRIu32 ")", (void*)window, sequence);
	return _pgm_rxw_peek (window, sequence);
}

/* mark an existing sequence lost due to failed recovery.
 */

PGM_GNUC_INTERNAL
void
pgm_rxw_lost (
	pgm_rxw_t* const	window,
	const uint32_t		sequence
	)
{
	struct pgm_sk_buff_t* skb;
	pgm_rxw_state_t* state;

/* pre-conditions */
	pgm_assert (NULL != window);
	pgm_assert (!pgm_rxw_is_empty (window));

	pgm_debug ("lost (window:%p sequence:%" PRIu32 ")",
		 (const void*)window, sequence);

	skb = _pgm_rxw_peek (window, sequence);
	pgm_assert (NULL != skb);

	state = (pgm_rxw_state_t*)&skb->cb;

	if (PGM_UNLIKELY(!(state->pkt_state == PGM_PKT_STATE_BACK_OFF  ||
	                 state->pkt_state == PGM_PKT_STATE_WAIT_NCF  ||
	                 state->pkt_state == PGM_PKT_STATE_WAIT_DATA ||
			 state->pkt_state == PGM_PKT_STATE_HAVE_DATA ||	/* fragments */
			 state->pkt_state == PGM_PKT_STATE_HAVE_PARITY)))
	{
		pgm_fatal (_("Unexpected state %s(%u)"), pgm_pkt_state_string (state->pkt_state), state->pkt_state);
		pgm_assert_not_reached();
	}

	_pgm_rxw_state (window, skb, PGM_PKT_STATE_LOST_DATA);
}

/* received a uni/multicast ncf, search for a matching nak & tag or extend window if
 * beyond lead
 *
 * returns:
 * PGM_RXW_BOUNDS - sequence is outside of window, or window is undefined.
 * PGM_RXW_UPDATED - receiver state updated, waiting for data.
 * PGM_RXW_DUPLICATE - data already exists at sequence.
 * PGM_RXW_APPENDED - lead is extended with state set waiting for data.
 */

PGM_GNUC_INTERNAL
int
pgm_rxw_confirm (
	pgm_rxw_t* const	window,
	const uint32_t		sequence,
	const pgm_time_t	now,
	const pgm_time_t	nak_rdata_expiry,		/* pre-calculated expiry times */
	const pgm_time_t	nak_rb_expiry
	)
{
/* pre-conditions */
	pgm_assert (NULL != window);

	pgm_debug ("confirm (window:%p sequence:%" PRIu32 " nak_rdata_expiry:%" PGM_TIME_FORMAT " nak_rb_expiry:%" PGM_TIME_FORMAT ")",
		(void*)window, sequence, nak_rdata_expiry, nak_rb_expiry);

/* NCFs do not define the transmit window */
	if (PGM_UNLIKELY(!window->is_defined))
		return PGM_RXW_BOUNDS;

/* sequence already committed */
	if (pgm_uint32_lt (sequence, window->commit_lead)) {
		if (pgm_uint32_gte (sequence, window->trail))
			return PGM_RXW_DUPLICATE;
		else
			return PGM_RXW_BOUNDS;
	}

	if (pgm_uint32_lte (sequence, window->lead))
		return _pgm_rxw_recovery_update (window, sequence, nak_rdata_expiry);

	if (sequence == window->lead) 
		return _pgm_rxw_recovery_append (window, now, nak_rdata_expiry);
	else {
		_pgm_rxw_add_placeholder_range (window, sequence, now, nak_rb_expiry);
		return _pgm_rxw_recovery_append (window, now, nak_rdata_expiry);
	}
}

/* update an incoming sequence with state transition to WAIT-DATA.
 *
 * returns:
 * PGM_RXW_UPDATED - receiver state updated, waiting for data.
 * PGM_RXW_DUPLICATE - data already exists at sequence.
 */

static inline
int
_pgm_rxw_recovery_update (
	pgm_rxw_t* const	window,
	const uint32_t		sequence,
	const pgm_time_t	nak_rdata_expiry		/* pre-calculated expiry times */
	)
{
	pgm_rxw_state_t* state;
	struct pgm_sk_buff_t* skb;

/* pre-conditions */
	pgm_assert (NULL != window);

/* fetch skb from window and bump expiration times */
	skb = _pgm_rxw_peek (window, sequence);
	pgm_assert (NULL != skb);
	state = (pgm_rxw_state_t*)&skb->cb;
	switch (state->pkt_state) {
	case PGM_PKT_STATE_BACK_OFF:
	case PGM_PKT_STATE_WAIT_NCF:
		pgm_rxw_state (window, skb, PGM_PKT_STATE_WAIT_DATA);

/* fall through */
	case PGM_PKT_STATE_WAIT_DATA:
		state->timer_expiry = nak_rdata_expiry;
		return PGM_RXW_UPDATED;

	case PGM_PKT_STATE_HAVE_DATA:
	case PGM_PKT_STATE_HAVE_PARITY:
	case PGM_PKT_STATE_COMMIT_DATA:
	case PGM_PKT_STATE_LOST_DATA:
		break;

	default: pgm_assert_not_reached(); break;
	}

	return PGM_RXW_DUPLICATE;
}

/* append an skb to the incoming window with WAIT-DATA state.
 *
 * returns:
 * PGM_RXW_APPENDED - lead is extended with state set waiting for data.
 * PGM_RXW_BOUNDS   - constrained by commit window
 */

static inline
int
_pgm_rxw_recovery_append (
	pgm_rxw_t* const	window,
	const pgm_time_t	now,
	const pgm_time_t	nak_rdata_expiry		/* pre-calculated expiry times */
	)
{
	struct pgm_sk_buff_t* skb;
	pgm_rxw_state_t* state;

/* pre-conditions */
	pgm_assert (NULL != window);

	if (pgm_rxw_is_full (window)) {
		if (_pgm_rxw_commit_is_empty (window)) {
			pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Receive window full on confirmed sequence."));
			_pgm_rxw_remove_trail (window);
		} else {
			return PGM_RXW_BOUNDS;		/* constrained by commit window */
		}
	}

/* advance leading edge */
	window->lead++;

/* add loss to bitmap */
	window->bitmap <<= 1;

/* update the Exponential Moving Average (EMA) data loss with loss:
 *     s_t = α × x_{t-1} + (1 - α) × s_{t-1}
 * x_{t-1} = 1
 *   ∴ s_t = α + (1 - α) × s_{t-1}
 */
	window->data_loss = window->ack_c_p + pgm_fp16mul (pgm_fp16 (1) - window->ack_c_p, window->data_loss);

	skb			= pgm_alloc_skb (window->max_tpdu);
	state			= (pgm_rxw_state_t*)&skb->cb;
	skb->tstamp		= now;
	skb->sequence		= window->lead;
	state->timer_expiry	= nak_rdata_expiry;

	const uint_fast32_t index_	= pgm_rxw_lead (window) % pgm_rxw_max_length (window);
	window->pdata[index_]		= skb;
	_pgm_rxw_state (window, skb, PGM_PKT_STATE_WAIT_DATA);

	return PGM_RXW_APPENDED;
}

/* dumps window state to stdout
 */

PGM_GNUC_INTERNAL
void
pgm_rxw_dump (
	const pgm_rxw_t* const	window
	)
{
	pgm_info ("window = {"
		"tsi = {gsi = {identifier = %i.%i.%i.%i.%i.%i}, sport = %" PRIu16 "}, "
		"nak_backoff_queue = {head = %p, tail = %p, length = %u}, "
		"wait_ncf_queue = {head = %p, tail = %p, length = %u}, "
		"wait_data_queue = {head = %p, tail = %p, length = %u}, "
		"lost_count = %" PRIu32 ", "
		"fragment_count = %" PRIu32 ", "
		"parity_count = %" PRIu32 ", "
		"committed_count = %" PRIu32 ", "
		"max_tpdu = %" PRIu16 ", "
		"tg_size = %" PRIu32 ", "
		"tg_sqn_shift = %u, "
		"lead = %" PRIu32 ", "
		"trail = %" PRIu32 ", "
		"rxw_trail = %" PRIu32 ", "
		"rxw_trail_init = %" PRIu32 ", "
		"commit_lead = %" PRIu32 ", "
		"is_constrained = %u, "
		"is_defined = %u, "
		"has_event = %u, "
		"is_fec_available = %u, "
		"min_fill_time = %" PRIu32 ", "
		"max_fill_time = %" PRIu32 ", "
		"min_nak_transmit_count = %" PRIu32 ", "
		"max_nak_transmit_count = %" PRIu32 ", "
		"cumulative_losses = %" PRIu32 ", "
		"bytes_delivered = %" PRIu32 ", "
		"msgs_delivered = %" PRIu32 ", "
		"size = %" PRIzu ", "
		"alloc = %" PRIu32 ", "
		"pdata = []"
		"}",
		window->tsi->gsi.identifier[0], 
			window->tsi->gsi.identifier[1],
			window->tsi->gsi.identifier[2],
			window->tsi->gsi.identifier[3],
			window->tsi->gsi.identifier[4],
			window->tsi->gsi.identifier[5],
			ntohs (window->tsi->sport),
		(void*)window->nak_backoff_queue.head,
			(void*)window->nak_backoff_queue.tail,
			window->nak_backoff_queue.length,
		(void*)window->wait_ncf_queue.head,
			(void*)window->wait_ncf_queue.tail,
			window->wait_ncf_queue.length,
		(void*)window->wait_data_queue.head,
			(void*)window->wait_data_queue.tail,
			window->wait_data_queue.length,
		window->lost_count,
		window->fragment_count,
		window->parity_count,
		window->committed_count,
		window->max_tpdu,
		window->tg_size,
		window->tg_sqn_shift,
		window->lead,
		window->trail,
		window->rxw_trail,
		window->rxw_trail_init,
		window->commit_lead,
		window->is_constrained,
		window->is_defined,
		window->has_event,
		window->is_fec_available,
		window->min_fill_time,
		window->max_fill_time,
		window->min_nak_transmit_count,
		window->max_nak_transmit_count,
		window->cumulative_losses,
		window->bytes_delivered,
		window->msgs_delivered,
		window->size,
		window->alloc
	);
}

/* state string helper
 */

PGM_GNUC_INTERNAL
const char*
pgm_pkt_state_string (
	const int		pkt_state
	)
{
	const char* c;

	switch (pkt_state) {
	case PGM_PKT_STATE_BACK_OFF:	c = "PGM_PKT_STATE_BACK_OFF"; break;
	case PGM_PKT_STATE_WAIT_NCF:	c = "PGM_PKT_STATE_WAIT_NCF"; break;
	case PGM_PKT_STATE_WAIT_DATA:	c = "PGM_PKT_STATE_WAIT_DATA"; break;
	case PGM_PKT_STATE_HAVE_DATA:	c = "PGM_PKT_STATE_HAVE_DATA"; break;
	case PGM_PKT_STATE_HAVE_PARITY:	c = "PGM_PKT_STATE_HAVE_PARITY"; break;
	case PGM_PKT_STATE_COMMIT_DATA: c = "PGM_PKT_STATE_COMMIT_DATA"; break;
	case PGM_PKT_STATE_LOST_DATA:	c = "PGM_PKT_STATE_LOST_DATA"; break;
	case PGM_PKT_STATE_ERROR:	c = "PGM_PKT_STATE_ERROR"; break;
	default: c = "(unknown)"; break;
	}

	return c;
}

PGM_GNUC_INTERNAL
const char*
pgm_rxw_returns_string (
	const int		rxw_returns
	)
{
	const char* c;

	switch (rxw_returns) {
	case PGM_RXW_OK:			c = "PGM_RXW_OK"; break;
	case PGM_RXW_INSERTED:			c = "PGM_RXW_INSERTED"; break;
	case PGM_RXW_APPENDED:			c = "PGM_RXW_APPENDED"; break;
	case PGM_RXW_UPDATED:			c = "PGM_RXW_UPDATED"; break;
	case PGM_RXW_MISSING:			c = "PGM_RXW_MISSING"; break;
	case PGM_RXW_DUPLICATE:			c = "PGM_RXW_DUPLICATE"; break;
	case PGM_RXW_MALFORMED:			c = "PGM_RXW_MALFORMED"; break;
	case PGM_RXW_BOUNDS:			c = "PGM_RXW_BOUNDS"; break;
	case PGM_RXW_SLOW_CONSUMER:		c = "PGM_RXW_SLOW_CONSUMER"; break;
	case PGM_RXW_UNKNOWN:			c = "PGM_RXW_UNKNOWN"; break;
	default: c = "(unknown)"; break;
	}

	return c;
}

/* eof */
libpgm-5.1.118-1~dfsg/openpgm/pgm/time.c.c89.patch0000644000175000017500000000263311640407354020351 0ustar  locallocal--- time.c	2011-03-29 20:34:27.000000000 +0800
+++ time.c89.c	2011-03-29 20:34:35.000000000 +0800
@@ -347,6 +347,7 @@
  * MSDN statement: The frequency cannot change while the system is running.
  * http://msdn.microsoft.com/en-us/library/ms644905(v=vs.85).aspx
  */
+		{
 		LARGE_INTEGER frequency;
 		if (QueryPerformanceFrequency (&frequency))
 		{
@@ -362,6 +363,7 @@
 				       _("No supported high-resolution performance counter: %s"),
 				       pgm_win_strerror (winstr, sizeof (winstr), save_errno));
 		}
+		}
 #elif defined(__APPLE__)
 /* nb: RDTSC is non-functional on Darwin */
 		uint64_t cpufrequency;
@@ -457,6 +459,7 @@
 
 /* update Windows timer resolution to 1ms */
 #ifdef _WIN32
+	{
 	TIMECAPS tc;
 	if (TIMERR_NOERROR == timeGetDevCaps (&tc, sizeof (TIMECAPS)))
 	{
@@ -468,6 +471,7 @@
 	{
 		pgm_warn (_("Unable to determine timer device resolution."));
 	}
+	}
 #endif
 
 	return TRUE;
@@ -827,11 +831,15 @@
 /* HPET counter tick period is in femto-seconds, a value of 0 is not permitted,
  * the value must be <= 0x05f5e100 or 100ns.
  */
+	{
 	const uint32_t hpet_period = *((uint32_t*)(hpet_ptr + HPET_COUNTER_CLK_PERIOD));
 	set_hpet_mul (hpet_period);
+	}
 #if defined( __x86_64__ ) || defined( __amd64 )
+	{
 	const uint32_t hpet_caps = *((uint32_t*)(hpet_ptr + HPET_GENERAL_CAPS_REGISTER));
 	hpet_wrap = hpet_caps & HPET_COUNT_SIZE_CAP ? 0 : (1ULL << 32);
+	}
 #else
 	hpet_wrap = 1ULL << 32;
 #endif
libpgm-5.1.118-1~dfsg/openpgm/doc/0000755000175000017500000000000011640410703015515 5ustar  locallocallibpgm-5.1.118-1~dfsg/openpgm/doc/README.DFSG0000644000175000017500000000012511640410703017115 0ustar  locallocalREADME.DFSG for OpenPGM

RFC3208 and PGMCC IEFT draft removed for DFSG compliance.