install_cdb.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #! /bin/sh
  2. # You can use this script if you want to use an external cdb lib. If you
  3. # compile php using --with-cdb the internal functions will be used and no
  4. # external library is used so that this script is not necessary.
  5. #
  6. # cdb-0.75 lacks support for installing header files and creating a
  7. # library which programs can link against. This shell script fills
  8. # the gap.
  9. if test -r "cdb.a" && test -r "auto-str.c" && test -r "byte.a"; then
  10. :
  11. else
  12. echo "Please execute this script in the cdb-0.75 source directory after 'make'"
  13. exit 1
  14. fi
  15. prefix=$1
  16. if test -z "$prefix"; then
  17. prefix=/usr/local
  18. fi
  19. echo "Using prefix $prefix"
  20. if mkdir -p "$prefix/include" "$prefix/lib"; then
  21. :
  22. else
  23. echo "Creating directories failed. Please become superuser."
  24. exit 1
  25. fi
  26. mkdir -p tmp || exit 1
  27. cd tmp
  28. ar x ../cdb.a
  29. ar x ../byte.a
  30. ar x ../unix.a
  31. ar x ../byte.a
  32. ar x ../buffer.a
  33. cp ../error.o .
  34. # not really portable
  35. ar r "$prefix/lib/libcdb.a" *
  36. ranlib "$prefix/lib/libcdb.a"
  37. cd ..
  38. rm -rf tmp
  39. cp cdb.h uint32.h "$prefix/include"
  40. echo "done"