mozldap.m4 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 LDAPSDK)
  21. # check for --with-ldapsdk
  22. AC_MSG_CHECKING(for --with-ldapsdk)
  23. AC_ARG_WITH(ldapsdk, [ --with-ldapsdk=PATH Mozilla LDAP SDK directory],
  24. [
  25. if test -e "$withval"/include/ldap.h -a -d "$withval"/lib
  26. then
  27. AC_MSG_RESULT([using $withval])
  28. LDAPSDKDIR=$withval
  29. ldapsdk_inc="-I$LDAPSDKDIR/include"
  30. ldapsdk_lib="-L$LDAPSDKDIR/lib"
  31. ldapsdk_libdir="$LDAPSDKDIR/lib"
  32. ldapsdk_bindir="$LDAPSDKDIR/bin"
  33. else
  34. echo
  35. AC_MSG_ERROR([$withval not found])
  36. fi
  37. ],
  38. AC_MSG_RESULT(no))
  39. # check for --with-ldapsdk-inc
  40. AC_MSG_CHECKING(for --with-ldapsdk-inc)
  41. AC_ARG_WITH(ldapsdk-inc, [ --with-ldapsdk-inc=PATH Mozilla LDAP SDK include directory],
  42. [
  43. if test -e "$withval"/ldap.h
  44. then
  45. AC_MSG_RESULT([using $withval])
  46. ldapsdk_inc="-I$withval"
  47. else
  48. echo
  49. AC_MSG_ERROR([$withval not found])
  50. fi
  51. ],
  52. AC_MSG_RESULT(no))
  53. # check for --with-ldapsdk-lib
  54. AC_MSG_CHECKING(for --with-ldapsdk-lib)
  55. AC_ARG_WITH(ldapsdk-lib, [ --with-ldapsdk-lib=PATH Mozilla LDAP SDK library directory],
  56. [
  57. if test -d "$withval"
  58. then
  59. AC_MSG_RESULT([using $withval])
  60. ldapsdk_lib="-L$withval"
  61. ldapsdk_libdir="$withval"
  62. else
  63. echo
  64. AC_MSG_ERROR([$withval not found])
  65. fi
  66. ],
  67. AC_MSG_RESULT(no))
  68. # check for --with-ldapsdk-bin
  69. AC_MSG_CHECKING(for --with-ldapsdk-bin)
  70. AC_ARG_WITH(ldapsdk-bin, [ --with-ldapsdk-bin=PATH Mozilla LDAP SDK binary directory],
  71. [
  72. if test -d "$withval"
  73. then
  74. AC_MSG_RESULT([using $withval])
  75. ldapsdk_bindir="$withval"
  76. else
  77. echo
  78. AC_MSG_ERROR([$withval not found])
  79. fi
  80. ],
  81. AC_MSG_RESULT(no))
  82. # if LDAPSDK is not found yet, try pkg-config
  83. # last resort
  84. if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib" -o -z "$ldapsdk_libdir" -o -z "$ldapsdk_bindir"; then
  85. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  86. AC_MSG_CHECKING(for mozldap with pkg-config)
  87. if test -n "$PKG_CONFIG"; then
  88. if $PKG_CONFIG --exists mozldap6; then
  89. mozldappkg=mozldap6
  90. elif $PKG_CONFIG --exists mozldap; then
  91. mozldappkg=mozldap
  92. else
  93. AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib|-bin].])
  94. fi
  95. ldapsdk_inc=`$PKG_CONFIG --cflags-only-I $mozldappkg`
  96. ldapsdk_lib=`$PKG_CONFIG --libs-only-L $mozldappkg`
  97. ldapsdk_libdir=`$PKG_CONFIG --libs-only-L $mozldappkg | sed -e s/-L// | sed -e s/\ .*$//`
  98. ldapsdk_bindir=`$PKG_CONFIG --variable=bindir $mozldappkg`
  99. AC_MSG_RESULT([using system $mozldappkg])
  100. fi
  101. fi
  102. if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib"; then
  103. AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib|-bin].])
  104. fi
  105. dnl default path for the ldap c sdk tools (see [210947] for more details)
  106. if test -z "$ldapsdk_bindir" ; then
  107. if [ -d $libdir/mozldap6 ] ; then
  108. ldapsdk_bindir=$libdir/mozldap6
  109. else
  110. ldapsdk_bindir=$libdir/mozldap
  111. fi
  112. fi
  113. dnl make sure the ldap sdk version is 6 or greater - we do not support
  114. dnl the old 5.x or prior versions - the ldap server code expects the new
  115. dnl ber types and other code used with version 6
  116. save_cppflags="$CPPFLAGS"
  117. CPPFLAGS="$ldapsdk_inc $nss_inc $nspr_inc"
  118. AC_CHECK_HEADER([ldap.h], [isversion6=1], [isversion6=],
  119. [#include <ldap-standard.h>
  120. #if LDAP_VENDOR_VERSION < 600
  121. #error The LDAP C SDK version is not supported
  122. #endif
  123. ])
  124. CPPFLAGS="$save_cppflags"
  125. if test -z "$isversion6" ; then
  126. AC_MSG_ERROR([The LDAPSDK version in $ldapsdk_inc/ldap-standard.h is not supported])
  127. fi