libgnutls-extra.m4 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. dnl Autoconf macros for libgnutls-extra
  2. dnl $id$
  3. # Modified for LIBGNUTLS_EXTRA -- nmav
  4. # Configure paths for LIBGCRYPT
  5. # Shamelessly stolen from the one of XDELTA by Owen Taylor
  6. # Werner Koch 99-12-09
  7. dnl AM_PATH_LIBGNUTLS_EXTRA([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  8. dnl Test for libgnutls-extra, and define LIBGNUTLS_EXTRA_CFLAGS and LIBGNUTLS_EXTRA_LIBS
  9. dnl
  10. AC_DEFUN([AM_PATH_LIBGNUTLS_EXTRA],
  11. [dnl
  12. dnl Get the cflags and libraries from the libgnutls-extra-config script
  13. dnl
  14. AC_ARG_WITH(libgnutls-extra-prefix,
  15. [ --with-libgnutls-extra-prefix=PFX Prefix where libgnutls-extra is installed (optional)],
  16. libgnutls_extra_config_prefix="$withval", libgnutls_extra_config_prefix="")
  17. if test x$libgnutls_extra_config_prefix != x ; then
  18. if test x${LIBGNUTLS_EXTRA_CONFIG+set} != xset ; then
  19. LIBGNUTLS_EXTRA_CONFIG=$libgnutls_extra_config_prefix/bin/libgnutls-extra-config
  20. fi
  21. fi
  22. AC_PATH_PROG(LIBGNUTLS_EXTRA_CONFIG, libgnutls-extra-config, no)
  23. min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
  24. AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
  25. no_libgnutls=""
  26. if test "$LIBGNUTLS_EXTRA_CONFIG" = "no" ; then
  27. no_libgnutls=yes
  28. else
  29. LIBGNUTLS_EXTRA_CFLAGS=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --cflags`
  30. LIBGNUTLS_EXTRA_LIBS=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --libs`
  31. libgnutls_extra_config_version=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --version`
  32. ac_save_CFLAGS="$CFLAGS"
  33. ac_save_LIBS="$LIBS"
  34. CFLAGS="$CFLAGS $LIBGNUTLS_EXTRA_CFLAGS"
  35. LIBS="$LIBS $LIBGNUTLS_EXTRA_LIBS"
  36. dnl
  37. dnl Now check if the installed libgnutls is sufficiently new. Also sanity
  38. dnl checks the results of libgnutls-extra-config to some extent
  39. dnl
  40. rm -f conf.libgnutlstest
  41. AC_TRY_RUN([
  42. #include <stdio.h>
  43. #include <stdlib.h>
  44. #include <string.h>
  45. #include <gnutls/extra.h>
  46. int
  47. main ()
  48. {
  49. system ("touch conf.libgnutlstest");
  50. if( strcmp( gnutls_extra_check_version(NULL), "$libgnutls_extra_config_version" ) )
  51. {
  52. printf("\n*** 'libgnutls-extra-config --version' returned %s, but LIBGNUTLS_EXTRA (%s)\n",
  53. "$libgnutls_extra_config_version", gnutls_extra_check_version(NULL) );
  54. printf("*** was found! If libgnutls-extra-config was correct, then it is best\n");
  55. printf("*** to remove the old version of LIBGNUTLS_EXTRA. You may also be able to fix the error\n");
  56. printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
  57. printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
  58. printf("*** required on your system.\n");
  59. printf("*** If libgnutls-extra-config was wrong, set the environment variable LIBGNUTLS_EXTRA_CONFIG\n");
  60. printf("*** to point to the correct copy of libgnutls-extra-config, and remove the file config.cache\n");
  61. printf("*** before re-running configure\n");
  62. }
  63. else if ( strcmp(gnutls_extra_check_version(NULL), LIBGNUTLS_EXTRA_VERSION ) )
  64. {
  65. printf("\n*** LIBGNUTLS_EXTRA header file (version %s) does not match\n", LIBGNUTLS_EXTRA_VERSION);
  66. printf("*** library (version %s). This is may be due to a different version of gnutls\n", gnutls_extra_check_version(NULL) );
  67. printf("*** and gnutls-extra.\n");
  68. }
  69. else
  70. {
  71. if ( gnutls_extra_check_version( "$min_libgnutls_version" ) )
  72. {
  73. return 0;
  74. }
  75. else
  76. {
  77. printf("no\n*** An old version of LIBGNUTLS_EXTRA (%s) was found.\n",
  78. gnutls_extra_check_version(NULL) );
  79. printf("*** You need a version of LIBGNUTLS_EXTRA newer than %s. The latest version of\n",
  80. "$min_libgnutls_version" );
  81. printf("*** LIBGNUTLS_EXTRA is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
  82. printf("*** \n");
  83. printf("*** If you have already installed a sufficiently new version, this error\n");
  84. printf("*** probably means that the wrong copy of the libgnutls-extra-config shell script is\n");
  85. printf("*** being found. The easiest way to fix this is to remove the old version\n");
  86. printf("*** of LIBGNUTLS_EXTRA, but you can also set the LIBGNUTLS_EXTRA_CONFIG environment to point to the\n");
  87. printf("*** correct copy of libgnutls-extra-config. (In this case, you will have to\n");
  88. printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
  89. printf("*** so that the correct libraries are found at run-time))\n");
  90. }
  91. }
  92. return 1;
  93. }
  94. ],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  95. CFLAGS="$ac_save_CFLAGS"
  96. LIBS="$ac_save_LIBS"
  97. fi
  98. if test "x$no_libgnutls" = x ; then
  99. AC_MSG_RESULT(yes)
  100. ifelse([$2], , :, [$2])
  101. else
  102. if test -f conf.libgnutlstest ; then
  103. :
  104. else
  105. AC_MSG_RESULT(no)
  106. fi
  107. if test "$LIBGNUTLS_EXTRA_CONFIG" = "no" ; then
  108. echo "*** The libgnutls-extra-config script installed by LIBGNUTLS_EXTRA could not be found"
  109. echo "*** If LIBGNUTLS_EXTRA was installed in PREFIX, make sure PREFIX/bin is in"
  110. echo "*** your path, or set the LIBGNUTLS_EXTRA_CONFIG environment variable to the"
  111. echo "*** full path to libgnutls-extra-config."
  112. else
  113. if test -f conf.libgnutlstest ; then
  114. :
  115. else
  116. echo "*** Could not run libgnutls test program, checking why..."
  117. CFLAGS="$CFLAGS $LIBGNUTLS_EXTRA_CFLAGS"
  118. LIBS="$LIBS $LIBGNUTLS_EXTRA_LIBS"
  119. AC_TRY_LINK([
  120. #include <stdio.h>
  121. #include <stdlib.h>
  122. #include <string.h>
  123. #include <gnutls/extra.h>
  124. ], [ return !!gnutls_extra_check_version(NULL); ],
  125. [ echo "*** The test program compiled, but did not run. This usually means"
  126. echo "*** that the run-time linker is not finding LIBGNUTLS_EXTRA or finding the wrong"
  127. echo "*** version of LIBGNUTLS_EXTRA. If it is not finding LIBGNUTLS_EXTRA, you'll need to set your"
  128. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  129. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  130. echo "*** is required on your system"
  131. echo "***"
  132. echo "*** If you have an old version installed, it is best to remove it, although"
  133. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
  134. echo "***" ],
  135. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  136. echo "*** exact error that occured. This usually means LIBGNUTLS_EXTRA was incorrectly installed"
  137. echo "*** or that you have moved LIBGNUTLS_EXTRA since it was installed. In the latter case, you"
  138. echo "*** may want to edit the libgnutls-extra-config script: $LIBGNUTLS_EXTRA_CONFIG" ])
  139. CFLAGS="$ac_save_CFLAGS"
  140. LIBS="$ac_save_LIBS"
  141. fi
  142. fi
  143. LIBGNUTLS_EXTRA_CFLAGS=""
  144. LIBGNUTLS_EXTRA_LIBS=""
  145. ifelse([$3], , :, [$3])
  146. fi
  147. rm -f conf.libgnutlstest
  148. AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
  149. AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
  150. ])
  151. dnl *-*wedit:notab*-* Please keep this as the last line.