1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(include/xmlrpc-c/base.h)
4
5dnl =======================================================================
6dnl Define PACKAGE, VERSION, @PACKAGE@, @VERSION@
7dnl =======================================================================
8
9dnl "x.xx" is supposed to be a version number, but is meaningless here.
10dnl The real version number is in Makefile.version.
11AM_INIT_AUTOMAKE(xmlrpc-c, x.xx)
12
13dnl Define @build@, @build_cpu@, @build_vendor@, @build_os,
14dnl @host, @host_cpu@, @host_vender, and @host_os@ substitutions.
15dnl "host" means the target system -- the one for which we are building.
16dnl "build" means the system that will do the building.
17AC_CANONICAL_HOST
18
19dnl =======================================================================
20dnl Decide What To Build
21dnl =======================================================================
22
23FEATURE_LIST=
24
25AC_ARG_ENABLE(wininet-client,
26  [  --disable-wininet-client  Don't build the Wininet client transport], ,
27enable_wininet_client=maybe)
28
29if test $enable_wininet_client = maybe; then
30  AC_CHECK_PROG(have_wininet_config, wininet-config, yes, no)
31  if test $have_wininet_config = no; then
32    AC_MSG_NOTICE([You don't appear to have Wininet installed (no working wininet-config in your command search path), so we will not build the Wininet client XML transport])
33    MUST_BUILD_WININET_CLIENT=no
34  else
35    MUST_BUILD_WININET_CLIENT=yes
36  fi
37else
38  MUST_BUILD_WININET_CLIENT=$enable_wininet_client
39fi
40
41AC_MSG_CHECKING(whether to build Wininet client XML transport module)
42AC_MSG_RESULT($MUST_BUILD_WININET_CLIENT)
43AC_SUBST(MUST_BUILD_WININET_CLIENT)
44
45
46AC_ARG_ENABLE(curl-client,
47  [  --disable-curl-client     Don't build the Curl client transport], ,
48enable_curl_client=maybe)
49
50if test $enable_curl_client = maybe; then
51  AC_CHECK_PROG(have_curl_config, curl-config, yes, no)
52  if test $have_curl_config = no; then
53    AC_MSG_NOTICE([You don't appear to have Curl installed (no working curl-config in your command search path), so we will not build the Curl client XML transport])
54    MUST_BUILD_CURL_CLIENT=no
55  else
56    MUST_BUILD_CURL_CLIENT=yes
57  fi
58else
59  MUST_BUILD_CURL_CLIENT=$enable_curl_client
60fi
61
62AC_MSG_CHECKING(whether to build Curl client XML transport module)
63AC_MSG_RESULT($MUST_BUILD_CURL_CLIENT)
64AC_SUBST(MUST_BUILD_CURL_CLIENT)
65
66
67AC_ARG_ENABLE(libwww-client,
68  [  --disable-libwww-client   Don't build the Libwww client transport], ,
69enable_libwww_client=maybe)
70
71if test $enable_libwww_client = maybe; then
72  AC_CHECK_PROG(have_libwww_config, libwww-config, yes, no)
73  if test $have_libwww_config = no; then
74    AC_MSG_NOTICE([You don't appear to have Libwww installed (no working libwww-config in your command search path), so we will not build the Libwww client XML transport])
75    MUST_BUILD_LIBWWW_CLIENT=no
76  else
77    MUST_BUILD_LIBWWW_CLIENT=yes
78  fi
79else
80  MUST_BUILD_LIBWWW_CLIENT=$enable_libwww_client
81fi
82
83AC_MSG_CHECKING(whether to build Libwww client XML transport module)
84AC_MSG_RESULT($MUST_BUILD_LIBWWW_CLIENT)
85AC_SUBST(MUST_BUILD_LIBWWW_CLIENT)
86
87
88# The first AC_CHECK_LIB has to be in unconditional code because as a
89# side effect, it determines what the object file suffix is on this system,
90# and if it is statically present even though not actually executed, Autoconf
91# later thinks it has already computed the object file suffix and uses it
92# without computing it.  This was with Autoconf 2.59
93AC_CHECK_LIB(ncurses, main, [have_libncurses=yes], [have_libncurses=no])
94AC_CHECK_LIB(readline, main, [have_libreadline=yes], [have_libreadline=no])
95
96AC_MSG_CHECKING(whether to build tools)
97
98BUILD_XMLRPC_PSTREAM=no
99
100if ! test "$MUST_BUILD_WININET_CLIENT $MUST_BUILD_CURL_CLIENT $MUST_BUILD_LIBWWW_CLIENT" = "no no no"; then
101  if test $have_libreadline = yes && test $have_libncurses = yes; then
102    BUILD_XMLRPC_PSTREAM=yes
103  fi
104  BUILD_TOOLS=yes
105else
106  BUILD_TOOLS=no
107fi
108
109AC_MSG_RESULT($BUILD_TOOLS)
110AC_SUBST(BUILD_TOOLS)
111
112if test $BUILD_TOOLS = yes; then
113  AC_MSG_CHECKING(whether to build the xmlrpc_pstream tool)
114  AC_MSG_RESULT($BUILD_XMLRPC_PSTREAM)
115  AC_SUBST(BUILD_XMLRPC_PSTREAM)
116fi
117
118
119dnl Set up the appropriate Makefile substitutions.
120
121CLIENTTEST=clienttest
122AC_SUBST(CLIENTTEST)
123XMLRPC_CLIENT_H=xmlrpc_client.h
124AC_SUBST(XMLRPC_CLIENT_H)
125XMLRPC_TRANSPORT_H=xmlrpc_transport.h
126AC_SUBST(XMLRPC_TRANSPORT_H)
127SYNCH_CLIENT=synch_client
128AC_SUBST(SYNCH_CLIENT)
129ASYNCH_CLIENT=asynch_client
130AC_SUBST(ASYNCH_CLIENT)
131AUTH_CLIENT=auth_client
132AC_SUBST(AUTH_CLIENT)
133QUERY_MEERKAT=query-meerkat
134AC_SUBST(QUERY_MEERKAT)
135
136if test $MUST_BUILD_WININET_CLIENT = yes; then
137    FEATURE_LIST="wininet-client $FEATURE_LIST"
138fi
139if test $MUST_BUILD_CURL_CLIENT = yes; then
140    FEATURE_LIST="curl-client $FEATURE_LIST"
141fi
142if test $MUST_BUILD_LIBWWW_CLIENT = yes; then
143    FEATURE_LIST="libwww-client $FEATURE_LIST"
144fi
145
146dnl Check to see if we should build our Abyss server module.
147AC_MSG_CHECKING(whether to build Abyss server module)
148AC_ARG_ENABLE(abyss-server,
149  [  --disable-abyss-server    Don't build the Abyss server module], ,
150enable_abyss_server=yes)
151AC_MSG_RESULT($enable_abyss_server)
152ENABLE_ABYSS_SERVER=$enable_abyss_server
153AC_SUBST(ENABLE_ABYSS_SERVER)
154
155dnl Set up the appropriate Makefile substitutions.
156ABYSS_SUBDIR=
157SERVERTEST=
158VALIDATEE=
159XMLRPC_ABYSS_H=
160SERVER=
161if test x"$enable_abyss_server" != xno; then
162    FEATURE_LIST="abyss-server $FEATURE_LIST"
163    ABYSS_SUBDIR=abyss
164    SERVERTEST=servertest
165    VALIDATEE=validatee
166    XMLRPC_ABYSS_H=xmlrpc_abyss.h
167    SERVER=server
168fi
169AC_SUBST(ABYSS_SUBDIR)
170AC_SUBST(SERVERTEST)
171AC_SUBST(VALIDATEE)
172AC_SUBST(XMLRPC_ABYSS_H)
173AC_SUBST(SERVER)
174
175dnl Check to see if we should build our CGI server module.
176AC_MSG_CHECKING(whether to build CGI server module)
177AC_ARG_ENABLE(cgi-server,
178  [  --disable-cgi-server      Don't build the CGI server module], ,
179enable_cgi_server=yes)
180AC_MSG_RESULT($enable_cgi_server)
181ENABLE_CGI_SERVER=$enable_cgi_server
182AC_SUBST(ENABLE_CGI_SERVER)
183
184dnl Check to see if we should build our C++ stuff.
185AC_MSG_CHECKING(whether to build C++ wrappers and tools)
186AC_ARG_ENABLE(cplusplus,
187  [  --disable-cplusplus       Don't build the C++ wrapper classes or tools], ,
188enable_cplusplus=yes)
189AC_MSG_RESULT($enable_cplusplus)
190ENABLE_CPLUSPLUS=$enable_cplusplus
191AC_SUBST(ENABLE_CPLUSPLUS)
192
193dnl Set up the appropriate Makefile substitutions.
194LIBXMLRPC_CPP_A=
195CPPTEST=
196XMLRPCCPP_H=
197XML_RPC_API2CPP_SUBDIR=
198MEERKAT_APP_LIST=
199INTEROP_CLIENT_SUBDIR=
200if test x"$enable_cplusplus" != xno; then
201    FEATURE_LIST="c++ $FEATURE_LIST"
202    LIBXMLRPC_CPP_A=libxmlrpc_cpp.a
203    CPPTEST=cpptest
204    XMLRPCCPP_H=XmlRpcCpp.h
205
206    if test $MUST_BUILD_LIBWWW_CLIENT = yes; then
207        XML_RPC_API2CPP_SUBDIR=xml-rpc-api2cpp
208    elif test $MUST_BUILD_CURL_CLIENT = yes; then
209        XML_RPC_API2CPP_SUBDIR=xml-rpc-api2cpp
210    fi
211fi
212AC_SUBST(LIBXMLRPC_CPP_A)
213AC_SUBST(CPPTEST)
214AC_SUBST(XMLRPCCPP_H)
215AC_SUBST(XML_RPC_API2CPP_SUBDIR)
216
217
218AC_SUBST(FEATURE_LIST)
219
220
221dnl =======================================================================
222dnl Checks for programs.
223dnl =======================================================================
224
225AC_PROG_CC
226if test x"$enable_cplusplus" != xno; then
227    AC_PROG_CXX
228fi
229
230
231dnl =======================================================================
232dnl Checks for libraries.
233dnl =======================================================================
234
235# Code by albert chin <china@thewrittenword.com> to check for various
236# oddball networking libraries.  Solaris and some other operating systems
237# hide their networking code in various places.  (Yes, this links too many
238# of our libraries against -lsocket, but a finer-grained mechanism would
239# require too much testing.)
240AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
241
242# Above sets LIBS, which is not all that useful because we don't want
243# to include every library in every link.  It also sets
244# ac_cv_lib_socket_socket, which we use to pass more specific information
245# to the configuration files.
246
247if test x"$ac_cv_lib_socket_socket" = xyes; then
248  LSOCKET=-lsocket
249else
250  LSOCKET=
251fi
252AC_SUBST(LSOCKET)
253
254# For some reason, we don't seem to need this on Solaris.  If you do
255# need it, go ahead and try it.
256# AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
257
258
259dnl =======================================================================
260dnl Checks for header files.
261dnl =======================================================================
262
263AC_STDC_HEADERS
264
265dnl We don't use AM_CONFIG_HEADER to define HAVE_WCHAR_H, etc. because
266dnl the following is more straightforward and easier to understand,
267dnl especially for a newcomer.  Furthermore, AM_CONFIG_HEADER represents
268dnl false as undefined, whereas our scheme represents it as 0.  undefined
269dnl is a poor choice because it often means just that you neglected to
270dnl choose a value for some reason.
271
272dnl defines ac_cv_header_wchar_h, etc:
273AC_CHECK_HEADERS(wchar.h)
274
275if test x"$ac_cv_header_wchar_h" = xyes; then
276  HAVE_WCHAR_H_DEFINE=1
277else
278  HAVE_WCHAR_H_DEFINE=0
279fi
280AC_SUBST(HAVE_WCHAR_H_DEFINE)
281
282# Needed by Abyss on Solaris:
283
284AC_CHECK_HEADERS(sys/filio.h)
285if test x"$ac_cv_header_sys_filio_h" = xyes; then
286  HAVE_SYS_FILIO_H_DEFINE=1
287else
288  HAVE_SYS_FILIO_H_DEFINE=0
289fi
290AC_SUBST(HAVE_SYS_FILIO_H_DEFINE)
291
292# Needed by Abyss on Solaris:
293
294AC_CHECK_HEADERS(sys/ioctl.h)
295if test x"$ac_cv_header_sys_ioctl_h" = xyes; then
296  HAVE_SYS_IOCTL_H_DEFINE=1
297else
298  HAVE_SYS_IOCTL_H_DEFINE=0
299fi
300AC_SUBST(HAVE_SYS_IOCTL_H_DEFINE)
301
302AC_CHECK_HEADERS(sys/select.h)
303if test x"$ac_cv_header_sys_select_h" = xyes; then
304  HAVE_SYS_SELECT_H_DEFINE=1
305else
306  HAVE_SYS_SELECT_H_DEFINE=0
307fi
308AC_SUBST(HAVE_SYS_SELECT_H_DEFINE)
309
310
311AC_CHECK_HEADERS(stdarg.h, , [
312AC_MSG_ERROR(stdarg.h is required to build this library)
313])
314
315
316dnl =======================================================================
317dnl Checks for typedefs, structures, and compiler characteristics.
318dnl =======================================================================
319
320dnl AC_C_BIGENDIAN
321AC_TYPE_SIZE_T
322
323dnl This check is borrowed from Python 1.5.2.
324va_list_is_array=no
325AC_MSG_CHECKING(whether va_list is an array)
326AC_TRY_COMPILE([
327#include <stdarg.h>
328], [va_list list1, list2; list1 = list2;], ,
329va_list_is_array=yes)
330AC_MSG_RESULT($va_list_is_array)
331if test x"$va_list_is_array" = xyes; then
332  VA_LIST_IS_ARRAY_DEFINE=1
333else
334  VA_LIST_IS_ARRAY_DEFINE=0
335fi
336AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
337
338AC_MSG_CHECKING(whether compiler has __attribute__)
339AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
340compiler_has_attribute=yes,
341compiler_has_attribute=no)
342AC_MSG_RESULT($compiler_has_attribute)
343if test x"$compiler_has_attribute" = xyes; then
344    ATTR_UNUSED="__attribute__((__unused__))"
345else
346    ATTR_UNUSED=
347fi
348AC_SUBST(ATTR_UNUSED)
349
350
351dnl =======================================================================
352dnl Checks for library functions.
353dnl =======================================================================
354
355AC_CHECK_FUNC(vsnprintf, , [
356AC_MSG_ERROR(your C library does not provide vsnprintf)
357])
358
359dnl Unicode function needed by test suites.
360AC_CHECK_FUNCS(wcsncmp)
361if test "x$ac_cv_func_wcsncmp" = x""yes; then
362  HAVE_WCSNCMP_DEFINE=1
363else
364  HAVE_WCSNCMP_DEFINE=0
365fi
366AC_SUBST(HAVE_WCSNCMP_DEFINE)
367
368dnl CygWin doesn't provide setgroups.
369AC_CHECK_FUNCS(setgroups)
370if test "x$ac_cv_func_setgroups" = x""yes; then
371  HAVE_SETGROUPS_DEFINE=1
372else
373  HAVE_SETGROUPS_DEFINE=0
374fi
375AC_SUBST(HAVE_SETGROUPS_DEFINE)
376
377AC_CHECK_FUNCS(asprintf)
378if test "x$ac_cv_func_asprintf" = x""yes; then
379  HAVE_ASPRINTF_DEFINE=1
380else
381  HAVE_ASPRINTF_DEFINE=0
382fi
383AC_SUBST(HAVE_ASPRINTF_DEFINE)
384
385AC_CHECK_FUNCS(setenv)
386if test "x$ac_cv_func_setenv" = x""yes; then
387  HAVE_SETENV_DEFINE=1
388else
389  HAVE_SETENV_DEFINE=0
390fi
391AC_SUBST(HAVE_SETENV_DEFINE)
392
393AC_CHECK_FUNCS(strtoll)
394if test "x$ac_cv_func_strtoll" = x""yes; then
395  HAVE_STRTOLL_DEFINE=1
396else
397  HAVE_STRTOLL_DEFINE=0
398fi
399AC_SUBST(HAVE_STRTOLL_DEFINE)
400
401AC_CHECK_FUNCS(strtoull)
402if test "x$ac_cv_func_strtoull" = x""yes; then
403  HAVE_STRTOULL_DEFINE=1
404else
405  HAVE_STRTOULL_DEFINE=0
406fi
407AC_SUBST(HAVE_STRTOULL_DEFINE)
408
409AC_CHECK_FUNCS(strtoq)
410if test "x$ac_cv_func_strtoq" = x""yes; then
411  HAVE_STRTOQ_DEFINE=1
412else
413  HAVE_STRTOQ_DEFINE=0
414fi
415AC_SUBST(HAVE_STRTOQ_DEFINE)
416
417AC_CHECK_FUNCS(strtouq)
418if test "x$ac_cv_func_strtouq" = x""yes; then
419  HAVE_STRTOUQ_DEFINE=1
420else
421  HAVE_STRTOUQ_DEFINE=0
422fi
423AC_SUBST(HAVE_STRTOUQ_DEFINE)
424
425AC_CHECK_FUNCS(__strtoll)
426if test "x$ac_cv_func___strtoll" = x""yes; then
427  HAVE___STRTOLL_DEFINE=1
428else
429  HAVE___STRTOLL_DEFINE=0
430fi
431AC_SUBST(HAVE___STRTOLL_DEFINE)
432
433AC_CHECK_FUNCS(__strtoull)
434if test "x$ac_cv_func___strtoull" = x""yes; then
435  HAVE___STRTOULL_DEFINE=1
436else
437  HAVE___STRTOULL_DEFINE=0
438fi
439AC_SUBST(HAVE___STRTOULL_DEFINE)
440
441AC_CHECK_FUNCS(_strtoui64)
442if test "x$ac_cv_func__strtoui64" = x""yes; then
443  HAVE__STRTOUI64_DEFINE=1
444else
445  HAVE__STRTOUI64_DEFINE=0
446fi
447AC_SUBST(HAVE__STRTOUI64_DEFINE)
448
449dnl uclib doesn't have pselect
450AC_CHECK_FUNCS(pselect)
451if test "x$ac_cv_func_pselect" = x""yes; then
452  HAVE_PSELECT_DEFINE=1
453else
454  HAVE_PSELECT_DEFINE=0
455fi
456AC_SUBST(HAVE_PSELECT_DEFINE)
457
458dnl Windows doesn't have gettimeofday, localtime_r, or gmtime_r
459AC_CHECK_FUNCS(gettimeofday)
460if test "x$ac_cv_func_gettimeofday" = x""yes; then
461  HAVE_GETTIMEOFDAY_DEFINE=1
462else
463  HAVE_GETTIMEOFDAY_DEFINE=0
464fi
465AC_SUBST(HAVE_GETTIMEOFDAY_DEFINE)
466
467AC_CHECK_FUNCS(localtime_r)
468if test "x$ac_cv_func_localtime_r" = x""yes; then
469  HAVE_LOCALTIME_R_DEFINE=1
470else
471  HAVE_LOCALTIME_R_DEFINE=0
472fi
473AC_SUBST(HAVE_LOCALTIME_R_DEFINE)
474
475AC_CHECK_FUNCS(gmtime_r)
476if test "x$ac_cv_func_gmtime_r" = x""yes; then
477  HAVE_GMTIME_R_DEFINE=1
478else
479  HAVE_GMTIME_R_DEFINE=0
480fi
481AC_SUBST(HAVE_GMTIME_R_DEFINE)
482
483dnl Windows doesn't have strcasecmp;
484AC_CHECK_FUNCS(strcasecmp)
485if test "x$ac_cv_func_strcasecmp" = x""yes; then
486  HAVE_STRCASECMP_DEFINE=1
487else
488  HAVE_STRCASECMP_DEFINE=0
489fi
490AC_SUBST(HAVE_STRCASECMP_DEFINE)
491
492AC_CHECK_FUNCS(stricmp)
493if test "x$ac_cv_func_stricmp" = x""yes; then
494  HAVE_STRICMP_DEFINE=1
495else
496  HAVE_STRICMP_DEFINE=0
497fi
498AC_SUBST(HAVE_STRICMP_DEFINE)
499
500AC_CHECK_FUNCS(_stricmp)
501if test "x$ac_cv_func__stricmp" = x""yes; then
502  HAVE__STRICMP_DEFINE=1
503else
504  HAVE__STRICMP_DEFINE=0
505fi
506AC_SUBST(HAVE__STRICMP_DEFINE)
507
508dnl =======================================================================
509dnl Checks for operating system features.
510dnl =======================================================================
511
512dnl Non-Unix systems will need to set up their platform configuration file
513dnl by hand.
514case "$host_os" in
515     *mingw*)
516        DIRECTORY_SEPARATOR="\\\\"
517        ;;
518     *)
519        DIRECTORY_SEPARATOR="/"
520        ;;
521esac
522AC_SUBST(DIRECTORY_SEPARATOR)
523
524
525dnl =======================================================================
526dnl ABYSS Configuration
527dnl =======================================================================
528
529AC_MSG_CHECKING(whether to use Abyss pthread function)
530AC_ARG_ENABLE(abyss-threads,
531  [  --disable-abyss-threads   Use fork in Abyss instead of pthreads], ,
532  enable_abyss_threads=yes)
533AC_MSG_RESULT($enable_abyss_threads)
534
535ENABLE_ABYSS_THREADS=$enable_abyss_threads
536AC_SUBST(ENABLE_ABYSS_THREADS)
537
538if test x"$enable_abyss_threads" != xno; then
539    CFLAGS="$CFLAGS -D_THREAD"
540fi
541
542
543dnl =======================================================================
544dnl Finding wininet stubs
545dnl =======================================================================
546dnl If you implement the parts of wininet.h the wininet_transport uses,
547dnl you will need to configure this way..
548
549if test $MUST_BUILD_WININET_CLIENT = yes; then
550
551    dnl You can control which of these gets chosen by controlling PATH.
552    AC_PATH_PROGS(WININET_CONFIG, wininet-xmlrpc-config wininet-config, no)
553    if test "x$WININET_CONFIG" = "xno"; then
554        AC_MSG_ERROR(Configure INTERNAL ERROR - first wininet-config found, then not found)
555    fi
556
557    dnl Get our wininet version.
558    dnl Adapted from a macro which called gtk-config.
559    AC_MSG_CHECKING(for wininet version >= 1.0.0)
560    W3VER=$($WININET_CONFIG --version)
561    WININET_MAJOR=\
562$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/')
563    WININET_MINOR=\
564$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/')
565    WININET_MICRO=\
566$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/')
567    AC_MSG_RESULT($WININET_MAJOR.$WININET_MINOR.$WININET_MICRO)
568
569    dnl Check to make sure our version is OK.
570    WININET_VERSION_OK=yes
571    if test $WININET_MAJOR -lt 1; then
572        WININET_VERSION_OK=no
573    else
574        if test $WININET_MAJOR -eq 1 -a $WININET_MINOR -lt 0; then
575            WININET_VERSION_OK=no
576        else
577            if test $WININET_MAJOR -eq 1 -a $WININET_MINOR -eq 0 \
578                -a $WININET_MICRO -lt 0; then
579                WININET_VERSION_OK=no
580            fi
581        fi
582    fi
583    if test "x$WININET_VERSION_OK" = "xno"; then
584        AC_MSG_ERROR(wininet version >= 1.0.0 required)
585    fi
586
587    dnl Get the necessary CFLAGS, and merge them into our master list.
588    WININET_CFLAGS=$($WININET_CONFIG --cflags)
589    AC_SUBST(WININET_CFLAGS)
590    CFLAGS="$CFLAGS $WININET_CFLAGS"
591
592    dnl Get the huge list of libraries we need to link against.
593    WININET_LDADD=$($WININET_CONFIG --libs)
594    AC_SUBST(WININET_LDADD)
595
596    AC_MSG_CHECKING(for wininet library directory)
597    WININET_LIBDIR="$($WININET_CONFIG --prefix)/lib"
598    AC_MSG_RESULT($WININET_LIBDIR)
599    AC_SUBST(WININET_LIBDIR)
600
601fi # MUST_BUILD_WININET_CLIENT
602
603dnl =======================================================================
604dnl Finding w3c-libwww
605dnl =======================================================================
606
607if test $MUST_BUILD_LIBWWW_CLIENT = yes; then
608
609    dnl First of all, locate the libwww config program.
610    dnl You can control which of these gets chosen by controlling PATH.
611    AC_PATH_PROGS(LIBWWW_CONFIG, libwww-xmlrpc-config libwww-config, no)
612    if test "x$LIBWWW_CONFIG" = "xno"; then
613        AC_MSG_ERROR(Configure INTERNAL ERROR - first libwww-config found, then not found)
614    fi
615
616    dnl Get our libwww version.
617    dnl Adapted from a macro which called gtk-config.
618    AC_MSG_CHECKING(for w3c-libwww version >= 5.2.8)
619    W3VER=$($LIBWWW_CONFIG --version)
620    LIBWWW_MAJOR=\
621$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/')
622    LIBWWW_MINOR=\
623$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/')
624    LIBWWW_MICRO=\
625$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/')
626    AC_MSG_RESULT($LIBWWW_MAJOR.$LIBWWW_MINOR.$LIBWWW_MICRO)
627
628    dnl Check to make sure our version is OK.
629    LIBWWW_VERSION_OK=yes
630    if test $LIBWWW_MAJOR -lt 5; then
631        LIBWWW_VERSION_OK=no
632    else
633        if test $LIBWWW_MAJOR -eq 5 -a $LIBWWW_MINOR -lt 2; then
634            LIBWWW_VERSION_OK=no
635        else
636            if test $LIBWWW_MAJOR -eq 5 -a $LIBWWW_MINOR -eq 2 \
637                -a $LIBWWW_MICRO -lt 8; then
638                LIBWWW_VERSION_OK=no
639            fi
640        fi
641    fi
642    if test "x$LIBWWW_VERSION_OK" = "xno"; then
643        AC_MSG_ERROR(w3c-libwww version >= 5.2.8 required)
644    fi
645
646    dnl Get the huge list of libraries we need to link against.
647    LIBWWW_LDADD=$($LIBWWW_CONFIG --libs)
648    AC_SUBST(LIBWWW_LDADD)
649
650    AC_MSG_CHECKING(for libwww library directory)
651    LIBWWW_LIBDIR="$($LIBWWW_CONFIG --prefix)/lib"
652    AC_MSG_RESULT($LIBWWW_LIBDIR)
653    AC_SUBST(LIBWWW_LIBDIR)
654
655fi # MUST_BUILD_LIBWWW_CLIENT
656
657
658dnl =======================================================================
659dnl Finding Curl
660dnl =======================================================================
661
662if test $MUST_BUILD_CURL_CLIENT = yes; then
663
664    dnl First of all, locate the Curl config program.
665    dnl You can control which of these gets chosen by controlling PATH.
666    AC_PATH_PROGS(CURL_CONFIG, curl-xmlrpc-config curl-config, no)
667    if test "x$CURL_CONFIG" = "xno"; then
668        AC_MSG_ERROR(Configure INTERNAL ERROR - first curl-config found, then not found)
669    fi
670
671    dnl There used to be code here to check the Curl version and make sure
672    dnl it is at least 7.8.  But there were bugs both in the code and in
673    dnl curl (curl-config --vernum, at least in older versions of Curl,
674    dnl omits the leading zero).  So it didn't work.  Plus, checking version
675    dnl numbers isn't a good idea.  Better to check for feature presence.
676    dnl So we don't do any check now.  If we find out there's a problem with
677    dnl older Curls, we will revisit that.
678
679    CURL_LDADD=$($CURL_CONFIG --libs)
680    AC_SUBST(CURL_LDADD)
681
682    AC_MSG_CHECKING(for Curl library directory)
683    CURL_LIBDIR="$($CURL_CONFIG --prefix)/lib"
684
685    AC_MSG_RESULT($CURL_LIBDIR)
686    AC_SUBST(CURL_LIBDIR)
687
688fi # MUST_BUILD_CURL_CLIENT
689
690
691dnl =======================================================================
692dnl Finding OpenSSL
693dnl =======================================================================
694
695AC_MSG_CHECKING(for OpenSSL library)
696
697if pkg-config openssl; then
698  HAVE_OPENSSL=yes
699  OPENSSL_LDADD=$(pkg-config openssl --libs)
700  AC_SUBST(OPENSSL_LDADD)
701  OPENSSL_CFLAGS=$(pkg-config openssl --cflags)
702  AC_SUBST(OPENSSL_CFLAGS)
703else
704  HAVE_OPENSSL=no
705fi
706
707AC_MSG_RESULT($HAVE_OPENSSL)
708
709# One really annoying case where the user needs to disable building of
710# Openssl-based parts explicitly is where there is no Openssl for the target
711# platform but there is for the native platform.  In that case, Pkg-config
712# finds the openssl.pc in /usr/lib, ignoring the fact that /usr/lib is not in
713# the search path specified by the PKG_CONFIG environment variable.  This is
714# a major design flaw in Pkg-config.
715
716AC_ARG_ENABLE(abyss-openssl,
717  [  --disable-abyss-openssl     Don't build Abyss Openssl channel function],
718  ,
719  enable_abyss_openssl=maybe)
720
721if test $enable_abyss_openssl = maybe; then
722  if test $HAVE_OPENSSL = no; then
723    AC_MSG_NOTICE([You don't appear to Openssl installed (no pkg-config file for it in your pkg-config search path), so we will not build the Abyss Openssl channel module])
724    MUST_BUILD_ABYSS_OPENSSL=no
725  else
726    MUST_BUILD_ABYSS_OPENSSL=yes
727  fi
728else
729  MUST_BUILD_ABYSS_OPENSSL=$enable_abyss_openssl
730fi
731
732AC_MSG_CHECKING(whether to build Abyss Openssl channel module)
733AC_MSG_RESULT($MUST_BUILD_ABYSS_OPENSSL)
734AC_SUBST(MUST_BUILD_ABYSS_OPENSSL)
735
736if test $MUST_BUILD_ABYSS_OPENSSL = yes; then
737  HAVE_ABYSS_OPENSSL_DEFINE=1
738else
739  HAVE_ABYSS_OPENSSL_DEFINE=0
740fi
741
742AC_SUBST(HAVE_ABYSS_OPENSSL_DEFINE)
743
744
745dnl =======================================================================
746dnl Checks for build options.
747dnl =======================================================================
748
749AC_ARG_WITH(libwww-ssl,
750  [  --with-libwww-ssl       Include libwww SSL capability.]
751   )
752
753if test x"$enable_libwww_client" != xno; then
754    AC_MSG_CHECKING(whether to use SSL with libwww)
755    if test x"$with_libwww_ssl" = xyes; then
756        AC_MSG_RESULT(yes)
757        HAVE_LIBWWW_SSL_DEFINE=1
758    else
759        AC_MSG_RESULT(no)
760        HAVE_LIBWWW_SSL_DEFINE=0
761    fi
762else
763    HAVE_LIBWWW_SSL_DEFINE=0
764fi
765AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
766
767dnl Check to see if we should build the libxml2 backend.
768AC_ARG_ENABLE(libxml2-backend,
769  [  --enable-libxml2-backend  Use libxml2 instead of built-in expat], ,
770enable_libxml2_backend=no)
771AC_MSG_CHECKING(whether to build the libxml2 backend)
772AC_MSG_RESULT($enable_libxml2_backend)
773
774if test $enable_libxml2_backend = yes; then
775  AC_CHECK_PROG(have_xml2_config, xml2-config, yes, no)
776  if test $have_xml2_config = no; then
777    AC_MSG_ERROR([You specified --enable-libxml2_backend, but don't appear to have libxml2 installed (no working xml2-config in your command search path), so we cannot not build for libxml2])
778  fi
779fi
780ENABLE_LIBXML2_BACKEND=$enable_libxml2_backend
781AC_SUBST(ENABLE_LIBXML2_BACKEND)
782
783dnl =======================================================================
784dnl Compiler information
785dnl =======================================================================
786C_COMPILER_GNU=$ac_cv_c_compiler_gnu
787AC_SUBST(C_COMPILER_GNU)
788CXX_COMPILER_GNU=$ac_cv_cxx_compiler_gnu
789AC_SUBST(CXX_COMPILER_GNU)
790
791dnl obsolete variables, need to be removed from Makefile.in:
792CC_WARN_FLAGS=
793AC_SUBST(CC_WARN_FLAGS)
794CPP_WARN_FLAGS=
795AC_SUBST(CPP_WARN_FLAGS)
796
797
798BUILDDIR=$(pwd)
799AC_SUBST(BUILDDIR)
800
801AC_CHECK_TOOL([AR], [ar])
802AC_PROG_RANLIB
803
804dnl =======================================================================
805dnl Output our results.
806dnl =======================================================================
807
808dnl Note that AM_CONFIG_HEADER at the top of this file outputs another
809dnl result: xmlrpc_amconfig.h .
810
811AC_OUTPUT( \
812          srcdir.mk \
813          config.mk \
814          xmlrpc_config.h \
815          )
816
817
818if test ! -f GNUmakefile; then
819  ln -s "${srcdir}/GNUmakefile" .
820fi
821if test ! -f Makefile; then
822  ln -s "${srcdir}/Makefile" .
823fi
824if test ! -f transport_config.mk; then
825  ln -s "${srcdir}/transport_config.mk" .
826fi
827
828
829if test "$MUST_BUILD_WININET_CLIENT $MUST_BUILD_CURL_CLIENT $MUST_BUILD_LIBWWW_CLIENT" = "no no no"; then
830  AC_MSG_NOTICE([==>])
831  AC_MSG_NOTICE([==>We are not building any client XML transport (see earlier messages explaining why), therefore WE WILL NOT BUILD THE CLIENT LIBRARY.])
832  AC_MSG_NOTICE([==>])
833fi
834
835
836