File: configure.in

package info (click to toggle)
xmlrpc-c 1.60.05-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 8,132 kB
  • sloc: ansic: 55,332; cpp: 13,541; sh: 3,321; makefile: 2,556; perl: 593; xml: 134
file content (848 lines) | stat: -rw-r--r-- 25,239 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
dnl Process this file with autoconf to produce a configure script.

AC_INIT(include/xmlrpc-c/base.h)

dnl =======================================================================
dnl Define PACKAGE, VERSION, @PACKAGE@, @VERSION@
dnl =======================================================================

dnl "x.xx" is supposed to be a version number, but is meaningless here.
dnl The real version number is in Makefile.version.
AM_INIT_AUTOMAKE(xmlrpc-c, x.xx)

dnl Define @build@, @build_cpu@, @build_vendor@, @build_os,
dnl @host, @host_cpu@, @host_vender, and @host_os@ substitutions.
dnl "host" means the target system -- the one for which we are building.
dnl "build" means the system that will do the building.
AC_CANONICAL_HOST

dnl =======================================================================
dnl Decide What To Build
dnl =======================================================================

FEATURE_LIST=

AC_ARG_ENABLE(wininet-client,
  [  --disable-wininet-client  Don't build the Wininet client transport], , 
enable_wininet_client=maybe)

if test $enable_wininet_client = maybe; then
  AC_CHECK_PROG(have_wininet_config, wininet-config, yes, no)
  if test $have_wininet_config = no; then
    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])
    MUST_BUILD_WININET_CLIENT=no
  else
    MUST_BUILD_WININET_CLIENT=yes
  fi
else
  MUST_BUILD_WININET_CLIENT=$enable_wininet_client
fi

AC_MSG_CHECKING(whether to build Wininet client XML transport module)
AC_MSG_RESULT($MUST_BUILD_WININET_CLIENT)
AC_SUBST(MUST_BUILD_WININET_CLIENT)


AC_ARG_ENABLE(curl-client,
  [  --disable-curl-client     Don't build the Curl client transport], , 
enable_curl_client=maybe)

if test $enable_curl_client = maybe; then
  AC_CHECK_PROG(have_curl_config, curl-config, yes, no)
  if test $have_curl_config = no; then
    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])
    MUST_BUILD_CURL_CLIENT=no
  else
    MUST_BUILD_CURL_CLIENT=yes
  fi
else
  MUST_BUILD_CURL_CLIENT=$enable_curl_client
fi

AC_MSG_CHECKING(whether to build Curl client XML transport module)
AC_MSG_RESULT($MUST_BUILD_CURL_CLIENT)
AC_SUBST(MUST_BUILD_CURL_CLIENT)


AC_ARG_ENABLE(libwww-client,
  [  --disable-libwww-client   Don't build the Libwww client transport], , 
enable_libwww_client=maybe)

if test $enable_libwww_client = maybe; then
  AC_CHECK_PROG(have_libwww_config, libwww-config, yes, no)
  if test $have_libwww_config = no; then
    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])
    MUST_BUILD_LIBWWW_CLIENT=no
  else
    MUST_BUILD_LIBWWW_CLIENT=yes
  fi
else
  MUST_BUILD_LIBWWW_CLIENT=$enable_libwww_client
fi

AC_MSG_CHECKING(whether to build Libwww client XML transport module)
AC_MSG_RESULT($MUST_BUILD_LIBWWW_CLIENT)
AC_SUBST(MUST_BUILD_LIBWWW_CLIENT)


# The first AC_CHECK_LIB has to be in unconditional code because as a
# side effect, it determines what the object file suffix is on this system,
# and if it is statically present even though not actually executed, Autoconf
# later thinks it has already computed the object file suffix and uses it
# without computing it.  This was with Autoconf 2.59
AC_CHECK_LIB(ncurses, main, [have_libncurses=yes], [have_libncurses=no])
AC_CHECK_LIB(readline, main, [have_libreadline=yes], [have_libreadline=no])

AC_MSG_CHECKING(whether to build tools)

BUILD_XMLRPC_PSTREAM=no

