svrcore.m4 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #
  9. # Configure paths for SVRCORE
  10. AC_CHECKING(for SVRCORE)
  11. AC_MSG_CHECKING(for --with-svrcore)
  12. AC_ARG_WITH(svrcore,
  13. AS_HELP_STRING([--with-svrcore@<:@=PATH@:>@],[Use system installed SVRCORE - optional path for SVRCORE]),
  14. dnl = Look in the standard system locations
  15. [
  16. if test "$withval" = "yes"; then
  17. AC_MSG_RESULT(yes)
  18. elif test "$withval" = "no"; then
  19. AC_MSG_RESULT(no)
  20. AC_MSG_ERROR([SVRCORE is required.])
  21. dnl = Check the user provided location
  22. elif test -d "$withval" -a -d "$withval/lib" -a -d "$withval/include" ; then
  23. AC_MSG_RESULT([using $withval])
  24. if test -f "$withval/include/svrcore.h"; then
  25. svrcore_inc="-I$withval/include"
  26. else
  27. AC_MSG_ERROR(svrcore.h not found)
  28. fi
  29. svrcore_lib="-L$withval/lib"
  30. else
  31. AC_MSG_RESULT(yes)
  32. AC_MSG_ERROR([SVRCORE not found in $withval])
  33. fi
  34. ],
  35. AC_MSG_RESULT(yes))
  36. AC_MSG_CHECKING(for --with-svrcore-inc)
  37. AC_ARG_WITH(svrcore-inc,
  38. AS_HELP_STRING([--with-svrcore-inc=PATH],[SVRCORE include file directory]),
  39. [
  40. if test -f "$withval"/svrcore.h; then
  41. AC_MSG_RESULT([using $withval])
  42. svrcore_inc="-I$withval"
  43. else
  44. echo
  45. AC_MSG_ERROR([$withval/svrcore.h not found])
  46. fi
  47. ],
  48. AC_MSG_RESULT(no))
  49. AC_MSG_CHECKING(for --with-svrcore-lib)
  50. AC_ARG_WITH(svrcore-lib,
  51. AS_HELP_STRING([--with-svrcore-lib=PATH],[SVRCORE library directory]),
  52. [
  53. if test -d "$withval"; then
  54. AC_MSG_RESULT([using $withval])
  55. svrcore_lib="-L$withval"
  56. else
  57. echo
  58. AC_MSG_ERROR([$withval not found])
  59. fi
  60. ],
  61. AC_MSG_RESULT(no))
  62. dnl svrcore not given - look for pkg-config
  63. if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
  64. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  65. AC_MSG_CHECKING(for SVRCORE with pkg-config)
  66. if test -n "$PKG_CONFIG"; then
  67. if $PKG_CONFIG --exists svrcore; then
  68. svrcore_inc=`$PKG_CONFIG --cflags-only-I svrcore`
  69. svrcore_lib=`$PKG_CONFIG --libs-only-L svrcore`
  70. AC_MSG_RESULT([using system svrcore])
  71. fi
  72. fi
  73. fi
  74. if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
  75. dnl just see if SVRCORE is already a system library
  76. AC_CHECK_LIB([svrcore], [SVRCORE_GetRegisteredPinObj], [havesvrcore=1],
  77. [], [$nss_inc $nspr_inc $nss_lib -lnss3 -lsoftokn3 $nspr_lib -lplds4 -lplc4 -lnspr4])
  78. if test -n "$havesvrcore" ; then
  79. dnl just see if SVRCORE is already a system header file
  80. save_cppflags="$CPPFLAGS"
  81. CPPFLAGS="$nss_inc $nspr_inc"
  82. AC_CHECK_HEADER([svrcore.h], [havesvrcore=1], [havesvrcore=])
  83. CPPFLAGS="$save_cppflags"
  84. fi
  85. dnl for SVRCORE to be present, both the library and the header must exist
  86. if test -z "$havesvrcore" ; then
  87. AC_MSG_ERROR([SVRCORE not found, specify with --with-svrcore.])
  88. fi
  89. fi
  90. dnl = Check for svrcore.h in the normal locations
  91. if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
  92. if test -f /usr/include/svrcore.h; then
  93. svrcore_inc="-I/usr/include"
  94. svrcore_lib="-L/usr/lib"
  95. else
  96. AC_MSG_ERROR([SVRCORE not found, specify with --with-svrcore.])
  97. fi
  98. fi