summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/rcs/configure.in
blob: e1e18ac66b8a3fcdc8bb081fe3469cc21ab45270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# Configure template for RCS
#	$Id: configure.in,v 1.1 1996/08/12 04:07:37 millert Exp $
# Copyright 1995 Paul Eggert
# Process this file with autoconf to produce a configure script.

AC_INIT(src/rcsbase.h)

# Set up simple `diff' test.
echo 0 >conftest0
echo 0 >conftest0c
echo 1 >conftest1
cat >conftestok <<'EOF'
d1 1
a1 1
1
EOF

AC_ARG_WITH(diffutils,
  [  --with-diffutils        assume GNU diffutils is similarly installed],
  [with_diffutils=$withval],
  [with_diffutils=no]
)

case $with_diffutils in
yes)
  : ${DIFF='$(bindir)/diff'}
  : ${DIFF3=${DIFF}3}
  : ${DIFF3_BIN=1}
  : ${DIFFFLAGS=-an}
  : ${DIFF_FAILURE=1}
  : ${DIFF_L=1}
  : ${DIFF_SUCCESS=0}
  : ${DIFF_TROUBLE=2}
esac

# Set DIFF to the name of the `diff' program to be run.
# On some systems, the RCS-compatible diff program is called `rdiff';
# use it if it works and `diff' doesn't.
AC_SUBST(DIFF)
AC_MSG_CHECKING([diff basename])
AC_CACHE_VAL(rcs_cv_prog_diff, [
  rcs_cv_prog_diff=$DIFF
  case $rcs_cv_prog_diff in
  '')
    for i in diff /usr/lib/rdiff rdiff
    do
      sh -c "exec $i -n conftest0 conftest1" >conftestout 2>/dev/null
      case $? in
      1)
	if cmp -s conftestok conftestout
	then rcs_cv_prog_diff=$i; break
	fi
	;;
      esac
    done
    ;;
  esac
])
DIFF=$rcs_cv_prog_diff
case $DIFF in
'') AC_MSG_ERROR(cannot find RCS-compatible diff);;
esac
AC_MSG_RESULT($DIFF)
AC_PATH_PROG(DIFF, $DIFF, $DIFF)

# Set DIFF_SUCCESS, DIFF_FAILURE, DIFF_TROUBLE to diff's exit status
# when it finds no differences, some differences, or trouble.
AC_SUBST(DIFF_SUCCESS)
AC_MSG_CHECKING([diff success status])
AC_CACHE_VAL(rcs_cv_status_diff_success, [
  rcs_cv_status_diff_success=$DIFF_SUCCESS
  case $rcs_cv_status_diff_success in
  '')
    # We can't use `$DIFF conftest0 conftest0',
    # since buggy NEXTSTEP 3.0 diff silently yields exit status 2 for this.
    $DIFF conftest0 conftest0c >/dev/null 2>&1
    rcs_cv_status_diff_success=$?
    ;;
  esac
])
DIFF_SUCCESS=$rcs_cv_status_diff_success
AC_MSG_RESULT($DIFF_SUCCESS)
#
AC_SUBST(DIFF_FAILURE)
AC_MSG_CHECKING([diff failure status])
AC_CACHE_VAL(rcs_cv_status_diff_failure, [
  rcs_cv_status_diff_failure=$DIFF_FAILURE
  case $rcs_cv_status_diff_failure in
  '')
    $DIFF conftest0 conftest1 >/dev/null 2>&1
    rcs_cv_status_diff_failure=$?
    ;;
  esac
])
DIFF_FAILURE=$rcs_cv_status_diff_failure
AC_MSG_RESULT($DIFF_FAILURE)
#
AC_SUBST(DIFF_TROUBLE)
AC_MSG_CHECKING([diff trouble status])
AC_CACHE_VAL(rcs_cv_status_diff_trouble, [
  rcs_cv_status_diff_trouble=$DIFF_TROUBLE
  case $rcs_cv_status_diff_trouble in
  '')
    $DIFF conftest0 no/such/file >/dev/null 2>&1
    rcs_cv_status_diff_trouble=$?
    ;;
  esac
])
DIFF_TROUBLE=$rcs_cv_status_diff_trouble
AC_MSG_RESULT($DIFF_TROUBLE)

# Set DIFFFLAGS to the options of the `diff' program to be run.
# Use -an if possible, -n otherwise.
AC_SUBST(DIFFFLAGS)
AC_MSG_CHECKING([diff options for RCS])
AC_CACHE_VAL(rcs_cv_options_diff, [
  rcs_cv_options_diff=$DIFFFLAGS
  case $rcs_cv_options_diff in
  '')
    rcs_cv_options_diff=-n
    $DIFF -an conftest0 conftest1 >conftestout 2>conftestout2
    case $? in
    1)
      if cmp -s conftestok conftestout && test ! -s conftestout2
      then rcs_cv_options_diff=-an
      fi
      ;;
    esac
    ;;
  esac
])
DIFFFLAGS=$rcs_cv_options_diff
AC_MSG_RESULT($DIFFFLAGS)