if ! test "$MUST_BUILD_WININET_CLIENT $MUST_BUILD_CURL_CLIENT $MUST_BUILD_LIBWWW_CLIENT" = "no no no"; then
  if test $have_libreadline = yes && test $have_libncurses = yes; then
    BUILD_XMLRPC_PSTREAM=yes
  fi
  BUILD_TOOLS=yes
else
  BUILD_TOOLS=no
fi

AC_MSG_RESULT($BUILD_TOOLS)
AC_SUBST(BUILD_TOOLS)

if test $BUILD_TOOLS = yes; then
  AC_MSG_CHECKING(whether to build the xmlrpc_pstream tool)
  AC_MSG_RESULT($BUILD_XMLRPC_PSTREAM)
  AC_SUBST(BUILD_XMLRPC_PSTREAM)
fi


dnl Set up the appropriate Makefile substitutions.

CLIENTTEST=clienttest
AC_SUBST(CLIENTTEST)
XMLRPC_CLIENT_H=xmlrpc_client.h
AC_SUBST(XMLRPC_CLIENT_H)
XMLRPC_TRANSPORT_H=xmlrpc_transport.h
AC_SUBST(XMLRPC_TRANSPORT_H)
SYNCH_CLIENT=synch_client
AC_SUBST(SYNCH_CLIENT)
ASYNCH_CLIENT=asynch_client
AC_SUBST(ASYNCH_CLIENT)
AUTH_CLIENT=auth_client
AC_SUBST(AUTH_CLIENT)
QUERY_MEERKAT=query-meerkat
AC_SUBST(QUERY_MEERKAT)

if test $MUST_BUILD_WININET_CLIENT = yes; then
    FEATURE_LIST="wininet-client $FEATURE_LIST"
fi
if test $MUST_BUILD_CURL_CLIENT = yes; then
    FEATURE_LIST="curl-client $FEATURE_LIST"
fi
if test $MUST_BUILD_LIBWWW_CLIENT = yes; then
    FEATURE_LIST="libwww-client $FEATURE_LIST"
fi

