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 6AC_INIT(src/rcsbase.h) 7 8# Set up simple `diff' test. 9echo 0 >conftest0 10echo 0 >conftest0c 11echo 1 >conftest1 12cat >conftestok <<'EOF' 13d1 1 14a1 1 151 16EOF 17 18AC_ARG_WITH(diffutils, 19 [ --with-diffutils assume GNU diffutils is similarly installed], 20 [with_diffutils=$withval], 21 [with_diffutils=no] 22) 23 24case $with_diffutils in 25yes) 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} 34esac 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. 39AC_SUBST(DIFF) 40AC_MSG_CHECKING([diff basename]) 41AC_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]) 59DIFF=$rcs_cv_prog_diff 60case $DIFF in 61'') AC_MSG_ERROR(cannot find RCS-compatible diff);; 62esac 63AC_MSG_RESULT($DIFF) 64AC_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. 68AC_SUBST(DIFF_SUCCESS) 69AC_MSG_CHECKING([diff success status]) 70AC_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]) 81DIFF_SUCCESS=$rcs_cv_status_diff_success 82AC_MSG_RESULT($DIFF_SUCCESS) 83# 84AC_SUBST(DIFF_FAILURE) 85AC_MSG_CHECKING([diff failure status]) 86AC_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]) 95DIFF_FAILURE=$rcs_cv_status_diff_failure 96AC_MSG_RESULT($DIFF_FAILURE) 97# 98AC_SUBST(DIFF_TROUBLE) 99AC_MSG_CHECKING([diff trouble status]) 100AC_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]) 109DIFF_TROUBLE=$rcs_cv_status_diff_trouble 110AC_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. 114AC_SUBST(DIFFFLAGS) 115AC_MSG_CHECKING([diff options for RCS]) 116AC_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]) 132DIFFFLAGS=$rcs_cv_options_diff 133AC_MSG_RESULT($DIFFFLAGS) 134 135# Set DIFF_L to 1 if diff understands the L option, 0 otherwise. 136AC_SUBST(DIFF_L) 137AC_MSG_CHECKING([diff -L]) 138AC_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 154EOF 155 then rcs_cv_options_diff_l=1 156 fi 157 ;; 158 esac 159 ;; 160 esac 161]) 162DIFF_L=$rcs_cv_options_diff_l 163case $DIFF_L in 1641) AC_MSG_RESULT(yes);; 165*) AC_MSG_RESULT(no);; 166esac 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. 170diff3PATH=$PATH:/usr/libexec 171AC_SUBST(DIFF3) 172AC_MSG_CHECKING([diff3 -m]) 173AC_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 1820 183======= 184>>>>>>> 2 185EOF 186 then rcs_cv_prog_diff3_bin=diff3 187 fi 188 ;; 189 esac 190 ;; 191 esac 192]) 193case $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 ;; 228esac 229 230AC_SUBST(DIFF3_BIN) 231case $DIFF3_BIN in 232'') 233 case $rcs_cv_prog_diff3_bin in 234 '') DIFF3_BIN=0;; 235 ?*) DIFF3_BIN=1;; 236 esac 237 ;; 238esac 239 240# Clean up simple `diff' test. 241rm -f conftest* 242 243AC_PATH_PROG(ED, ed, ed) 244 245ac_save_path=$PATH 246PATH=/usr/lib:/usr/bin:/bin:/usr/sbin:/sbin:$PATH 247AC_PATH_PROGS(SENDMAIL, sendmail mail mailx) 248PATH=$ac_save_path 249case $SENDMAIL in 250?*) SENDMAIL=\"$SENDMAIL\" 251esac 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. 256AC_CHECK_PROGS(PIC, "pic -n" "gpic -n" "pic -D" "pic", pic) 257 258AC_PROG_CC 259AC_PROG_INSTALL 260AC_PROG_MAKE_SET 261 262AC_OUTPUT(Makefile man/Makefile src/Makefile) 263