summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 4e531d18809708bf61508d161e460ae93abb89fe (plain) (blame)
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
dnl Process this file with autoconf to produce a configure script.
AC_INIT([quilt],[0.67],[quilt-dev@nongnu.org])
AC_CONFIG_AUX_DIR(config)
AC_PREREQ(2.53)

PACKAGE_RELEASE=1
AC_SUBST(PACKAGE_RELEASE)
AC_SUBST(PACKAGE_TARNAME)

AC_PROG_INSTALL

AC_SYS_INTERPRETER
if test "$interpval" != yes ; then
	AC_MSG_WARN([no

bash/perl scripts may not be invoked correctly due to problems with your
systems implementation of #! being either broken or non-existant.
])
fi

dnl Check for Bourne-Again Shell
unset BASH  # bash sets this itself!

QUILT_COMPAT_PROG_PATH(BASH, bash)

# It would be nice not to have to use backticks, but too many retarded sh
# implementations still don't support $( )
# BEWARE:  There is a distinct possibility that we are currently running under
# bash in this configure script (/bin/sh being a symlink to /bin/bash).  Even
# though the result /could/ be available to us directly as $BASH_VERSION we
# don't want to use, or trust it, incase the user is specifying a different
# bash executable.
if `$BASH -c '[[ "$BASH_VERSION" \< "3.0" ]]'` ; then
    AC_MSG_ERROR([
$PACKAGE_NAME requires at least version 3.0 of bash, you can download a current
version of bash from ftp.gnu.org
])
fi

AC_MSG_CHECKING(whether $BASH quoting works)
if test `$BASH -c "echo \"\\\$(set -- \\\$'a b'; echo \\\$#)\"" 2>/dev/null` = "1"; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
You have a version of `bash' which suffers from a quoting bug.
This is a known bug of bash 3.1, which was fixed by patch bash31-011.
You can get this patch at ftp://ftp.gnu.org/gnu/bash/
])
fi

QUILT_COMPAT_PROG_PATH(CP, cp, [gcp cp])
QUILT_COMPAT_PROG_PATH(DATE, date, [gdate date])

if test -z "$INTERNAL_DATE"; then
  AC_MSG_CHECKING([whether $DATE --rfc-822 works])
  if $DATE --rfc-822 >/dev/null 2>/dev/null; then
	AC_MSG_RESULT(yes)
  else
	AC_MSG_ERROR([no

If you don't have a version of `date' that supports --rfc-822, you
can specify '--without-date' and $PACKAGE_NAME will use its own
internal date.
])
  fi
fi

QUILT_COMPAT_PROG_PATH(PERL, perl, [perl perl5])
QUILT_COMPAT_PROG_PATH(GREP, grep)

AC_MSG_CHECKING([whether $GREP -q works])
if echo first | $GREP -q first 2>/dev/null; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of grep which doesn't understand -q.
$PACKAGE_NAME needs it.  If you have access to a version of grep which does
understand -q, you can supply its path with the '--with-grep=' option.
])
fi

AC_MSG_CHECKING([whether $GREP understands (foo|bar)])
if echo first | $GREP '^\(fir\|las\)' >/dev/null 2>&1; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of grep which doesn't understand constructs
of the form (foo|bar).  $PACKAGE_NAME needs it.  If you have access to
a version of grep which does understand such constructs, you can supply
its path with the '--with-grep=' option.
])
fi

QUILT_COMPAT_PROG_PATH(TAIL, tail)

# Solaris' /usr/bin/tail doesn't understand -n.
AC_MSG_CHECKING([whether $TAIL -n works])
if test "`(echo first; echo second) | $TAIL -n 1 2>/dev/null`" = "second"; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of tail which doesn't understand -n.
$PACKAGE_NAME needs it.  If you have access to a version of tail which does
understand -n, you can supply its path with the '--with-tail=' option.
Solaris users can use /usr/xpg4/bin/tail.
])
fi