dnl Check to see if we should build our Abyss server module.
AC_MSG_CHECKING(whether to build Abyss server module)
AC_ARG_ENABLE(abyss-server,
  [  --disable-abyss-server    Don't build the Abyss server module], ,
enable_abyss_server=yes)
AC_MSG_RESULT($enable_abyss_server)
ENABLE_ABYSS_SERVER=$enable_abyss_server
AC_SUBST(ENABLE_ABYSS_SERVER)

dnl Set up the appropriate Makefile substitutions.
ABYSS_SUBDIR=
SERVERTEST=
VALIDATEE=
XMLRPC_ABYSS_H=
SERVER=
if test x"$enable_abyss_server" != xno; then
    FEATURE_LIST="abyss-server $FEATURE_LIST"
    ABYSS_SUBDIR=abyss
    SERVERTEST=servertest
    VALIDATEE=validatee
    XMLRPC_ABYSS_H=xmlrpc_abyss.h
    SERVER=server
fi
AC_SUBST(ABYSS_SUBDIR)
AC_SUBST(SERVERTEST)
AC_SUBST(VALIDATEE)
AC_SUBST(XMLRPC_ABYSS_H)
AC_SUBST(SERVER)

dnl Check to see if we should build our CGI server module.
AC_MSG_CHECKING(whether to build CGI server module)
AC_ARG_ENABLE(cgi-server,
  [  --disable-cgi-server      Don't build the CGI server module], ,
enable_cgi_server=yes)
AC_MSG_RESULT($enable_cgi_server)
ENABLE_CGI_SERVER=$enable_cgi_server
AC_SUBST(ENABLE_CGI_SERVER)

dnl Check to see if we should build our C++ stuff.
AC_MSG_CHECKING(whether to build C++ wrappers and tools)
AC_ARG_ENABLE(cplusplus,
  [  --disable-cplusplus       Don't build the C++ wrapper classes or tools], ,
enable_cplusplus=yes)
AC_MSG_RESULT($enable_cplusplus)
ENABLE_CPLUSPLUS=$enable_cplusplus
AC_SUBST(ENABLE_CPLUSPLUS)

dnl Set up the appropriate Makefile substitutions.
LIBXMLRPC_CPP_A=
CPPTEST=
XMLRPCCPP_H=
XML_RPC_API2CPP_SUBDIR=
MEERKAT_APP_LIST=
INTEROP_CLIENT_SUBDIR=
if test x"$enable_cplusplus" != xno; then
    FEATURE_LIST="c++ $FEATURE_LIST"
    LIBXMLRPC_CPP_A=libxmlrpc_cpp.a
    CPPTEST=cpptest
    XMLRPCCPP_H=XmlRpcCpp.h

    if test $MUST_BUILD_LIBWWW_CLIENT = yes; then
        XML_RPC_API2CPP_SUBDIR=xml-rpc-api2cpp
    elif test $MUST_BUILD_CURL_CLIENT = yes; then
        XML_RPC_API2CPP_SUBDIR=xml-rpc-api2cpp
    fi
fi
AC_SUBST(LIBXMLRPC_CPP_A)
AC_SUBST(CPPTEST)
AC_SUBST(XMLRPCCPP_H)
AC_SUBST(XML_RPC_API2CPP_SUBDIR)


AC_SUBST(FEATURE_LIST)


dnl =======================================================================
dnl Checks for programs.
dnl =======================================================================

AC_PROG_CC
if test x"$enable_cplusplus" != xno; then
    AC_PROG_CXX
fi


dnl =======================================================================
dnl Checks for libraries.
dnl =======================================================================

# Code by albert chin <china@thewrittenword.com> to check for various
# oddball networking libraries.  Solaris and some other operating systems
# hide their networking code in various places.  (Yes, this links too many
# of our libraries against -lsocket, but a finer-grained mechanism would
# require too much testing.)
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))

# Above sets LIBS, which is not all that useful because we don't want
# to include every library in every link.  It also sets
# ac_cv_lib_socket_socket, which we use to pass more specific information
# to the configuration files.

if test x"$ac_cv_lib_socket_socket" = xyes; then
  LSOCKET=-lsocket
else
  LSOCKET=
fi
AC_SUBST(LSOCKET)

# For some reason, we don't seem to need this on Solaris.  If you do
# need it, go ahead and try it.
# AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))


dnl =======================================================================
dnl Checks for header files.
dnl =======================================================================

AC_STDC_HEADERS

dnl We don't use AM_CONFIG_HEADER to define HAVE_WCHAR_H, etc. because
dnl the following is more straightforward and easier to understand,
dnl especially for a newcomer.  Furthermore, AM_CONFIG_HEADER represents
dnl false as undefined, whereas our scheme represents it as 0.  undefined
dnl is a poor choice because it often means just that you neglected to
dnl choose a value for some reason.

dnl defines ac_cv_header_wchar_h, etc:
AC_CHECK_HEADERS(wchar.h)

if test x"$ac_cv_header_wchar_h" = xyes; then
  HAVE_WCHAR_H_DEFINE=1
else
  HAVE_WCHAR_H_DEFINE=0
fi
AC_SUBST(HAVE_WCHAR_H_DEFINE)

# Needed by Abyss on Solaris:

AC_CHECK_HEADERS(sys/filio.h)
if test x"$ac_cv_header_sys_filio_h" = xyes; then
  HAVE_SYS_FILIO_H_DEFINE=1
else
  HAVE_SYS_FILIO_H_DEFINE=0
fi
AC_SUBST(HAVE_SYS_FILIO_H_DEFINE)

# Needed by Abyss on Solaris:

AC_CHECK_HEADERS(sys/ioctl.h)
if test x"$ac_cv_header_sys_ioctl_h" = xyes; then
  HAVE_SYS_IOCTL_H_DEFINE=1
else
  HAVE_SYS_IOCTL_H_DEFINE=0
fi
AC_SUBST(HAVE_SYS_IOCTL_H_DEFINE)

AC_CHECK_HEADERS(sys/select.h)
if test x"$ac_cv_header_sys_select_h" = xyes; then
  HAVE_SYS_SELECT_H_DEFINE=1
else
  HAVE_SYS_SELECT_H_DEFINE=0
fi
AC_SUBST(HAVE_SYS_SELECT_H_DEFINE)


AC_CHECK_HEADERS(stdarg.h, , [
AC_MSG_ERROR(stdarg.h is required to build this library)
])


dnl =======================================================================
dnl Checks for typedefs, structures, and compiler characteristics.
dnl =======================================================================

dnl AC_C_BIGENDIAN
AC_TYPE_SIZE_T

dnl This check is borrowed from Python 1.5.2.
va_list_is_array=no
AC_MSG_CHECKING(whether va_list is an array)
AC_TRY_COMPILE([
#include <stdarg.h>
], [va_list list1, list2; list1 = list2;], , 
va_list_is_array=yes)
AC_MSG_RESULT($va_list_is_array)
if test x"$va_list_is_array" = xyes; then
  VA_LIST_IS_ARRAY_DEFINE=1
else
  VA_LIST_IS_ARRAY_DEFINE=0
fi
AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)

