home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / rcs57pc3.zip / rcs / configure.in < prev    next >
Text File  |  1995-06-16  |  6KB  |  263 lines

  1. # Configure template for RCS
  2. #    $Id: configure.in,v 1.2 1995/06/16 06:19:24 eggert Exp $
  3. # Copyright 1995 Paul Eggert
  4. # Process this file with autoconf to produce a configure script.
  5.  
  6. AC_INIT(src/rcsbase.h)
  7.  
  8. # Set up simple `diff' test.
  9. echo 0 >conftest0
  10. echo 0 >conftest0c
  11. echo 1 >conftest1
  12. cat >conftestok <<'EOF'
  13. d1 1
  14. a1 1
  15. 1
  16. EOF
  17.  
  18. AC_ARG_WITH(diffutils,
  19.   [  --with-diffutils        assume GNU diffutils is similarly installed],
  20.   [with_diffutils=$withval],
  21.   [with_diffutils=no]
  22. )
  23.  
  24. case $with_diffutils in
  25. yes)
  26.   : ${DIFF='$(bindir)/diff'}
  27.   : ${DIFF3=${DIFF}3}
  28.   : ${DIFF3_BIN=1}
  29.   : ${DIFFFLAGS=-an}
  30.   : ${DIFF_FAILURE=1}
  31.   : ${DIFF_L=1}
  32.   : ${DIFF_SUCCESS=0}
  33.   : ${DIFF_TROUBLE=2}
  34. esac
  35.  
  36. # Set DIFF to the name of the `diff' program to be run.
  37. # On some systems, the RCS-compatible diff program is called `rdiff';
  38. # use it if it works and `diff' doesn't.
  39. AC_SUBST(DIFF)
  40. AC_MSG_CHECKING([diff basename])
  41. AC_CACHE_VAL(rcs_cv_prog_diff, [
  42.   rcs_cv_prog_diff=$DIFF
  43.   case $rcs_cv_prog_diff in
  44.   '')
  45.     for i in diff /usr/lib/rdiff rdiff
  46.     do
  47.       sh -c "exec $i -n conftest0 conftest1" >conftestout 2>/dev/null
  48.       case $? in
  49.       1)
  50.     if cmp -s conftestok conftestout
  51.     then rcs_cv_prog_diff=$i; break
  52.     fi
  53.     ;;
  54.       esac
  55.     done
  56.     ;;
  57.   esac
  58. ])
  59. DIFF=$rcs_cv_prog_diff
  60. case $DIFF in
  61. '') AC_MSG_ERROR(cannot find RCS-compatible diff);;
  62. esac
  63. AC_MSG_RESULT($DIFF)
  64. AC_PATH_PROG(DIFF, $DIFF, $DIFF)
  65.  
  66. # Set DIFF_SUCCESS, DIFF_FAILURE, DIFF_TROUBLE to diff's exit status
  67. # when it finds no differences, some differences, or trouble.
  68. AC_SUBST(DIFF_SUCCESS)
  69. AC_MSG_CHECKING([diff success status])
  70. AC_CACHE_VAL(rcs_cv_status_diff_success, [
  71.   rcs_cv_status_diff_success=$DIFF_SUCCESS
  72.   case $rcs_cv_status_diff_success in
  73.   '')
  74.     # We can't use `$DIFF conftest0 conftest0',
  75.     # since buggy NEXTSTEP 3.0 diff silently yields exit status 2 for this.
  76.     $DIFF conftest0 conftest0c >/dev/null 2>&1
  77.     rcs_cv_status_diff_success=$?
  78.     ;;
  79.   esac
  80. ])
  81. DIFF_SUCCESS=$rcs_cv_status_diff_success
  82. AC_MSG_RESULT($DIFF_SUCCESS)
  83. #
  84. AC_SUBST(DIFF_FAILURE)
  85. AC_MSG_CHECKING([diff failure status])
  86. AC_CACHE_VAL(rcs_cv_status_diff_failure, [
  87.   rcs_cv_status_diff_failure=$DIFF_FAILURE
  88.   case $rcs_cv_status_diff_failure in
  89.   '')
  90.     $DIFF conftest0 conftest1 >/dev/null 2>&1
  91.     rcs_cv_status_diff_failure=$?
  92.     ;;
  93.   esac
  94. ])
  95. DIFF_FAILURE=$rcs_cv_status_diff_failure
  96. AC_MSG_RESULT($DIFF_FAILURE)
  97. #
  98. AC_SUBST(DIFF_TROUBLE)
  99. AC_MSG_CHECKING([diff trouble status])
  100. AC_CACHE_VAL(rcs_cv_status_diff_trouble, [
  101.   rcs_cv_status_diff_trouble=$DIFF_TROUBLE
  102.   case $rcs_cv_status_diff_trouble in
  103.   '')
  104.     $DIFF conftest0 no/such/file >/dev/null 2>&1
  105.     rcs_cv_status_diff_trouble=$?
  106.     ;;
  107.   esac
  108. ])
  109. DIFF_TROUBLE=$rcs_cv_status_diff_trouble
  110. AC_MSG_RESULT($DIFF_TROUBLE)
  111.  
  112. # Set DIFFFLAGS to the options of the `diff' program to be run.
  113. # Use -an if possible, -n otherwise.
  114. AC_SUBST(DIFFFLAGS)
  115. AC_MSG_CHECKING([diff options for RCS])
  116. AC_CACHE_VAL(rcs_cv_options_diff, [
  117.   rcs_cv_options_diff=$DIFFFLAGS
  118.   case $rcs_cv_options_diff in
  119.   '')
  120.     rcs_cv_options_diff=-n
  121.     $DIFF -an conftest0 conftest1 >conftestout 2>conftestout2
  122.     case $? in
  123.     1)
  124.       if cmp -s conftestok conftestout && test ! -s conftestout2
  125.       then rcs_cv_options_diff=-an
  126.       fi
  127.       ;;
  128.     esac
  129.     ;;
  130.   esac
  131. ])
  132. DIFFFLAGS=$rcs_cv_options_diff
  133. AC_MSG_RESULT($DIFFFLAGS)
  134.  
  135. # Set DIFF_L to 1 if diff understands the L option, 0 otherwise.
  136. AC_SUBST(DIFF_L)
  137. AC_MSG_CHECKING([diff -L])
  138. AC_CACHE_VAL(rcs_cv_options_diff_l, [
  139.   rcs_cv_options_diff_l=$DIFF_L
  140.   case $rcs_cv_options_diff_l in
  141.   '')
  142.     rcs_cv_options_diff_l=0
  143.     $DIFF -c -L 0 -L 1 conftest0 conftest1 >conftestout 2>/dev/null
  144.     case $? in
  145.     1)
  146.       if cmp -s - conftestout <<'EOF'
  147. *** 0
  148. --- 1
  149. ***************
  150. *** 1 ****
  151. ! 0
  152. --- 1 ----
  153. ! 1
  154. EOF
  155.       then rcs_cv_options_diff_l=1
  156.       fi
  157.       ;;
  158.     esac
  159.     ;;
  160.   esac
  161. ])
  162. DIFF_L=$rcs_cv_options_diff_l
  163. case $DIFF_L in
  164. 1) AC_MSG_RESULT(yes);;
  165. *) AC_MSG_RESULT(no);;
  166. esac
  167.  
  168. # Set DIFF3 to the name of the diff3 program.
  169. # In some systems (e.g. BSD/OS 2.0), diffutils diff3 lives in /usr/libexec.
  170. diff3PATH=$PATH:/usr/libexec
  171. AC_SUBST(DIFF3)
  172. AC_MSG_CHECKING([diff3 -m])
  173. AC_CACHE_VAL(rcs_cv_prog_diff3_bin, [
  174.   rcs_cv_prog_diff3_bin=$DIFF3
  175.   case $rcs_cv_prog_diff3_bin in
  176.   '')
  177.     PATH=$diff3PATH sh -c "exec diff3 -E -m -L 0 -L 1 -L 2 conftest0 conftest1 /dev/null" >conftestout 2>/dev/null
  178.     case $? in
  179.     1)
  180.       if cmp -s - conftestout <<'EOF'
  181. <<<<<<< 0
  182. 0
  183. =======
  184. >>>>>>> 2
  185. EOF
  186.       then rcs_cv_prog_diff3_bin=diff3
  187.       fi
  188.       ;;
  189.     esac
  190.   ;;
  191.   esac
  192. ])
  193. case $rcs_cv_prog_diff3_bin in
  194. ?*)
  195.   AC_MSG_RESULT(yes)
  196.   ac_save_path=$PATH
  197.   PATH=$diff3PATH
  198.   AC_PATH_PROG(DIFF3, $rcs_cv_prog_diff3_bin, $rcs_cv_prog_diff3_bin)
  199.   PATH=$ac_save_path
  200.   ;;
  201. '')
  202.   AC_MSG_RESULT(no)
  203.   AC_MSG_CHECKING([diff3 library program])
  204.   dnl We can't use AC_PATH_PROG since we don't want to inspect /bin,
  205.   dnl and AC_PATH_PROG uses `test'.
  206.   AC_CACHE_VAL(rcs_cv_path_diff3_lib, [
  207.     $DIFF conftest0 conftest1 >conftest01
  208.     $DIFF /dev/null conftest1 >conftestn1
  209.     for i in /usr/*lib*/*diff3*; do
  210.       sh -c "exec $i -E conftest01 conftestn1 conftest0 /dev/null conftest1" >conftestout 2>/dev/null
  211.       # The exit status is arbitrary!  Test the output a bit.
  212.       if
  213.     grep '^<<* *conftest0$' conftestout >/dev/null 2>&1 &&
  214.     grep '^>>* *conftest1$' conftestout >/dev/null 2>&1 &&
  215.     grep '^0a$' conftestout >/dev/null 2>&1
  216.       then
  217.     rcs_cv_path_diff3_lib=$i
  218.     break
  219.       fi
  220.     done
  221.   ])
  222.   DIFF3=$rcs_cv_path_diff3_lib
  223.   case $DIFF3 in
  224.   '') AC_MSG_ERROR(cannot find a working diff3 library program);;
  225.   ?*) AC_MSG_RESULT($DIFF3);;
  226.   esac
  227.   ;;
  228. esac
  229.  
  230. AC_SUBST(DIFF3_BIN)
  231. case $DIFF3_BIN in
  232. '')
  233.   case $rcs_cv_prog_diff3_bin in
  234.   '') DIFF3_BIN=0;;
  235.   ?*) DIFF3_BIN=1;;
  236.   esac
  237.   ;;
  238. esac
  239.  
  240. # Clean up simple `diff' test.
  241. rm -f conftest*
  242.  
  243. AC_PATH_PROG(ED, ed, ed)
  244.  
  245. ac_save_path=$PATH
  246. PATH=/usr/lib:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
  247. AC_PATH_PROGS(SENDMAIL, sendmail mail mailx)
  248. PATH=$ac_save_path
  249. case $SENDMAIL in
  250. ?*) SENDMAIL=\"$SENDMAIL\"
  251. esac
  252.  
  253. # Use the GNU pic -n option if available; it avoids GNU extensions,
  254. # which is need for proper operation to generate a portable man page.
  255. # Similarly, if using traditional pic, use its -D option.
  256. AC_CHECK_PROGS(PIC, "pic -n" "gpic -n" "pic -D" "pic", pic)
  257.  
  258. AC_PROG_CC
  259. AC_PROG_INSTALL
  260. AC_PROG_MAKE_SET
  261.  
  262. AC_OUTPUT(Makefile man/Makefile src/Makefile)
  263.