QUILT_COMPAT_PROG_PATH(TR, tr)

AC_MSG_CHECKING([whether $TR understands a-z ])
if test "`echo first | $TR a-z A-Z 2>/dev/null`" = "FIRST"; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of tr which doesn't understand constructs
of the form a-z.  $PACKAGE_NAME needs it.  If you have access to
a version of tr which does understand such constructs, you can supply
its path with the '--with-tr=' option.
Solaris users can use /usr/xpg4/bin/tr.
])
fi

QUILT_COMPAT_PROG_PATH(STAT, stat)

AC_MSG_CHECKING([whether $STAT -c '%h' works])
if $STAT -c '%h' /dev/null >/dev/null 2>/dev/null; then
	AC_MSG_RESULT(yes)
	STAT_HARDLINK="-c '%h'"
else
	AC_MSG_RESULT(no)
	AC_MSG_CHECKING([whether $STAT -f '%l' works])
	if $STAT -f '%l' /dev/null >/dev/null 2>/dev/null; then
		AC_MSG_RESULT(yes)
		STAT_HARDLINK="-f '%l'"
	else
		AC_MSG_RESULT(no)
		AC_MSG_ERROR([
Sorry, you have a version of stat which understands neither -c nor -f.
$PACKAGE_NAME needs it.  If you have access to a version of stat which does
understand -c or -f, you can supply its path with the '--with-stat=' option.
])
	fi
fi
AC_SUBST(STAT_HARDLINK)

QUILT_COMPAT_PROG_PATH(SED, sed)

AC_MSG_CHECKING([whether $SED understands (foo|bar)])
if test "`echo first | $SED -e 's/\(fir\|lo\)/la/' 2>/dev/null`" = "last"; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of sed which doesn't understand constructs
of the form (foo|bar).  $PACKAGE_NAME needs it.  If you have access to
a version of sed which does understand such constructs, you can supply
its path with the '--with-sed=' option.
])
fi

QUILT_COMPAT_PROG_PATH(AWK, awk, [gawk awk])

AC_MSG_CHECKING([whether $AWK supports sub])
if test "`echo first | $AWK 'sub(/first/, "last")' 2>/dev/null`" = "last"; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of awk which doesn't understand sub( ).
$PACKAGE_NAME needs it.  If you have access to a version of awk
which does understand such constructs, you can supply its path
with the '--with-awk=' option.
Solaris users can use /usr/xpg4/bin/awk.
])
fi

AC_ARG_WITH(pod2man, AC_HELP_STRING(
  [--with-pod2man],
  [name of the pod2man executable to use (use --without-pod2man to disable)]),
  [
    if test x"$withval" = xno; then
      POD2MAN=
    else
      POD2MAN=$withval
    fi],[
    AC_PATH_PROG(POD2MAN, pod2man)
  ]
  )
AC_SUBST(POD2MAN)

QUILT_COMPAT_PROG_PATH(COLUMN, column)
QUILT_COMPAT_PROG_PATH(GETOPT, getopt)

if test -z "$INTERNAL_GETOPT"; then
  AC_MSG_CHECKING(for getopt --long syntax)
  dnl check GNU syntax
  $GETOPT -o t --long test -- --test | grep 'illegal option' >/dev/null
  getopt_long_errors=$?
  $GETOPT -o t --long test -- --test | grep '^ *--test *--' >/dev/null
  getopt_long_works=$?
  if test $getopt_long_errors -eq 1 -a $getopt_long_works -eq 0; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([
$GETOPT does not support the --long option.
If you don't have a version of getopt that supports long options, you
can specify '--without-getopt' and $PACKAGE_NAME will use its own
internal getopt.
])
  fi
fi

QUILT_COMPAT_PROG_PATH(MKTEMP, mktemp)
if test -z "$INTERNAL_MKTEMP" ; then
    AC_MSG_CHECKING(whether $MKTEMP -d works)
    if tempdir=`$MKTEMP -d ${TMPDIR:-/tmp}/$PACKAGE_NAME.XXXXXX 2>/dev/null` && \
       rmdir "$tempdir" ; then
	AC_MSG_RESULT(yes)
    else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