AC_MSG_CHECKING(whether compiler has __attribute__)
AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
compiler_has_attribute=yes,
compiler_has_attribute=no)
AC_MSG_RESULT($compiler_has_attribute)
if test x"$compiler_has_attribute" = xyes; then
    ATTR_UNUSED="__attribute__((__unused__))"
else
    ATTR_UNUSED=
fi
AC_SUBST(ATTR_UNUSED)


dnl =======================================================================
dnl Checks for library functions.
dnl =======================================================================

AC_CHECK_FUNC(vsnprintf, , [
AC_MSG_ERROR(your C library does not provide vsnprintf)
])

dnl Unicode function needed by test suites.
AC_CHECK_FUNCS(wcsncmp)
if test "x$ac_cv_func_wcsncmp" = x""yes; then
  HAVE_WCSNCMP_DEFINE=1
else
  HAVE_WCSNCMP_DEFINE=0
fi
AC_SUBST(HAVE_WCSNCMP_DEFINE)

dnl CygWin doesn't provide setgroups.
AC_CHECK_FUNCS(setgroups)
if test "x$ac_cv_func_setgroups" = x""yes; then
  HAVE_SETGROUPS_DEFINE=1
else
  HAVE_SETGROUPS_DEFINE=0
fi
AC_SUBST(HAVE_SETGROUPS_DEFINE)

AC_CHECK_FUNCS(asprintf)
if test "x$ac_cv_func_asprintf" = x""yes; then
  HAVE_ASPRINTF_DEFINE=1
else
  HAVE_ASPRINTF_DEFINE=0
fi
AC_SUBST(HAVE_ASPRINTF_DEFINE)

AC_CHECK_FUNCS(setenv)
if test "x$ac_cv_func_setenv" = x""yes; then
  HAVE_SETENV_DEFINE=1
else
  HAVE_SETENV_DEFINE=0
fi
AC_SUBST(HAVE_SETENV_DEFINE)

AC_CHECK_FUNCS(strtoll)
if test "x$ac_cv_func_strtoll" = x""yes; then
  HAVE_STRTOLL_DEFINE=1
else
  HAVE_STRTOLL_DEFINE=0
fi
AC_SUBST(HAVE_STRTOLL_DEFINE)

AC_CHECK_FUNCS(strtoull)
if test "x$ac_cv_func_strtoull" = x""yes; then
  HAVE_STRTOULL_DEFINE=1
else
  HAVE_STRTOULL_DEFINE=0
fi
AC_SUBST(HAVE_STRTOULL_DEFINE)

AC_CHECK_FUNCS(strtoq)
if test "x$ac_cv_func_strtoq" = x""yes; then
  HAVE_STRTOQ_DEFINE=1
else
  HAVE_STRTOQ_DEFINE=0
fi
AC_SUBST(HAVE_STRTOQ_DEFINE)

AC_CHECK_FUNCS(strtouq)
if test "x$ac_cv_func_strtouq" = x""yes; then
  HAVE_STRTOUQ_DEFINE=1
else
  HAVE_STRTOUQ_DEFINE=0
