You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
6.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. # Based on:
  2. # Configure paths for libcsoap
  3. # Heiko Ronsdorf 2006-02-03
  4. # Adapted from:
  5. #
  6. dnl AM_PATH_CSOAP([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  7. dnl Test for CSOAP, and define CSOAP_CFLAGS and CSOAP_LIBS
  8. dnl
  9. AC_DEFUN([AM_PATH_CSOAP],[
  10. AC_ARG_WITH(csoap-prefix,
  11. AC_HELP_STRING(
  12. [--with-csoap-prefix=PFX],
  13. [Prefix where libcsoap is installed (optional)]
  14. ),
  15. csoap_config_prefix="$withval", csoap_config_prefix=""
  16. )
  17. AC_ARG_WITH(csoap-exec-prefix,
  18. AC_HELP_STRING(
  19. [--with-csoap-exec-prefix=PFX],
  20. [Exec prefix where libcsoap is installed (optional)]
  21. ),
  22. csoap_config_exec_prefix="$withval", csoap_config_exec_prefix=""
  23. )
  24. AC_ARG_ENABLE(csoaptest,
  25. AC_HELP_STRING(
  26. [--disable-csoaptest],
  27. [Do not try to compile and run a test cSOAP program]
  28. ),,
  29. enable_csoaptest=yes
  30. )
  31. if test x$csoap_config_exec_prefix != x ; then
  32. csoap_config_args="$csoap_config_args --exec-prefix=$csoap_config_exec_prefix"
  33. if test x${CSOAP_CONFIG+set} != xset ; then
  34. CSOAP_CONFIG=$csoap_config_exec_prefix/bin/csoap-config
  35. fi
  36. fi
  37. if test x$csoap_config_prefix != x ; then
  38. csoap_config_args="$csoap_config_args --prefix=$csoap_config_prefix"
  39. if test x${CSOAP_CONFIG+set} != xset ; then
  40. CSOAP_CONFIG=$csoap_config_prefix/bin/csoap-config
  41. fi
  42. fi
  43. AC_PATH_PROG(CSOAP_CONFIG, csoap-config, no)
  44. min_csoap_version=ifelse([$1], ,1.0.0,[$1])
  45. AC_MSG_CHECKING(for libcsoap - version >= $min_csoap_version)
  46. no_csoap=""
  47. if test "$CSOAP_CONFIG" = "no" ; then
  48. no_csoap=yes
  49. else
  50. CSOAP_CFLAGS=`$CSOAP_CONFIG $csoap_config_args --cflags`
  51. CSOAP_LIBS=`$CSOAP_CONFIG $csoap_config_args --libs`
  52. csoap_config_major_version=`$CSOAP_CONFIG $csoap_config_args --version | \
  53. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  54. csoap_config_minor_version=`$CSOAP_CONFIG $csoap_config_args --version | \
  55. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  56. csoap_config_micro_version=`$CSOAP_CONFIG $csoap_config_args --version | \
  57. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  58. if test "x$enable_csoaptest" = "xyes" ; then
  59. ac_save_CFLAGS="$CFLAGS"
  60. ac_save_LIBS="$LIBS"
  61. CFLAGS="$CFLAGS $CSOAP_CFLAGS"
  62. LIBS="$CSOAP_LIBS $LIBS"
  63. dnl
  64. dnl Now check if the installed libcsoap is sufficiently new.
  65. dnl (Also sanity checks the results of csoap-config to some extent)
  66. dnl
  67. rm -f conf.csoaptest
  68. AC_TRY_RUN([
  69. #include <stdlib.h>
  70. #include <stdio.h>
  71. #include <string.h>
  72. #include <libxml/tree.h>
  73. #include <libcsoap/soap-client.h>
  74. int main(int argc, char **argv) {
  75. int major, minor, micro;
  76. char *tmp_version;
  77. system("touch conf.csoaptest");
  78. /* Capture csoap-config output via autoconf/configure variables */
  79. /* HP/UX 9 (%@#!) writes to sscanf strings */
  80. tmp_version = (char *)strdup("$min_csoap_version");
  81. if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
  82. printf("%s, bad version string from csoap-config\n", "$min_csoap_version");
  83. exit(1);
  84. }
  85. free(tmp_version);
  86. /* Test that the library is greater than our minimum version */
  87. if (($csoap_config_major_version < major) ||
  88. (($csoap_config_major_version == major) && ($csoap_config_minor_version < minor)) ||
  89. (($csoap_config_major_version == major) && ($csoap_config_minor_version == minor) && ($csoap_config_micro_version < micro))) {
  90. printf("\n*** An old version of libcsoap (%d.%d.%d) was found.\n", $csoap_config_major_version, $csoap_config_minor_version, $csoap_config_micro_version);
  91. printf("*** You need a version of libcsoap newer than %d.%d.%d. The latest version of\n", major, minor, micro);
  92. printf("*** libcsoap is always available from http://csoap.sf.net.\n\n");
  93. printf("*** If you have already installed a sufficiently new version, this error\n");
  94. printf("*** probably means that the wrong copy of the csoap-config shell script is\n");
  95. printf("*** being found. The easiest way to fix this is to remove the old version\n");
  96. printf("*** of libcsoap, but you can also set the CSOAP_CONFIG environment to point to the\n");
  97. printf("*** correct copy of csoap-config. (In this case, you will have to\n");
  98. printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
  99. printf("*** so that the correct libraries are found at run-time))\n");
  100. return 1;
  101. }
  102. else {
  103. return 0;
  104. }
  105. }
  106. ],, no_csoap=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  107. CFLAGS="$ac_save_CFLAGS"
  108. LIBS="$ac_save_LIBS"
  109. fi
  110. fi
  111. if test "x$no_csoap" = x ; then
  112. AC_MSG_RESULT(yes (version $csoap_config_major_version.$csoap_config_minor_version.$csoap_config_micro_version))
  113. ifelse([$2], , :, [$2])
  114. else
  115. AC_MSG_RESULT(no)
  116. if test "$CSOAP_CONFIG" = "no" ; then
  117. echo "*** The csoap-config script installed by LIBCSOAP could not be found"
  118. echo "*** If libcsoap was installed in PREFIX, make sure PREFIX/bin is in"
  119. echo "*** your path, or set the CSOAP_CONFIG environment variable to the"
  120. echo "*** full path to csoap-config."
  121. else
  122. if test -f conf.csoaptest ; then
  123. :
  124. else
  125. echo "*** Could not run libcsoap test program, checking why..."
  126. CFLAGS="$CFLAGS $CSOAP_CFLAGS"
  127. LIBS="$LIBS $CSOAP_LIBS"
  128. AC_TRY_LINK([
  129. #include <libcsoap/soap-client.h>
  130. #include <stdio.h>
  131. ], [ soap_client_destroy(); return 0;],
  132. [ echo "*** The test program compiled, but did not run. This usually means"
  133. echo "*** that the run-time linker is not finding LIBCSOAP or finding the wrong"
  134. echo "*** version of LIBCSOAP. If it is not finding LIBCSOAP, you'll need to set your"
  135. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  136. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  137. echo "*** is required on your system"
  138. echo "***"
  139. echo "*** If you have an old version installed, it is best to remove it, although"
  140. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
  141. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  142. echo "*** exact error that occured. This usually means LIBCSOAP was incorrectly installed"
  143. echo "*** or that you have moved LIBCSOAP since it was installed. In the latter case, you"
  144. echo "*** may want to edit the csoap-config script: $CSOAP_CONFIG" ])
  145. CFLAGS="$ac_save_CFLAGS"
  146. LIBS="$ac_save_LIBS"
  147. fi
  148. fi
  149. CSOAP_CFLAGS=""
  150. CSOAP_LIBS=""
  151. ifelse([$3], , :, [$3])
  152. fi
  153. AC_SUBST(CSOAP_CFLAGS)
  154. AC_SUBST(CSOAP_LIBS)
  155. rm -f conf.csoaptest
  156. ])