nspr.m4 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # -*- tab-width: 4; -*-
  2. # Configure paths for NSPR
  3. # Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
  4. # Based upon gtk.m4 (also PD) by Owen Taylor
  5. dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  6. dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
  7. AC_DEFUN([AM_PATH_NSPR],
  8. [dnl
  9. AC_ARG_WITH(nspr-prefix,
  10. [ --with-nspr-prefix=PFX Prefix where NSPR is installed],
  11. nspr_config_prefix="$withval",
  12. nspr_config_prefix="")
  13. AC_ARG_WITH(nspr-exec-prefix,
  14. [ --with-nspr-exec-prefix=PFX
  15. Exec prefix where NSPR is installed],
  16. nspr_config_exec_prefix="$withval",
  17. nspr_config_exec_prefix="")
  18. if test -n "$nspr_config_exec_prefix"; then
  19. nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
  20. if test -z "$NSPR_CONFIG"; then
  21. NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
  22. fi
  23. fi
  24. if test -n "$nspr_config_prefix"; then
  25. nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
  26. if test -z "$NSPR_CONFIG"; then
  27. NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
  28. fi
  29. fi
  30. unset ac_cv_path_NSPR_CONFIG
  31. AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
  32. min_nspr_version=ifelse([$1], ,4.0.0,$1)
  33. AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
  34. no_nspr=""
  35. if test "$NSPR_CONFIG" = "no"; then
  36. no_nspr="yes"
  37. else
  38. NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
  39. NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
  40. nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \
  41. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  42. nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \
  43. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  44. nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \
  45. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  46. min_nspr_major_version=`echo $min_nspr_version | \
  47. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  48. min_nspr_minor_version=`echo $min_nspr_version | \
  49. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  50. min_nspr_micro_version=`echo $min_nspr_version | \
  51. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  52. if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
  53. no_nspr="yes"
  54. elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
  55. test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then
  56. no_nspr="yes"
  57. elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
  58. test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" &&
  59. test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then
  60. no_nspr="yes"
  61. fi
  62. fi
  63. if test -z "$no_nspr"; then
  64. AC_MSG_RESULT(yes)
  65. ifelse([$2], , :, [$2])
  66. else
  67. AC_MSG_RESULT(no)
  68. fi
  69. AC_SUBST(NSPR_CFLAGS)
  70. AC_SUBST(NSPR_LIBS)
  71. ])