fi
AC_SUBST(HAVE_STRTOUQ_DEFINE)

AC_CHECK_FUNCS(__strtoll)
if test "x$ac_cv_func___strtoll" = x""yes; then
  HAVE___STRTOLL_DEFINE=1
else
  HAVE___STRTOLL_DEFINE=0
fi
AC_SUBST(HAVE___STRTOLL_DEFINE)

AC_CHECK_FUNCS(__strtoull)
if test "x$ac_cv_func___strtoull" = x""yes; then
  HAVE___STRTOULL_DEFINE=1
else
  HAVE___STRTOULL_DEFINE=0
fi
AC_SUBST(HAVE___STRTOULL_DEFINE)

AC_CHECK_FUNCS(_strtoui64)
if test "x$ac_cv_func__strtoui64" = x""yes; then
  HAVE__STRTOUI64_DEFINE=1
else
  HAVE__STRTOUI64_DEFINE=0
fi
AC_SUBST(HAVE__STRTOUI64_DEFINE)

dnl uclib doesn't have pselect
AC_CHECK_FUNCS(pselect)
if test "x$ac_cv_func_pselect" = x""yes; then
  HAVE_PSELECT_DEFINE=1
else
  HAVE_PSELECT_DEFINE=0
fi
AC_SUBST(HAVE_PSELECT_DEFINE)

dnl Windows doesn't have gettimeofday, localtime_r, or gmtime_r
AC_CHECK_FUNCS(gettimeofday)
if test "x$ac_cv_func_gettimeofday" = x""yes; then
  HAVE_GETTIMEOFDAY_DEFINE=1
else
  HAVE_GETTIMEOFDAY_DEFINE=0
fi
AC_SUBST(HAVE_GETTIMEOFDAY_DEFINE)

AC_CHECK_FUNCS(localtime_r)
if test "x$ac_cv_func_localtime_r" = x""yes; then
  HAVE_LOCALTIME_R_DEFINE=1
else
  HAVE_LOCALTIME_R_DEFINE=0
fi
AC_SUBST(HAVE_LOCALTIME_R_DEFINE)

AC_CHECK_FUNCS(gmtime_r)
if test "x$ac_cv_func_gmtime_r" = x""yes; then
  HAVE_GMTIME_R_DEFINE=1
else
  HAVE_GMTIME_R_DEFINE=0
fi
AC_SUBST(HAVE_GMTIME_R_DEFINE)

dnl Windows doesn't have strcasecmp;
AC_CHECK_FUNCS(strcasecmp)
if test "x$ac_cv_func_strcasecmp" = x""yes; then
  HAVE_STRCASECMP_DEFINE=1
else
  HAVE_STRCASECMP_DEFINE=0
fi
AC_SUBST(HAVE_STRCASECMP_DEFINE)

AC_CHECK_FUNCS(stricmp)
if test "x$ac_cv_func_stricmp" = x""yes; then
  HAVE_STRICMP_DEFINE=1
else
  HAVE_STRICMP_DEFINE=0
fi
AC_SUBST(HAVE_STRICMP_DEFINE)

AC_CHECK_FUNCS(_stricmp)
if test "x$ac_cv_func__stricmp" = x""yes; then
  HAVE__STRICMP_DEFINE=1
else
  HAVE__STRICMP_DEFINE=0
fi
AC_SUBST(HAVE__STRICMP_DEFINE)

dnl =======================================================================
dnl Checks for operating system features.
dnl =======================================================================

dnl Non-Unix systems will need to set up their platform configuration file
dnl by hand.
case "$host_os" in
     *mingw*)
        DIRECTORY_SEPARATOR="\\\\"
        ;;
     *)
        DIRECTORY_SEPARATOR="/"
        ;;
esac
AC_SUBST(DIRECTORY_SEPARATOR)


dnl =======================================================================
dnl ABYSS Configuration
dnl =======================================================================

AC_MSG_CHECKING(whether to use Abyss pthread function)
AC_ARG_ENABLE(abyss-threads,
  [  --disable-abyss-threads   Use fork in Abyss instead of pthreads], ,
  enable_abyss_threads=yes)