# Set DIFF_L to 1 if diff understands the L option, 0 otherwise.
AC_SUBST(DIFF_L)
AC_MSG_CHECKING([diff -L])
AC_CACHE_VAL(rcs_cv_options_diff_l, [
  rcs_cv_options_diff_l=$DIFF_L
  case $rcs_cv_options_diff_l in
  '')
    rcs_cv_options_diff_l=0
    $DIFF -c -L 0 -L 1 conftest0 conftest1 >conftestout 2>/dev/null
    case $? in
    1)
      if cmp -s - conftestout <<'EOF'
*** 0
--- 1
***************
*** 1 ****
! 0
--- 1 ----
! 1
EOF
      then rcs_cv_options_diff_l=1
      fi
      ;;
    esac
    ;;
  esac
])
DIFF_L=$rcs_cv_options_diff_l
case $DIFF_L in
1) AC_MSG_RESULT(yes);;
*) AC_MSG_RESULT(no);;
esac

# Set DIFF3 to the name of the diff3 program.
# In some systems (e.g. BSD/OS 2.0), diffutils diff3 lives in /usr/libexec.
diff3PATH=$PATH:/usr/libexec
AC_SUBST(DIFF3)
AC_MSG_CHECKING([diff3 -m])
AC_CACHE_VAL(rcs_cv_prog_diff3_bin, [
  rcs_cv_prog_diff3_bin=$DIFF3
  case $rcs_cv_prog_diff3_bin in
  '')
    PATH=$diff3PATH sh -c "exec diff3 -E -m -L 0 -L 1 -L 2 conftest0 conftest1 /dev/null" >conftestout 2>/dev/null
    case $? in
    1)
      if cmp -s - conftestout <<'EOF'
<<<<<<< 0
0
=======
>>>>>>> 2
EOF
      then rcs_cv_prog_diff3_bin=diff3
      fi
      ;;
    esac
  ;;
  esac
])
case $rcs_cv_prog_diff3_bin in
?*)
  AC_MSG_RESULT(yes)
  ac_save_path=$PATH
  PATH=$diff3PATH
  AC_PATH_PROG(DIFF3, $rcs_cv_prog_diff3_bin, $rcs_cv_prog_diff3_bin)
  PATH=$ac_save_path
  ;;
'')
  AC_MSG_RESULT(no)
  AC_MSG_CHECKING([diff3 library program])
  dnl We can't use AC_PATH_PROG since we don't want to inspect /bin,
  dnl and AC_PATH_PROG uses `test'.
  AC_CACHE_VAL(rcs_cv_path_diff3_lib, [
    $DIFF conftest0 conftest1 >conftest01
    $DIFF /dev/null conftest1 >conftestn1
    for i in /usr/*lib*/*diff3*; do
      sh -c "exec $i -E conftest01 conftestn1 conftest0 /dev/null conftest1" >conftestout 2>/dev/null
      # The exit status is arbitrary!  Test the output a bit.
      if
	grep '^<<* *conftest0$' conftestout >/dev/null 2>&1 &&
	grep '^>>* *conftest1$' conftestout >/dev/null 2>&1 &&
	grep '^0a$' conftestout >/dev/null 2>&1
      then
	rcs_cv_path_diff3_lib=$i
	break
      fi
    done
  ])
  DIFF3=$rcs_cv_path_diff3_lib
  case $DIFF3 in
  '') AC_MSG_ERROR(cannot find a working diff3 library program);;
  ?*) AC_MSG_RESULT($DIFF3);;
  esac
  ;;
esac

AC_SUBST(DIFF3_BIN)
case $DIFF3_BIN in
'')
  case $rcs_cv_prog_diff3_bin in
  '') DIFF3_BIN=0;;
  ?*) DIFF3_BIN=1;;
  esac
  ;;
esac

# Clean up simple `diff' test.
rm -f conftest*

AC_PATH_PROG(ED, ed, ed)

ac_save_path=$PATH
PATH=/usr/lib:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
AC_PATH_PROGS(SENDMAIL, sendmail mail mailx)
PATH=$ac_save_path
case $SENDMAIL in
?*) SENDMAIL=\"$SENDMAIL\"
esac

# Use the GNU pic -n option if available; it avoids GNU extensions,
# which is need for proper operation to generate a portable man page.
# Similarly, if using traditional pic, use its -D option.
AC_CHECK_PROGS(PIC, "pic -n" "gpic -n" "pic -D" "pic", pic)

AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

AC_OUTPUT(Makefile man/Makefile src/Makefile)