dpkg.m4 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. dnl Moved from configure.in, modified to use AC_DEFUN
  2. dnl -- Tom Lees <tom@lpsg.demon.co.uk>
  3. dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
  4. AC_DEFUN(DPKG_CACHED_TRY_COMPILE,[
  5. AC_MSG_CHECKING($1)
  6. AC_CACHE_VAL($2,[
  7. AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
  8. ])
  9. if test "x$$2" = xyes; then
  10. true
  11. $5
  12. else
  13. true
  14. $6
  15. fi
  16. ])
  17. dnl DPKG_C_GCC_TRY_WARNS(<warnings>,<cachevar>)
  18. AC_DEFUN(DPKG_C_GCC_TRY_WARNS,[
  19. AC_MSG_CHECKING([GCC warning flag(s) $1])
  20. if test "${GCC-no}" = yes
  21. then
  22. AC_CACHE_VAL($2,[
  23. oldcflags="${CFLAGS-}"
  24. CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror"
  25. AC_TRY_COMPILE([
  26. #include <string.h>
  27. #include <stdio.h>
  28. ],[
  29. strcmp("a","b"); fprintf(stdout,"test ok\n");
  30. ], [$2=yes], [$2=no])
  31. CFLAGS="${oldcflags}"])
  32. if test "x$$2" = xyes; then
  33. CWARNS="${CWARNS} $1"
  34. AC_MSG_RESULT(ok)
  35. else
  36. $2=''
  37. AC_MSG_RESULT(no)
  38. fi
  39. else
  40. AC_MSG_RESULT(no, not using GCC)
  41. fi
  42. ])
  43. dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)