AC_MSG_RESULT($enable_abyss_threads)

ENABLE_ABYSS_THREADS=$enable_abyss_threads
AC_SUBST(ENABLE_ABYSS_THREADS)

if test x"$enable_abyss_threads" != xno; then
    CFLAGS="$CFLAGS -D_THREAD"
fi


dnl =======================================================================
dnl Finding wininet stubs
dnl =======================================================================
dnl If you implement the parts of wininet.h the wininet_transport uses,
dnl you will need to configure this way..

if test $MUST_BUILD_WININET_CLIENT = yes; then

    dnl You can control which of these gets chosen by controlling PATH.
    AC_PATH_PROGS(WININET_CONFIG, wininet-xmlrpc-config wininet-config, no)
    if test "x$WININET_CONFIG" = "xno"; then
        AC_MSG_ERROR(Configure INTERNAL ERROR - first wininet-config found, then not found)
    fi

    dnl Get our wininet version.
    dnl Adapted from a macro which called gtk-config.
    AC_MSG_CHECKING(for wininet version >= 1.0.0)
    W3VER=$($WININET_CONFIG --version)
    WININET_MAJOR=\
$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/')
    WININET_MINOR=\
$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/')
    WININET_MICRO=\
$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/')
    AC_MSG_RESULT($WININET_MAJOR.$WININET_MINOR.$WININET_MICRO)

    dnl Check to make sure our version is OK.
    WININET_VERSION_OK=yes
    if test $WININET_MAJOR -lt 1; then
        WININET_VERSION_OK=no
    else
        if test $WININET_MAJOR -eq 1 -a $WININET_MINOR -lt 0; then
            WININET_VERSION_OK=no
        else
            if test $WININET_MAJOR -eq 1 -a $WININET_MINOR -eq 0 \
                -a $WININET_MICRO -lt 0; then
                WININET_VERSION_OK=no
            fi
        fi
    fi
    if test "x$WININET_VERSION_OK" = "xno"; then
        AC_MSG_ERROR(wininet version >= 1.0.0 required)
    fi

    dnl Get the necessary CFLAGS, and merge them into our master list.
    WININET_CFLAGS=$($WININET_CONFIG --cflags)
    AC_SUBST(WININET_CFLAGS)
    CFLAGS="$CFLAGS $WININET_CFLAGS" 

    dnl Get the huge list of libraries we need to link against.
    WININET_LDADD=$($WININET_CONFIG --libs)
    AC_SUBST(WININET_LDADD)

    AC_MSG_CHECKING(for wininet library directory)
    WININET_LIBDIR="$($WININET_CONFIG --prefix)/lib"
    AC_MSG_RESULT($WININET_LIBDIR)
    AC_SUBST(WININET_LIBDIR)

fi # MUST_BUILD_WININET_CLIENT

dnl =======================================================================
dnl Finding w3c-libwww
dnl =======================================================================

if test $MUST_BUILD_LIBWWW_CLIENT = yes; then

    dnl First of all, locate the libwww config program.
    dnl You can control which of these gets chosen by controlling PATH.
    AC_PATH_PROGS(LIBWWW_CONFIG, libwww-xmlrpc-config libwww-config, no)
    if test "x$LIBWWW_CONFIG" = "xno"; then
        AC_MSG_ERROR(Configure INTERNAL ERROR - first libwww-config found, then not found)
    fi

    dnl Get our libwww version.
    dnl Adapted from a macro which called gtk-config.
    AC_MSG_CHECKING(for w3c-libwww version >= 5.2.8)
    W3VER=$($LIBWWW_CONFIG --version)
    LIBWWW_MAJOR=\
$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/')
    LIBWWW_MINOR=\
$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/')
    LIBWWW_MICRO=\
