Debian Codegraph @

testing/fulltests/support/cagentlib_build

raw
1 #!/bin/sh
2
3 # build the C test file ...
4
5 rm -f "$2.c"
6 cat >>"$2.c" <<EOF
7 /* net-snmp standard headers */
8 #include <net-snmp/net-snmp-config.h>
9 #include <net-snmp/net-snmp-includes.h>
10 #include <net-snmp/agent/net-snmp-agent-includes.h>
11 #include <agentx/protocol.h>
12
13 /* testing specific header */
14 #include <net-snmp/library/testing.h>
15
16 /* standard headers */
17 #include <stdio.h>
18 #include <sys/types.h>
19 #ifdef HAVE_STDLIB_H
20 #include <stdlib.h>
21 #endif
22 #if HAVE_STRING_H
23 #include <string.h>
24 #else
25 #include <strings.h>
26 #endif
27
28 int
29 main(int argc, char *argv[]) {
30
31 EOF
32 echo >>"$2.c" "#line 1 \"$1\""
33 cat >>"$2.c" "$1"
34 cat >>"$2.c" <<EOF
35
36 if (__did_plan == 0) {
37 PLAN(__test_counter);
38 }
39
40 return(0);
41 }
42
43 EOF
44
45 # ... and compile it.
46 ${builddir}/libtool --mode=link `${builddir}/net-snmp-config --build-command` -I$builddir/include -I$srcdir/include -I$srcdir/agent/mibgroup -o $2 $2.c ${builddir}/snmplib/libnetsnmp.la ${builddir}/agent/libnetsnmpagent.la `${builddir}/net-snmp-config --external-libs`
47 echo $2