nss.m4 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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, [ --with-nss=PATH Network Security Services (NSS) directory],
  24. [
  25. if test -e "$withval"/include/nss.h -a -d "$withval"/lib
  26. then
  27. AC_MSG_RESULT([using $withval])
  28. NSSDIR=$withval
  29. nss_inc="-I$NSSDIR/include"
  30. nss_lib="-L$NSSDIR/lib"
  31. nss_libdir="$NSSDIR/lib"
  32. else
  33. echo
  34. AC_MSG_ERROR([$withval not found])
  35. fi
  36. ],
  37. AC_MSG_RESULT(no))
  38. # check for --with-nss-inc
  39. AC_MSG_CHECKING(for --with-nss-inc)
  40. AC_ARG_WITH(nss-inc, [ --with-nss-inc=PATH Network Security Services (NSS) include directory],
  41. [
  42. if test -e "$withval"/nss.h
  43. then
  44. AC_MSG_RESULT([using $withval])
  45. nss_inc="-I$withval"
  46. else
  47. echo
  48. AC_MSG_ERROR([$withval not found])
  49. fi
  50. ],
  51. AC_MSG_RESULT(no))
  52. # check for --with-nss-lib
  53. AC_MSG_CHECKING(for --with-nss-lib)
  54. AC_ARG_WITH(nss-lib, [ --with-nss-lib=PATH Network Security Services (NSS) library directory],
  55. [
  56. if test -d "$withval"
  57. then
  58. AC_MSG_RESULT([using $withval])
  59. nss_lib="-L$withval"
  60. nss_libdir="$withval"
  61. else
  62. echo
  63. AC_MSG_ERROR([$withval not found])
  64. fi
  65. ],
  66. AC_MSG_RESULT(no))
  67. # if NSS is not found yet, try pkg-config
  68. # last resort
  69. if test -z "$nss_inc" -o -z "$nss_lib" -o -z "$nss_libdir"; then
  70. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  71. AC_MSG_CHECKING(for nss with pkg-config)
  72. if test -n "$PKG_CONFIG"; then
  73. if $PKG_CONFIG --exists nss; then
  74. nss_inc=`$PKG_CONFIG --cflags-only-I nss`
  75. nss_lib=`$PKG_CONFIG --libs-only-L nss`
  76. nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ .*$//`
  77. AC_MSG_RESULT([using system NSS])
  78. elif $PKG_CONFIG --exists dirsec-nss; then
  79. nss_inc=`$PKG_CONFIG --cflags-only-I dirsec-nss`
  80. nss_lib=`$PKG_CONFIG --libs-only-L dirsec-nss`
  81. nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ .*$//`
  82. AC_MSG_RESULT([using system dirsec NSS])
  83. else
  84. AC_MSG_ERROR([NSS not found, specify with --with-nss.])
  85. fi
  86. fi
  87. fi