diff options
Diffstat (limited to 'testing/fulltests/support/clib_build')
-rwxr-xr-x | testing/fulltests/support/clib_build | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/fulltests/support/clib_build b/testing/fulltests/support/clib_build new file mode 100755 index 0000000..0c7eb6d --- /dev/null +++ b/testing/fulltests/support/clib_build @@ -0,0 +1,62 @@ +#!/bin/sh + +# build the C test file ... + +rm -f "$2.c" +cat >>"$2.c" <<EOF +/* net-snmp standard headers */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/library/large_fd_set.h> + +/* testing specific header */ +#include <net-snmp/library/testing.h> + +/* standard headers */ +#include <errno.h> +#include <stdio.h> +#include <sys/types.h> +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#if HAVE_STRING_H +#include <string.h> +#else +#include <strings.h> +#endif +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif +#ifdef HAVE_NETINET_IP6_H +#include <netinet/ip6.h> +#endif +#ifndef HAVE_INET_PTON +#include "snmplib/inet_pton.h" +#endif +#ifndef HAVE_INET_NTOP +#include "snmplib/inet_ntop.h" +#endif + +int +main(int argc, char *argv[]) { + +EOF +echo >>"$2.c" "#line 1 \"$1\"" +cat >>"$2.c" "$1" +cat >>"$2.c" <<EOF + + if (__did_plan == 0) { + PLAN(__test_counter); + } + + return(0); +} + +EOF + +# ... and compile it. +${builddir}/libtool --mode=link `${builddir}/net-snmp-config --build-command` -I$builddir/include -I$srcdir -I$srcdir/include -o $2 $2.c ${builddir}/snmplib/libnetsnmp.la `${builddir}/net-snmp-config --external-libs` +echo $2 |