svrcore.m4 3.6 KB

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