'$MKTEMP -d' does not create temporary directories.
If you don't have a version of mktemp that can create directories, you
can specify '--without-mktemp' and $PACKAGE_NAME will use its own
internal tempfile generation mechanism.
])
    fi
fi

QUILT_COMPAT_PROG_PATH(DIFF, diff)
QUILT_COMPAT_PROG_PATH(PATCH, patch)

# Sun diff and others will not work because GNU patch options are used.
AC_MSG_CHECKING([the version of $DIFF])
if $DIFF --version 2>/dev/null | grep GNU >/dev/null; then
  set -- `$DIFF --version 2>/dev/null | $AWK '{ print $NF; exit }'`
  diff_version=$1
  AC_MSG_RESULT($diff_version)
  saved_IFS=$IFS; IFS='.'
  set -- $diff_version
  IFS=$saved_IFS
  set -- `echo $1 | $TR -cd 0-9` `echo $2 | $TR -cd 0-9`
  if test 0$1 -lt 2 || test 0$1 -eq 2 -a 0$2 -lt 7 ; then
    diff_version=
  fi
else
  AC_MSG_RESULT(no GNU diff)
fi
if test -z "$diff_version" ; then
  AC_MSG_ERROR([
$PACKAGE_NAME requires at least version 2.7 of GNU diffutils. You can
download a current version of patch from ftp.gnu.org, or if you already
have GNU diff then you can supply its path with the '--with-diff=' option.
])
fi


# Sun's patch, and others, do not work because GNU patch options are used.
AC_MSG_CHECKING([the version of $PATCH])
if $PATCH --version 2> /dev/null | grep GNU >/dev/null; then
  set -- `$PATCH --version 2> /dev/null`
  if test x$1 = xGNU ; then
    patch_version=$3
  else
    patch_version=$2
  fi
  AC_MSG_RESULT($patch_version)
  saved_IFS=$IFS; IFS='.'
  set -- $patch_version
  IFS=$saved_IFS
  set -- `echo $1 | $TR -cd 0-9` `echo $2 | $TR -cd 0-9`
  if test 0$1 -lt 2 || test 0$1 -eq 2 -a 0$2 -lt 5 ; then
    patch_version=
  fi
else
  AC_MSG_RESULT(no GNU patch)
fi
if test -z "$patch_version" ; then
  AC_MSG_ERROR([
$PACKAGE_NAME requires at least version 2.5 of GNU patch. You can download a
current version of patch from ftp.gnu.org, or if you already have GNU patch
then you can supply its path with the '--with-patch=' option.
])
fi

QUILT_COMPAT_PROG_PATH(FIND, find)

AC_MSG_CHECKING([whether $FIND -path works])
if $FIND . -path '*' >/dev/null 2>&1; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of find which doesn't understand -path.
$PACKAGE_NAME needs it.  If you have access to a version of find which
does understand -path, you can supply its path with the
'--with-find=' option.
])
fi

AC_MSG_CHECKING([whether $FIND -print0 works])
if $FIND . -path '*' -print0 >/dev/null 2>&1; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of find which doesn't understand -print0.
$PACKAGE_NAME needs it.  If you have access to a version of find which
does understand -print0, you can supply its path with the
'--with-find=' option.
])
fi

QUILT_COMPAT_PROG_PATH(XARGS, xargs)

AC_MSG_CHECKING([whether $XARGS -0 works])
if echo | $XARGS -0 echo >/dev/null 2>&1; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([
Sorry, you have a version of xargs which doesn't understand -0.
$PACKAGE_NAME needs it.  If you have access to a version of xargs which
does understand -0, you can supply its path with the
'--with-xargs=' option.
])
fi

QUILT_COMPAT_PROG_PATH_OPT(DIFFSTAT, diffstat)

