nss.m4 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # BEGIN COPYRIGHT BLOCK
  2. # Copyright (C) 2007 Red Hat, Inc.
  3. # All rights reserved.
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. #
  19. # END COPYRIGHT BLOCK
  20. AC_CHECKING(for NSS)
  21. # check for --with-nss
  22. AC_MSG_CHECKING(for --with-nss)
  23. AC_ARG_WITH(nss, AS_HELP_STRING([--with-nss@<:@=PATH@:>@],[Network Security Services (NSS) directory]),
  24. [
  25. if test "$withval" = "yes"
  26. then
  27. AC_MSG_RESULT(yes)
  28. elif test "$withval" = "no"
  29. then
  30. AC_MSG_RESULT(no)
  31. AC_MSG_ERROR([NSS is required.])
  32. elif test -e "$withval"/include/nss.h -a -d "$withval"/lib
  33. then
  34. AC_MSG_RESULT([using $withval])
  35. NSSDIR=$withval
  36. nss_inc="-I$NSSDIR/include"
  37. nss_lib="-L$NSSDIR/lib"
  38. nss_libdir="$NSSDIR/lib"
  39. else
  40. echo
  41. AC_MSG_ERROR([$withval not found])
  42. fi
  43. ],
  44. AC_MSG_RESULT(yes))
  45. # check for --with-nss-inc
  46. AC_MSG_CHECKING(for --with-nss-inc)
  47. AC_ARG_WITH(nss-inc, AS_HELP_STRING([--with-nss-inc=PATH],[Network Security Services (NSS) include directory]),
  48. [
  49. if test -e "$withval"/nss.h
  50. then
  51. AC_MSG_RESULT([using $withval])
  52. nss_inc="-I$withval"
  53. else
  54. echo
  55. AC_MSG_ERROR([$withval not found])
  56. fi
  57. ],
  58. AC_MSG_RESULT(no))
  59. # check for --with-nss-lib
  60. AC_MSG_CHECKING(for --with-nss-lib)
  61. AC_ARG_WITH(nss-lib, AS_HELP_STRING([--with-nss-lib=PATH],[Network Security Services (NSS) library directory]),
  62. [
  63. if test -d "$withval"
  64. then
  65. AC_MSG_RESULT([using $withval])
  66. nss_lib="-L$withval"
  67. nss_libdir="$withval"
  68. else
  69. echo
  70. AC_MSG_ERROR([$withval not found])
  71. fi
  72. ],
  73. AC_MSG_RESULT(no))
  74. # if NSS is not found yet, try pkg-config
  75. # last resort
  76. if test -z "$nss_inc" -o -z "$nss_lib" -o -z "$nss_libdir"; then
  77. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  78. AC_MSG_CHECKING(for nss with pkg-config)
  79. if test -n "$PKG_CONFIG"; then
  80. if $PKG_CONFIG --exists nss; then
  81. nss_inc=`$PKG_CONFIG --cflags-only-I nss`
  82. nss_lib=`$PKG_CONFIG --libs-only-L nss`
  83. nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ .*$//`
  84. AC_MSG_RESULT([using system NSS])
  85. elif $PKG_CONFIG --exists dirsec-nss; then
  86. nss_inc=`$PKG_CONFIG --cflags-only-I dirsec-nss`
  87. nss_lib=`$PKG_CONFIG --libs-only-L dirsec-nss`
  88. nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ .*$//`
  89. AC_MSG_RESULT([using system dirsec NSS])
  90. else
  91. AC_MSG_ERROR([NSS not found, specify with --with-nss.])
  92. fi
  93. fi
  94. fi