initial load of upstream version 1.06.32
[xmlrpc-c] / xmlrpc-c-config.test.in
1 #!/bin/sh
2 # This is like 'xmlrpc-c-config', but for testing Xmlrpc-c from its build
3 # directory instead of for an installed instance of Xmlrpc-c.
4 #
5 # For example, the make file in the examples/ directory uses this program
6 # to link the example programs with the Xmlrpc-c libraries in the build
7 # directory.  A real application program would instead use xmlrpc-c-config
8 # and get the Xmlrpc-c libraries from their installed home.
9
10 # @srcdir@ and @top_srcdir@ are useless because they can be relative.
11
12 SRCDIR="@BUILDDIR@"  # until we figure out how to do it right
13 BUILDDIR="@BUILDDIR@"
14 ENABLE_LIBXML2_BACKEND="@ENABLE_LIBXML2_BACKEND@"
15 ENABLE_ABYSS_THREADS="@ENABLE_ABYSS_THREADS@"
16 MUST_BUILD_CURL_CLIENT="@MUST_BUILD_CURL_CLIENT@"
17 MUST_BUILD_WININET_CLIENT="@MUST_BUILD_WININET_CLIENT@"
18 MUST_BUILD_LIBWWW_CLIENT="@MUST_BUILD_LIBWWW_CLIENT@"
19 LSOCKET="@LSOCKET@"
20
21 if test $# -eq 0; then
22       echo "You need to specify arguments"
23       exit 1
24 fi
25
26 sopath=
27
28 if test "${ENABLE_LIBXML2_BACKEND}" = "yes"; then
29   LIBXML=`xml2-config --libs`
30 else
31   LIBXML="${BUILDDIR}/lib/expat/xmlparse/.libs/libxmlrpc_xmlparse.a"
32   sopath="${BUILDDIR}/lib/expat/xmlparse/.libs:$sopath"
33   LIBXML="${LIBXML} ${BUILDDIR}/lib/expat/xmltok/.libs/libxmlrpc_xmltok.a"
34   sopath="${BUILDDIR}/lib/expat/xmltok/.libs:$sopath"
35 fi
36
37 needCpp=no
38
39 LIBXMLRPC="${BUILDDIR}/src/.libs/libxmlrpc.a"
40 LIBXMLRPC_UTIL="${BUILDDIR}/lib/libutil/.libs/libxmlrpc_util.a"
41
42 the_libs="${LIBXMLRPC} ${LIBXMLRPC_UTIL} ${LIBXML}"
43 the_includes="-I${SRCDIR}/include"
44 sopath="${BUILDDIR}/src/.libs:$sopath"
45
46 while test $# -gt 0; do
47   case $1 in
48     c++)
49       # Unfortunately, there is just one legacy CPP library for
50       # everything, and it needs all the C libraries -- base, client,
51       # and server.  So all legacy C++ programs get linked with client
52       # and server libraries, whether they need them or not.
53
54       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server.a $the_libs"
55       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server_abyss.a $the_libs"
56       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_client.a $the_libs"
57       the_libs="${BUILDDIR}/src/cpp/libxmlrpc_cpp.a $the_libs"
58       ;;
59     c++2)
60       needCpp=yes
61       the_libs="${BUILDDIR}/src/cpp/libxmlrpc++.a $the_libs"
62       ;;
63     server-util)
64       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server.a $the_libs"
65       ;;
66     cgi-server)
67       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server.a $the_libs"
68       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server_cgi.a $the_libs"
69       ;;
70     abyss-server)
71       if test "${ENABLE_ABYSS_THREADS}" = "yes"; then
72         the_libs="-lpthread $the_libs"
73         fi
74       the_libs="${LSOCKET} $the_libs"
75       the_libs="${BUILDDIR}/lib/abyss/src/.libs/libxmlrpc_abyss.a $the_libs"
76       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server.a $the_libs"
77       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_server_abyss.a $the_libs"
78       if test "${needCpp}" = "yes"; then
79         the_libs="${BUILDDIR}/src/cpp/libxmlrpc_server++.a $the_libs"
80         the_libs="${BUILDDIR}/src/cpp/libxmlrpc_server_abyss++.a $the_libs"
81         fi
82       the_includes="-I${SRCDIR}/lib/abyss/src $the_includes"
83       sopath="${BUILDDIR}/lib/abyss/src/.libs:$sopath"
84       ;;
85     client)
86       the_libs="${BUILDDIR}/src/.libs/libxmlrpc_client.a $the_libs"
87       if test "${MUST_BUILD_WININET_CLIENT}" = "yes"; then
88         the_libs="@WININET_LDADD@ $the_libs"
89         the_rpath="@WININET_RPATH@ $the_rpath"
90         the_wl_rpath="@WININET_WL_RPATH@ $the_wl_rpath"
91         fi
92       if test "${MUST_BUILD_CURL_CLIENT}" = "yes"; then
93         the_libs="@CURL_LDADD@ $the_libs"
94         the_rpath="@CURL_RPATH@ $the_rpath"
95         the_wl_rpath="@CURL_WL_RPATH@ $the_wl_rpath"
96         fi
97       if test "${MUST_BUILD_LIBWWW_CLIENT}" = "yes"; then
98         the_libs="@LIBWWW_LDADD@ $the_libs"
99         the_rpath="@LIBWWW_RPATH@ $the_rpath"
100         the_wl_rpath="@LIBWWW_WL_RPATH@ $the_wl_rpath"
101         fi
102       if test "${needCpp}" = "yes"; then
103         the_libs="${BUILDDIR}/src/cpp/libxmlrpc_client++.a $the_libs"
104         fi
105       ;;
106     --version)
107       echo "@VERSION@"
108       ;;
109     --modules)
110       echo "@FEATURE_LIST@"
111       ;;
112     --features)
113       echo "@FEATURE_LIST@"
114       ;;
115     --cflags)
116       echo "$the_includes"
117       ;;
118     --libs)
119       echo "$the_libdirs $the_libs $the_wl_rpath"
120       ;;
121     --ldadd)
122       echo "$the_libdirs $the_libs"
123       ;;
124     --ldflags)
125       echo "$the_rpath"
126       ;;
127     --sopath)
128       echo "$sopath"
129       ;;
130     --prefix)
131       echo "@prefix@"
132       ;;
133     --exec-prefix)
134       echo "@exec_prefix@"
135       ;;
136     --*dir)
137       # Swiped from gnome-config.
138       dirname=\$`echo $1 | sed -e 's,^--,,'`
139       dirname=`eval echo $dirname`
140       test -z "$dirname" && exit 1
141       echo $dirname
142       ;;
143     --help)
144       echo "See the real xmlrpc-c-config program" 1>&2
145       ;;
146     *)
147       echo "Unrecognized token '$1'"
148       echo "${usage}" 1>&2
149       exit 1
150       ;;
151   esac
152   shift
153 done
154
155 exit 0