nspr.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 NSPR)
  9. # check for --with-nspr
  10. AC_MSG_CHECKING(for --with-nspr)
  11. AC_ARG_WITH(nspr, AS_HELP_STRING([--with-nspr@<:@=PATH@:>@],[Netscape Portable Runtime (NSPR) 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([NSPR is required.])
  20. elif test -e "$withval"/include/nspr.h -a -d "$withval"/lib
  21. then
  22. AC_MSG_RESULT([using $withval])
  23. NSPRDIR=$withval
  24. nspr_inc="-I$NSPRDIR/include"
  25. nspr_lib="-L$NSPRDIR/lib"
  26. nspr_libdir="$NSPRDIR/lib"
  27. else
  28. echo
  29. AC_MSG_ERROR([$withval not found])
  30. fi
  31. ],
  32. AC_MSG_RESULT(yes))
  33. # check for --with-nspr-inc
  34. AC_MSG_CHECKING(for --with-nspr-inc)
  35. AC_ARG_WITH(nspr-inc, AS_HELP_STRING([--with-nspr-inc=PATH],[Netscape Portable Runtime (NSPR) include directory]),
  36. [
  37. if test -e "$withval"/nspr.h
  38. then
  39. AC_MSG_RESULT([using $withval])
  40. nspr_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-nspr-lib
  48. AC_MSG_CHECKING(for --with-nspr-lib)
  49. AC_ARG_WITH(nspr-lib, AS_HELP_STRING([--with-nspr-lib=PATH],[Netscape Portable Runtime (NSPR) library directory]),
  50. [
  51. if test -d "$withval"
  52. then
  53. AC_MSG_RESULT([using $withval])
  54. nspr_lib="-L$withval"
  55. nspr_libdir="$withval"
  56. else
  57. echo
  58. AC_MSG_ERROR([$withval not found])
  59. fi
  60. ],
  61. AC_MSG_RESULT(no))
  62. # if NSPR is not found yet, try pkg-config
  63. # last resort
  64. if test -z "$nspr_inc" -o -z "$nspr_lib" -o -z "$nspr_libdir"; then
  65. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  66. AC_MSG_CHECKING(for nspr with pkg-config)
  67. if test -n "$PKG_CONFIG"; then
  68. if $PKG_CONFIG --exists nspr; then
  69. nspr_inc=`$PKG_CONFIG --cflags-only-I nspr`
  70. nspr_lib=`$PKG_CONFIG --libs-only-L nspr`
  71. nspr_libdir=`$PKG_CONFIG --libs-only-L nspr | sed -e s/-L// | sed -e s/\ .*$//`
  72. AC_MSG_RESULT([using system NSPR])
  73. elif $PKG_CONFIG --exists dirsec-nspr; then
  74. nspr_inc=`$PKG_CONFIG --cflags-only-I dirsec-nspr`
  75. nspr_lib=`$PKG_CONFIG --libs-only-L dirsec-nspr`
  76. nspr_libdir=`$PKG_CONFIG --libs-only-L dirsec-nspr | sed -e s/-L// | sed -e s/\ .*$//`
  77. AC_MSG_RESULT([using system dirsec NSPR])
  78. else
  79. AC_MSG_ERROR([NSPR not found, specify with --with-nspr.])
  80. fi
  81. fi
  82. fi