$(echo $W3VER|sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/')
    AC_MSG_RESULT($LIBWWW_MAJOR.$LIBWWW_MINOR.$LIBWWW_MICRO)

    dnl Check to make sure our version is OK.
    LIBWWW_VERSION_OK=yes
    if test $LIBWWW_MAJOR -lt 5; then
        LIBWWW_VERSION_OK=no
    else
        if test $LIBWWW_MAJOR -eq 5 -a $LIBWWW_MINOR -lt 2; then
            LIBWWW_VERSION_OK=no
        else
            if test $LIBWWW_MAJOR -eq 5 -a $LIBWWW_MINOR -eq 2 \
                -a $LIBWWW_MICRO -lt 8; then
                LIBWWW_VERSION_OK=no
            fi
        fi
    fi
    if test "x$LIBWWW_VERSION_OK" = "xno"; then
        AC_MSG_ERROR(w3c-libwww version >= 5.2.8 required)
    fi

    dnl Get the huge list of libraries we need to link against.
    LIBWWW_LDADD=$($LIBWWW_CONFIG --libs)
    AC_SUBST(LIBWWW_LDADD)

    AC_MSG_CHECKING(for libwww library directory)
    LIBWWW_LIBDIR="$($LIBWWW_CONFIG --prefix)/lib"
    AC_MSG_RESULT($LIBWWW_LIBDIR)
    AC_SUBST(LIBWWW_LIBDIR)

fi # MUST_BUILD_LIBWWW_CLIENT


dnl =======================================================================
dnl Finding Curl
dnl =======================================================================

if test $MUST_BUILD_CURL_CLIENT = yes; then

    dnl First of all, locate the Curl config program.
    dnl You can control which of these gets chosen by controlling PATH.
    AC_PATH_PROGS(CURL_CONFIG, curl-xmlrpc-config curl-config, no)
    if test "x$CURL_CONFIG" = "xno"; then
        AC_MSG_ERROR(Configure INTERNAL ERROR - first curl-config found, then not found)
    fi
    
    dnl There used to be code here to check the Curl version and make sure
    dnl it is at least 7.8.  But there were bugs both in the code and in 
    dnl curl (curl-config --vernum, at least in older versions of Curl,
    dnl omits the leading zero).  So it didn't work.  Plus, checking version
    dnl numbers isn't a good idea.  Better to check for feature presence.
    dnl So we don't do any check now.  If we find out there's a problem with
    dnl older Curls, we will revisit that.

    AC_SUBST(CURL_CONFIG)

    CURL_LDADD=$($CURL_CONFIG --libs)
    AC_SUBST(CURL_LDADD)

    AC_MSG_CHECKING(for Curl library directory)
    CURL_LIBDIR="$($CURL_CONFIG --prefix)/lib"

    AC_MSG_RESULT($CURL_LIBDIR)
    AC_SUBST(CURL_LIBDIR)

fi # MUST_BUILD_CURL_CLIENT


dnl =======================================================================
dnl Finding OpenSSL
dnl =======================================================================

AC_MSG_CHECKING(for OpenSSL library)

if pkg-config openssl; then
  HAVE_OPENSSL=yes
else
  HAVE_OPENSSL=no
fi

AC_MSG_RESULT($HAVE_OPENSSL)
AC_SUBST(HAVE_OPENSSL)

# One really annoying case where the user needs to disable building of
# Openssl-based parts explicitly is where there is no Openssl for the target
# platform but there is for the native platform.  In that case, Pkg-config
# finds the openssl.pc in /usr/lib, ignoring the fact that /usr/lib is not in
# the search path specified by the PKG_CONFIG environment variable.  This is
# a major design flaw in Pkg-config.

AC_ARG_ENABLE(abyss-openssl,
  [  --disable-abyss-openssl     Don't build Abyss Openssl channel function],
  , 
  enable_abyss_openssl=maybe)

if test $enable_abyss_openssl = maybe; then
  if test $HAVE_OPENSSL = no; then
    AC_MSG_NOTICE([You don't appear to have Openssl installed (no pkg-config file for it in your pkg-config search path), so we will not build the Abyss Openssl channel module])
    MUST_BUILD_ABYSS_OPENSSL=no
  else
    MUST_BUILD_ABYSS_OPENSSL=yes
  fi
else
  MUST_BUILD_ABYSS_OPENSSL=$enable_abyss_openssl
fi

AC_MSG_CHECKING(whether to build Abyss Openssl channel module)
AC_MSG_RESULT($MUST_BUILD_ABYSS_OPENSSL)
AC_SUBST(MUST_BUILD_ABYSS_OPENSSL)

if test $MUST_BUILD_ABYSS_OPENSSL = yes; then
  HAVE_ABYSS_OPENSSL_DEFINE=1
else
  HAVE_ABYSS_OPENSSL_DEFINE=0
fi  

AC_SUBST(HAVE_ABYSS_OPENSSL_DEFINE)


dnl =======================================================================
dnl Finding Libxml2
dnl =======================================================================

AC_MSG_CHECKING(for Libxml2 library)

if pkg-config libxml-2.0; then
  HAVE_LIBXML2=yes
else
  HAVE_LIBXML2=no
fi

AC_MSG_RESULT($HAVE_LIBXML2)

AC_ARG_ENABLE(libxml2-backend,
  [  --enable-libxml2-backend  Use libxml2 instead of built-in expat], ,
enable_libxml2_backend=no)
AC_MSG_CHECKING(whether to build the libxml2 backend)
AC_MSG_RESULT($enable_libxml2_backend)

if test $enable_libxml2_backend = yes; then
  if test $HAVE_LIBXML2 = no; then
    AC_MSG_ERROR([You specified --enable-libxml2_backend, but don't appear to have libxml2 installed (no pkg-config file for it in your pkg-config search path), so we cannot not build for libxml2])
  fi
fi

ENABLE_LIBXML2_BACKEND=$enable_libxml2_backend
AC_SUBST(ENABLE_LIBXML2_BACKEND)


dnl =======================================================================
dnl Checks for build options.
dnl =======================================================================

AC_ARG_WITH(libwww-ssl,
  [  --with-libwww-ssl       Include libwww SSL capability.]
   ) 

if test x"$enable_libwww_client" != xno; then
    AC_MSG_CHECKING(whether to use SSL with libwww)
    if test x"$with_libwww_ssl" = xyes; then
        AC_MSG_RESULT(yes)
        HAVE_LIBWWW_SSL_DEFINE=1
    else
        AC_MSG_RESULT(no)
        HAVE_LIBWWW_SSL_DEFINE=0
    fi
else
    HAVE_LIBWWW_SSL_DEFINE=0
fi
AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)

dnl =======================================================================
dnl Compiler information
dnl =======================================================================
C_COMPILER_GNU=$ac_cv_c_compiler_gnu
AC_SUBST(C_COMPILER_GNU)
CXX_COMPILER_GNU=$ac_cv_cxx_compiler_gnu
AC_SUBST(CXX_COMPILER_GNU)

dnl obsolete variables, need to be removed from Makefile.in:
CC_WARN_FLAGS=
AC_SUBST(CC_WARN_FLAGS)
CPP_WARN_FLAGS=
AC_SUBST(CPP_WARN_FLAGS)


BUILDDIR=$(pwd)
AC_SUBST(BUILDDIR)

AC_CHECK_TOOL([AR], [ar])
AC_PROG_RANLIB

dnl =======================================================================
dnl Output our results.
dnl =======================================================================

dnl Note that AM_CONFIG_HEADER at the top of this file outputs another
dnl result: xmlrpc_amconfig.h .

AC_OUTPUT( \
          srcdir.mk \
          config.mk \
          xmlrpc_config.h \
          )


if test ! -f GNUmakefile; then
  ln -s "${srcdir}/GNUmakefile" .
fi
if test ! -f Makefile; then
  ln -s "${srcdir}/Makefile" .
fi
if test ! -f transport_config.mk; then
  ln -s "${srcdir}/transport_config.mk" .
fi


if test "$MUST_BUILD_WININET_CLIENT $MUST_BUILD_CURL_CLIENT $MUST_BUILD_LIBWWW_CLIENT" = "no no no"; then
  AC_MSG_NOTICE([==>])
  AC_MSG_NOTICE([==>We are not building any client XML transport (see earlier messages explaining why), therefore WE WILL NOT BUILD THE CLIENT LIBRARY.])
  AC_MSG_NOTICE([==>])
fi