nss.m4 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # BEGIN COPYRIGHT BLOCK
  2. # Copyright (C) 2007 Red Hat, Inc.
  3. # All rights reserved.
  4. #
  5. # License: GPL (version 3 or any later version).
  6. # See LICENSE for details.
  7. # END COPYRIGHT BLOCK
  8. AC_CHECKING(for NSS)
  9. # check for --with-nss
  10. AC_MSG_CHECKING(for --with-nss)
  11. AC_ARG_WITH(nss, AS_HELP_STRING([--with-nss@<:@=PATH@:>@],[Network Security Services (NSS) directory]),
  12. [
  13. if test "$withval" = "yes"
  14. then
  15. AC_MSG_RESULT(yes)
  16. elif test "$withval" = "no"
  17. then
  18. AC_MSG_RESULT(no)
  19. AC_MSG_ERROR([NSS is required.])
  20. elif test -e "$withval"/include/nss.h -a -d "$withval"/lib
  21. then
  22. AC_MSG_RESULT([using $withval])
  23. NSSDIR=$withval
  24. nss_inc="-I$NSSDIR/include"
  25. nss_lib="-L$NSSDIR/lib"
  26. nss_libdir="$NSSDIR/lib"
  27. else
  28. echo
  29. AC_MSG_ERROR([$withval not found])
  30. fi
  31. ],
  32. AC_MSG_RESULT(yes))
  33. # check for --with-nss-inc
  34. AC_MSG_CHECKING(for --with-nss-inc)
  35. AC_ARG_WITH(nss-inc, AS_HELP_STRING([--with-nss-inc=PATH],[Network Security Services (NSS) include directory]),
  36. [
  37. if test -e "$withval"/nss.h
  38. then
  39. AC_MSG_RESULT([using $withval])
  40. nss_inc="-I$withval"
  41. else
  42. echo
  43. AC_MSG_ERROR([$withval not found])
  44. fi
  45. ],
  46. AC_MSG_RESULT(no))
  47. # check for --with-nss-lib
  48. AC_MSG_CHECKING(for --with-nss-lib)
  49. AC_ARG_WITH(nss-lib, AS_HELP_STRING([--with-nss-lib=PATH],[Network Security Services (NSS) library directory]),
  50. [
  51. if test -d "$withval"
  52. then
  53. AC_MSG_RESULT([using $withval])
  54. nss_lib="-L$withval"
  55. nss_libdir="$withval"
  56. else
  57. echo
  58. AC_MSG_ERROR([$withval not found])
  59. fi
  60. ],
  61. AC_MSG_RESULT(no))
  62. # if NSS is not found yet, try pkg-config
  63. # last resort
  64. if test -z "$nss_inc" -o -z "$nss_lib" -o -z "$nss_libdir"; then
  65. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  66. AC_MSG_CHECKING(for nss with pkg-config)
  67. if test -n "$PKG_CONFIG"; then
  68. if $PKG_CONFIG --exists nss; then
  69. nss_inc=`$PKG_CONFIG --cflags-only-I nss`
  70. nss_lib=`$PKG_CONFIG --libs-only-L nss`
  71. nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ .*$//`
  72. AC_MSG_RESULT([using system NSS])
  73. elif $PKG_CONFIG --exists dirsec-nss; then
  74. nss_inc=`$PKG_CONFIG --cflags-only-I dirsec-nss`
  75. nss_lib=`$PKG_CONFIG --libs-only-L dirsec-nss`
  76. nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ .*$//`
  77. AC_MSG_RESULT([using system dirsec NSS])
  78. else
  79. AC_MSG_ERROR([NSS not found, specify with --with-nss.])
  80. fi
  81. fi
  82. fi