pod2mantest 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # This script is used by test/Makefile to check whether a sane 'pod2man'
  3. # is installed.
  4. # ('make install' should not try to run 'pod2man' if it does not exist or if
  5. # it is a broken 'pod2man' version that is known to cause trouble. if we find
  6. # the system 'pod2man' to be broken, we use our own copy instead)
  7. #
  8. # In any case, output an appropriate command line for running (or not
  9. # running) pod2man.
  10. IFS=:
  11. if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi
  12. try_without_dir=true
  13. # First we try "pod2man", then "$dir/pod2man" for each item in $PATH.
  14. for dir in dummy${IFS}$PATH; do
  15. if [ "$try_without_dir" = true ]; then
  16. # first iteration
  17. pod2man=pod2man
  18. try_without_dir=false
  19. else
  20. # second and later iterations
  21. pod2man="$dir/pod2man"
  22. if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix
  23. pod2man=''
  24. fi
  25. fi
  26. if [ ! "$pod2man" = '' ]; then
  27. failure=none
  28. if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then
  29. :
  30. else
  31. failure=BasicTest
  32. fi
  33. if [ "$failure" = none ]; then
  34. if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then
  35. failure=MultilineTest
  36. fi
  37. fi
  38. if [ "$failure" = none ]; then
  39. echo "$pod2man"
  40. exit 0
  41. fi
  42. echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2
  43. fi
  44. done
  45. echo "No working pod2man found. Consider installing a new version." >&2
  46. echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2
  47. echo "$1 ../../util/pod2man.pl"