if test "$DIFFSTAT" != "diffstat"; then
    # We need diffstat version 1.32 or better, else quilt refresh --diffstat
    # will show progress data we don't want to see.  This is only a warning
    # and we continue even if version is older, as this is only a minor
    # annoyance.
    AC_MSG_CHECKING([for diffstat version])
    diffstat_version=`$DIFFSTAT -V 2>/dev/null | \
        sed 's/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1 \2/'`
    eval set -- "$diffstat_version"
    diffstat_major_version="$1"
    diffstat_minor_version="$2"
    if test -z "$diffstat_major_version" -o -z "$diffstat_minor_version"; then
	AC_MSG_RESULT(unknown)
	AC_MSG_WARN([
diffstat utility version couldn't be checked; chances are good that the
--diffstat option of the refresh command will not work properly.
])
    else
	AC_MSG_RESULT($diffstat_major_version.$diffstat_minor_version)
	if test "$diffstat_major_version" -lt 1 \
	   -o \( "$diffstat_major_version" -eq 1 -a "$diffstat_minor_version" -lt 32 \); then
	    AC_MSG_WARN([
diffstat utility is too old; the --diffstat option of the refresh command
will not work correctly until a newer version (>= 1.32) is installed.
])
	fi
    fi
fi

QUILT_COMPAT_PROG_PATH(SENDMAIL, sendmail, [], [/usr/sbin])

AC_PATH_PROG(MSGMERGE, [msgmerge])
AC_PATH_PROG(MSGFMT, [msgfmt])
AC_PATH_PROG(XGETTEXT, [xgettext])
AC_PATH_PROG(MSGUNIQ, [msguniq])
AC_PATH_PROG(MSGCAT, [msgcat])
if test -n "$MSGFMT" -a -n "$MSGMERGE" -a -n "$XGETTEXT" -a -n "$MSGUNIQ" -a -n "$MSGCAT" ; then
  HAVE_NLS=yes
else
  HAVE_NLS=no
fi

USE_NLS=no
AC_ARG_ENABLE(nls, AC_HELP_STRING(
    [--disable-nls], [exclude natural language support]),
    [USE_NLS=$enableval],[USE_NLS=$HAVE_NLS])

if test $USE_NLS = yes -a $HAVE_NLS = no ; then
  AC_MSG_ERROR([
You do not appear to have msgfmt, which is part of the GNU Gettext package.  It
is a required package as you chose the '--enable-nls' option to configure.
You can download GNU Gettext from ftp.gnu.org
])
fi

PATCH_WRAPPER=
AC_ARG_WITH(patch-wrapper, AC_HELP_STRING(
    [--with-patch-wrapper], [include GNU patch wrapper]), [
      if test "$withval" = yes ; then
	PATCH_WRAPPER=$withval
      fi
    ])
AC_SUBST(PATCH_WRAPPER)

if test $USE_NLS = no ; then
    AC_MSG_NOTICE([Building without natural language support])
fi
AC_SUBST(USE_NLS)

AC_SUBST(docdir)

dnl Check for rpmbuild (v4) vs. rpm (v3)
QUILT_COMPAT_PROG_PATH_OPT(RPMBUILD, rpmbuild, [rpmbuild rpm])

QUILT_COMPAT_PROG_PATH_OPT(MD5SUM, md5sum, [gmd5sum md5sum])

QUILT_COMPAT_PROG_PATH_OPT(P7ZIP, 7z, [7zr 7za 7z])

AC_SUBST(COMPAT_SYMLINKS)
AC_SUBST(COMPAT_PROGRAMS)

AC_CONFIG_FILES(Makefile)
AC_OUTPUT

dnl Print results
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE_NAME version $PACKAGE_VERSION configured.])
AC_MSG_RESULT([])
AC_MSG_RESULT([Using '$prefix' for installation prefix.])

AC_MSG_RESULT([])
AC_MSG_RESULT([Report bugs to $PACKAGE_BUGREPORT])