home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / pine4.10.tar.gz / pine4.10.tar / pine4.10 / contrib / ldap-setup < prev   
Text File  |  1999-01-25  |  8KB  |  231 lines

  1. #!/bin/sh
  2. #
  3. # $Id: ldap-setup,v 1.10 1999/01/25 20:07:54 hubert Exp $
  4. #
  5. #            T H E    P I N E    M A I L   S Y S T E M
  6. #
  7. #   Laurence Lundblade and Mike Seibel
  8. #   Networks and Distributed Computing
  9. #   Computing and Communications
  10. #   University of Washington
  11. #   Administration Building, AG-44
  12. #   Seattle, Washington, 98195, USA
  13. #   Internet: lgl@CAC.Washington.EDU
  14. #             mikes@CAC.Washington.EDU
  15. #
  16. #   Please address all bugs and comments to "pine-bugs@cac.washington.edu"
  17. #
  18. #
  19. #   Pine and Pico are registered trademarks of the University of Washington.
  20. #   No commercial use of these trademarks may be made without prior written
  21. #   permission of the University of Washington.
  22. #
  23. #   Pine, Pico, and Pilot software and its included text are Copyright
  24. #   1989-1998 by the University of Washington.
  25. #
  26. #   The full text of our legal notices is contained in the file called
  27. #   CPYRIGHT, included with this distribution.
  28. #
  29. #
  30. #   Pine is in part based on The Elm Mail System:
  31. #    ***********************************************************************
  32. #    *  The Elm Mail System  -  Revision: 2.13                             *
  33. #    *                                                                     *
  34. #    *             Copyright (c) 1986, 1987 Dave Taylor               *
  35. #    *             Copyright (c) 1988, 1989 USENET Community Trust    *
  36. #    ***********************************************************************
  37. #
  38.  
  39.  
  40. #
  41. #  Helper script for setting up LDAP
  42. #
  43. # Pine has been successfully compiled with the University of Michigan
  44. # LDAP source (ldap-3.3) and with the Netscape Directory SDK 1.0.
  45. #
  46. # The setup for use with the Univ. of Michigan source is as follows.
  47. # Put a symlink called "ldap" to the University of Michigan LDAP source
  48. # (ldap-3.3) in the top-level pine directory, where the pine build script
  49. # is located. The script you are reading is called by the "build" script
  50. # in that same top-level directory. If you haven't previously compiled the
  51. # LDAP library this ldap-setup script may be able to give you a small amount
  52. # of help in the form of a hint. Try setting up the symlink to the source
  53. # and then type the "build <target>" command. The script will try to figure
  54. # out the command you need to use to compile the LDAP library.
  55. #
  56. # The setup for use with the Netscape SDK is as follows. Make a directory
  57. # called ldap in the same place where the "build" script is located.
  58. # That directory should have subdirs "libraries" and "include". "Include"
  59. # is where ldap.h and friends from the Netscape SDK should go, and "libraries"
  60. # should contain libldap.a.
  61. #
  62. # And there is also the SDK from mozilla.org. It is based on the Netscape
  63. # SDK but for some reason has reverted to the Michigan style of having
  64. # two separate libraries. The setup for mozilla is the same as for
  65. # the Netscape SDK with ldap/include and ldap/libraries. This script will
  66. # look for liblber.a and exit with return value 1 if it finds it.
  67. #
  68. # And there is also OpenLDAP. As of version 1.0, it looks just like the
  69. # Michigan setup so no changes here for it. Set it up just like you
  70. # would set up umich.
  71. #
  72. # The build script is looking for an exit value of either 1 or 2 from this
  73. # script. 1 means this is a UMICH-style setup (with liblber.a) and 2 means
  74. # there is no liblber.a, just libldap.a. Anything else is an error. This
  75. # script won't be called unless there is an ldap directory next to build.
  76. #
  77.  
  78. exitval=0
  79. ptarget=xxx
  80. btarget=xxx
  81. if [ $# != "2" ]
  82. then
  83.     echo "Usage: contrib/ldap-setup pinetarget buildtarget"
  84.     exit 5
  85. fi
  86.  
  87. ptarget=$1
  88. btarget=$2
  89.  
  90. if [ ! -d ldap ]
  91. then
  92.     exitval=5
  93. elif [ ! -d ldap/libraries ]
  94. then
  95.     echo "Ldap-setup: Expected directory \"ldap/libraries\" is missing."
  96.     exitval=5
  97. elif [ ! -d ldap/include ]
  98. then
  99.     echo "Ldap-setup: Expected directory \"ldap/include\" is missing."
  100.     exitval=5
  101. elif [ ! -f ldap/include/ldap.h ]
  102. then
  103.     echo "Ldap-setup: Expected file \"ldap/include/ldap.h\" is missing."
  104.     exitval=5
  105. fi
  106.  
  107.  
  108. # Figure out if this is the Umich ldap-3.3 tree or something else, like
  109. # the Netscape SDK. Style 1 is umich, style 2 is Netscape SDK, style 3 is
  110. # mozilla.org.
  111. style=2
  112. if [ $exitval -eq 0 -a -d ldap/libraries/liblber ]
  113. then
  114.     style=1
  115. fi
  116.  
  117. if [ $exitval -eq 0 -a \( $style -eq 2 -a -f ldap/libraries/liblber.a -a -f ldap/libraries/libldap.a \) ]
  118. then
  119.     style=3
  120. fi
  121.  
  122. # This is a successful exit. The value of style tells build whether to include
  123. # the liblber.a library or not.
  124. if [ $exitval -eq 0 -a \( \( $style -eq 1 -a -f ldap/libraries/liblber.a -a -f ldap/libraries/libldap.a \) -o \( $style -eq 2 -a -f ldap/libraries/libldap.a \) -o \( $style -eq 3 \) \) ]
  125. then
  126.     if [ $style -eq 3 ]
  127.     then
  128.       exit 1
  129.     fi
  130.  
  131.     exit $style
  132. fi
  133.  
  134. if [ $exitval -eq 5 ]
  135. then
  136.     echo "Read the file contrib/ldap-setup for some help in setting"
  137.     echo "up LDAP."
  138.     exit 5
  139. fi
  140.  
  141. if [ $style -eq 1 ]
  142. then
  143. #
  144. # Not all of these have been tried.
  145. #
  146. ldaptarget=unknown
  147. case "$ptarget"
  148. in
  149.     a32) ldaptarget=aix-cc ;;
  150.     a41) ldaptarget=aix-cc ;;
  151.     bsf) ldaptarget=freebsd-gcc ;;
  152.     gh9) ldaptarget=hpux-gcc ;;
  153.     ghp) ldaptarget=hpux-gcc ;;
  154.     gs4) ldaptarget=sunos5-gcc ;;
  155.     gs5) ldaptarget=sunos5-gcc ;;
  156.     gsu) ldaptarget=sunos4-gcc ;;
  157.     gul) ldaptarget=ultrix-gcc ;;
  158.     hpp) ldaptarget=hpux-cc ;;
  159.     hpx) ldaptarget=hpux-cc ;;
  160.     hxd) ldaptarget=hpux-cc ;;
  161.     lnx) ldaptarget=linux-gcc ;;
  162.     neb) ldaptarget=netbsd-cc ;;
  163.     nxt) ldaptarget=nextstep-cc ;;
  164.     os4) ldaptarget=osf1-cc ;;
  165.     osf) ldaptarget=osf1-cc ;;
  166.     s40) ldaptarget=sunos4-cc ;;
  167.     sc5) ldaptarget=sco-cc ;;
  168.     sco) ldaptarget=sco-cc ;;
  169.     sgi) ldaptarget=irix-cc ;;
  170.     shp) ldaptarget=hpux-cc ;;
  171.     slx) ldaptarget=linux-gcc ;;
  172.     sl5) ldaptarget=linux-gcc ;;
  173.     so4) ldaptarget=sunos5-cc ;;
  174.     so5) ldaptarget=sunos5-cc ;;
  175.     sos) ldaptarget=osf1-cc ;;
  176.     ssn) ldaptarget=sunos4-cc ;;
  177.     sun) ldaptarget=sunos4-cc ;;
  178.     sv4) ldaptarget=ncr-mp-ras-2-cc ;;
  179.     ult) ldaptarget=ultrix-cc ;;
  180. esac
  181.  
  182. if [ ! -f ldap/libraries/liblber.a -a ! -f ldap/libraries/libldap.a ]
  183. then
  184.     echo "The LDAP libraries \"ldap/libraries/liblber.a\" and"
  185.     echo "\"ldap/libraries/libldap.a\" don't appear to be built yet."
  186. elif [ ! -f ldap/libraries/liblber.a ]
  187. then
  188.     echo "The LDAP library \"ldap/libraries/liblber.a\""
  189.     echo "doesn't appear to be built yet."
  190. else
  191.     echo "The LDAP library \"ldap/libraries/libldap.a\""
  192.     echo "doesn't appear to be built yet."
  193. fi
  194.  
  195. if [ "$ldaptarget" = unknown ]
  196. then
  197.     echo "Can't figure out which LDAP port to use for pine target \"$ptarget\"."
  198.     echo "If you are able to figure out the target the following cmds may work."
  199.     ldaptarget='<target_name>'
  200. else
  201.     echo "The following commands may work for you."
  202. fi
  203.  
  204. echo "Be sure you are working on a copy of the LDAP source before trying this."
  205. echo ""
  206. echo "  cd ldap/build/platforms/$ldaptarget"
  207. echo "  make platform"
  208. echo "  make"
  209. echo ""
  210. echo "After you've successfully built the libraries \"liblber.a\" and"
  211. echo "\"libldap.a\" you may try the \"build $btarget\" command again."
  212. echo ""
  213. echo "Only those two libraries are used by pine. The rest of the ldap make"
  214. echo "doesn't have to succeed for pine to build successfully."
  215. echo "In order to build pine without LDAP functionality you may rename or"
  216. echo "remove the directory \"ldap\" and run the \"build $btarget\" command again."
  217.  
  218. else
  219.  
  220. # Come here if style is 2, which means we're trying to use the non-UMICH
  221. # setup which doesn't include a liblber.a.
  222. if [ ! -f ldap/libraries/libldap.a ]
  223. then
  224.     echo "The LDAP library \"ldap/libraries/libldap.a\""
  225.     echo "is missing."
  226. fi
  227.  
  228. fi
  229. exit 5
  230.