-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
533 lines (462 loc) · 15.2 KB
/
configure.ac
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
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# $Id$
# Copyright (c) 2009, Darren Hiebert
#
# This source code is released for free distribution under the terms
# of the GNU General Public License.
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([ctags.h])
AC_CONFIG_HEADERS([config.h])
AH_TEMPLATE([PACKAGE], [Package name.])
AH_TEMPLATE([VERSION], [Package version.])
AH_TEMPLATE([clock_t],
[Define to the appropriate type if <time.h> does not define this.])
AH_TEMPLATE([fpos_t],
[Define to long if <stdio.h> does not define this.])
AH_TEMPLATE([L_tmpnam],
[Define to the appropriate size for tmpnam() if <stdio.h> does not define
this.])
AH_TEMPLATE([HAVE_STAT_ST_INO],
[Define this macro if the field "st_ino" exists in struct stat in
<sys/stat.h>.])
AH_TEMPLATE([remove],
[Define remove to unlink if you have unlink(), but not remove().])
AH_TEMPLATE([SEEK_SET],
[Define this value used by fseek() appropriately if <stdio.h>
(or <unistd.h> on SunOS 4.1.x) does not define them.])
AH_TEMPLATE([INT_MAX],
[Define as the maximum integer on your system if not defined <limits.h>.])
AH_TEMPLATE([CUSTOM_CONFIGURATION_FILE],
[You can define this label to be a string containing the name of a
site-specific configuration file containing site-wide default options. The
files /etc/ctags.conf and /usr/local/etc/ctags.conf are already checked,
so only define one here if you need a file somewhere else.])
AH_TEMPLATE([MACROS_USE_PATTERNS],
[Define this label if you want macro tags (defined lables) to use patterns
in the EX command by default (original ctags behavior is to use line
numbers).])
AH_VERBATIM([DEFAULT_FILE_FORMAT], [
/* Define this as desired.
* 1: Original ctags format
* 2: Extended ctags format with extension flags in EX-style comment.
*/
#define DEFAULT_FILE_FORMAT 2
])
AH_TEMPLATE([SYS_INTERPRETER],
[Define this label if your system supports starting scripts with a line of
the form "#! /bin/sh" to select the interpreter to use for the script.])
AH_TEMPLATE([CASE_INSENSITIVE_FILENAMES],
[Define this label if your system uses case-insensitive file names])
AH_VERBATIM([EXTERNAL_SORT], [
/* Define this label to use the system sort utility (which is probably more
* efficient) over the internal sorting algorithm.
*/
#ifndef INTERNAL_SORT
# undef EXTERNAL_SORT
#endif
])
AH_TEMPLATE([TMPDIR],
[If you wish to change the directory in which temporary files are stored,
define this label to the directory desired.])
AH_TEMPLATE([REGCOMP_BROKEN],
[Define this label if regcomp() is broken.])
AH_TEMPLATE([CHECK_REGCOMP],
[Define this label if you wish to check the regcomp() function at run time
for correct behavior. This function is currently broken on Cygwin.])
AH_TEMPLATE([__USE_FIXED_PROTOTYPES__],
[This corrects the problem of missing prototypes for certain functions
in some GNU installations (e.g. SunOS 4.1.x).])
AH_TEMPLATE([NON_CONST_PUTENV_PROTOTYPE],
[Define this is you have a prototype for putenv() in <stdlib.h>, but
doesn't declare its argument as "const char *".])
AH_TEMPLATE([NEED_PROTO_REMOVE],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_UNLINK],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_MALLOC],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_GETENV],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_FGETPOS],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_STAT],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_LSTAT],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_TRUNCATE],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
AH_TEMPLATE([NEED_PROTO_FTRUNCATE],
[If you receive error or warning messages indicating that you are missing
a prototype for, or a type mismatch using, the following function, define
this label and remake.])
# Report system info
# ------------------
program_name=[`grep 'PROGRAM_NAME *"' ctags.h | sed -e 's/.*"\([^"]*\)".*/\1/'`]
program_version=[`grep 'PROGRAM_VERSION *"' ctags.h | sed -e 's/.*"\([^"]*\)".*/\1/'`]
echo "$program_name, version $program_version"
uname -mrsv 2>/dev/null
# Define convenience macros
# -------------------------
# CHECK_HEADER_DEFINE(LABEL, HEADER [,ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ] ])
AC_DEFUN([CHECK_HEADER_DEFINE], [
AC_MSG_CHECKING([if $1 is defined in $2])
AC_EGREP_CPP(yes,
[#include <$2>
#ifdef $1
yes
#endif
], [
AC_MSG_RESULT(yes)
[$3]
], [
AC_MSG_RESULT(no)
[$4]
]) ])
# Checks for configuration options
# --------------------------------
AC_ARG_WITH(posix-regex,
[ --with-posix-regex use Posix regex interface, if available])
AC_ARG_WITH(readlib,
[ --with-readlib include readtags library object during install])
# AC_ARG_WITH(perl-regex,
# [ --with-perl-regex use Perl pcre interface, if available])
AC_ARG_ENABLE(etags,
[ --enable-etags enable the installation of links for etags])
AC_ARG_ENABLE(extended-format,
[ --disable-extended-format
disable extension flags; use original ctags file
format only],
AC_DEFINE(DEFAULT_FILE_FORMAT, 1), AC_DEFINE(DEFAULT_FILE_FORMAT, 2))
AC_ARG_ENABLE(external-sort,
[ --disable-external-sort use internal sort algorithm instead of sort program])
AC_ARG_ENABLE(custom-config,
[ --enable-custom-config=FILE
enable custom config file for site-wide defaults])
AC_ARG_ENABLE(macro-patterns,
[ --enable-macro-patterns use patterns as default method to locate macros
instead of line numbers])
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode
use maintainer makefile])
AC_ARG_ENABLE(shell-globbing,
[ --enable-shell-globbing=DIR
does shell expand wildcards (yes|no)? [yes]])
AC_ARG_ENABLE(tmpdir,
[ --enable-tmpdir=DIR default directory for temporary files [ARG=/tmp]],
tmpdir_specified=yes)
# Process configuration options
# -----------------------------
if test "$enable_maintainer_mode" = yes ; then
AC_MSG_RESULT(enabling maintainer mode)
fi
install_targets="install-ctags"
AC_MSG_CHECKING(whether to install link to etags)
if test yes = "$enable_etags"; then
AC_MSG_RESULT(yes)
install_targets="$install_targets install-etags"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(whether to install readtags object file)
if test yes = "$with_readlib"; then
AC_MSG_RESULT(yes)
install_targets="$install_targets install-lib"
else
AC_MSG_RESULT(no)
fi
AC_SUBST(install_targets)
if test "$enable_custom_config" = no -o "$enable_custom_config" = yes ; then
AC_MSG_RESULT(no name supplied for custom configuration file)
elif test -n "$enable_custom_config" ; then
AC_DEFINE_UNQUOTED(CUSTOM_CONFIGURATION_FILE, "$enable_custom_config")
AC_MSG_RESULT($enable_custom_config will be used as custom configuration file)
fi
if test "$enable_macro_patterns" = yes ; then
AC_DEFINE(MACROS_USE_PATTERNS)
AC_MSG_RESULT(tag file will use patterns for macros by default)
fi
# Checks for programs
# -------------------
AC_PROG_CC
case `uname` in
HP-UX)
AC_MSG_CHECKING(HP-UX native compiler)
if test "$CC" = "cc"; then
AC_MSG_RESULT(yes; adding compiler options for ANSI support)
CFLAGS="$CFLAGS -Aa -D_HPUX_SOURCE"
else
AC_MSG_RESULT(no)
fi
;;
SunOS)
if uname -r | grep '5\.' >/dev/null 2>&1; then
AC_MSG_CHECKING(Solaris native compiler)
if test "$CC" = "cc" -a "`which cc`" = "/usr/ucb/cc"; then
AC_MSG_RESULT(yes; adding compiler option for ANSI support)
CC="$CC -Xa"
else
AC_MSG_RESULT(no)
fi
fi
;;
esac
AC_PROG_LN_S
AC_CHECK_PROG(STRIP, strip, strip, :)
AC_SYS_LARGEFILE
# Checks for operating environment
# --------------------------------
# Check for temporary directory
AC_MSG_CHECKING(directory to use for temporary files)
if test -n "$enable_tmpdir"; then
tmpdir="$enable_tmpdir"
elif test -n "$TMPDIR"; then
tmpdir="$TMPDIR"
elif test -n "$TMPDIR"; then
tmpdir="$TMPDIR"
elif test -n "$TMP"; then
tmpdir="$TMP"
elif test -n "$TEMP"; then
tmpdir="$TEMP"
elif test -d "c:/"; then
tmpdir="c:/"
else
tmpdir="/tmp"
fi
if test -d $tmpdir ; then
AC_MSG_RESULT($tmpdir)
AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir")
else
AC_MSG_ERROR($tmpdir does not exist)
fi
# Check whether system supports #! scripts
AC_SYS_INTERPRETER
if test yes = "$interpval"; then
AC_DEFINE(SYS_INTERPRETER)
fi
# Test for case-insensitive filenames
AC_MSG_CHECKING(for case-insensitive filenames)
touch conftest.cif
if test -f CONFTEST.CIF; then
AC_MSG_RESULT(yes)
AC_DEFINE(CASE_INSENSITIVE_FILENAMES)
else
AC_MSG_RESULT(no)
fi
rm -f conftest.cif
AC_MSG_CHECKING(selected sort method)
if test no = "$enable_external_sort"; then
AC_MSG_RESULT(simple internal algorithm)
else
AC_MSG_RESULT(external sort utility)
enable_external_sort=no
AC_CHECK_PROG(sort_found, sort, yes, no)
if test "$sort_found" = yes ; then
AC_MSG_CHECKING(if sort accepts our command line)
touch ${tmpdir}/sort.test
sort -u -f -o ${tmpdir}/sort.test ${tmpdir}/sort.test 1>/dev/null 2>&1
if test $? -ne 0 ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_DEFINE(EXTERNAL_SORT)
enable_external_sort=yes
fi
rm -f ${tmpdir}/sort.test
fi
fi
if test "$enable_external_sort" != yes ; then
AC_MSG_RESULT(using internal sort algorithm as fallback)
fi
# Checks for header files
# -----------------------
AC_CHECK_HEADERS_ONCE([dirent.h fcntl.h fnmatch.h stat.h stdlib.h string.h])
AC_CHECK_HEADERS_ONCE([time.h types.h unistd.h])
AC_CHECK_HEADERS_ONCE([sys/dir.h sys/stat.h sys/times.h sys/types.h])
# Checks for header file macros
# -----------------------------
CHECK_HEADER_DEFINE(L_tmpnam, [stdio.h],, AC_DEFINE(L_tmpnam, 20))
CHECK_HEADER_DEFINE(INT_MAX, [limits.h],,
CHECK_HEADER_DEFINE(MAXINT, [limits.h],
AC_DEFINE(INT_MAX, MAXINT), AC_DEFINE(INT_MAX, 32767)))
# Checks for typedefs
# -------------------
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
AC_MSG_CHECKING(for fpos_t)
AC_EGREP_HEADER(fpos_t, stdio.h, AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
AC_DEFINE(fpos_t, long)
])
AC_MSG_CHECKING(for clock_t)
AC_EGREP_HEADER(clock_t, time.h, AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
AC_DEFINE(clock_t, long)
])
# Checks for compiler characteristics
# -----------------------------------
# AC_CYGWIN
# AC_MINGW32
AC_C_CONST
AC_OBJEXT
AC_EXEEXT
AC_MSG_CHECKING(if struct stat contains st_ino)
AC_TRY_COMPILE([#include <sys/stat.h>], [
struct stat st;
stat(".", &st);
if (st.st_ino > 0)
exit(0);
], have_st_ino=yes, have_st_ino=no)
AC_MSG_RESULT($have_st_ino)
if test yes = "$have_st_ino"; then
AC_DEFINE(HAVE_STAT_ST_INO)
fi
# Checks for library functions
# ----------------------------
AC_CHECK_FUNCS(fnmatch)
AC_CHECK_FUNCS(strstr)
AC_CHECK_FUNCS(strcasecmp stricmp, break)
AC_CHECK_FUNCS(strncasecmp strnicmp, break)
AC_CHECK_FUNCS(fgetpos, have_fgetpos=yes)
# SEEK_SET should be in stdio.h, but may be in unistd.h on SunOS 4.1.x
if test "$have_fgetpos" != yes ; then
CHECK_HEADER_DEFINE(SEEK_SET, stdio.h,,
CHECK_HEADER_DEFINE(SEEK_SET, unistd.h,,
AC_DEFINE(SEEK_SET, 0)))
fi
AC_CHECK_FUNCS(mkstemp, have_mkstemp=yes)
if test "$have_mkstemp" != yes ; then
AC_CHECK_FUNCS(tempnam, have_tempnam=yes)
fi
if test "$have_mkstemp" != yes -a "$have_tempnam" != yes; then
AC_CHECK_FUNCS(chmod)
if test "$tmpdir_specified" = yes ; then
AC_MSG_RESULT(use of tmpnam overrides temporary directory selection)
fi
fi
AC_CHECK_FUNCS(opendir findfirst _findfirst, break)
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNCS(clock times, break)
AC_CHECK_FUNCS(remove, have_remove=yes,
CHECK_HEADER_DEFINE(remove, unistd.h,, AC_DEFINE(remove, unlink)))
AC_CHECK_FUNCS(truncate, have_truncate=yes)
# === Cannot nest AC_CHECK_FUNCS() calls
if test "$have_truncate" != yes ; then
AC_CHECK_FUNCS(ftruncate, have_ftruncate=yes)
if test "$have_ftruncate" != yes ; then
AC_CHECK_FUNCS(chsize)
fi
fi
AC_CHECK_FUNCS(setenv, have_setenv=yes)
# === Cannot nest AC_CHECK_FUNCS() calls
if test "$have_setenv" != yes ; then
AC_CHECK_FUNCS(putenv, have_putenv=yes)
if test "$have_putenv" = yes ; then
AC_EGREP_HEADER(putenv, stdlib.h, have_putenv_prototype=yes)
if test "$have_putenv_prototype" = yes ; then
AC_MSG_CHECKING(putenv prototype)
AC_EGREP_HEADER([[^A-Za-zo-9_]putenv[ ]*\(.*const.*\)[ ]*;],
stdlib.h, AC_MSG_RESULT(correct),
[
AC_MSG_RESULT(no const)
AC_DEFINE(NON_CONST_PUTENV_PROTOTYPE)
])
fi
fi
fi
#
# if test yes = "$CYGWIN"; then with_posix_regex=no; fi
if test no != "$with_posix_regex"; then
AC_CHECK_FUNCS(regcomp)
AC_MSG_CHECKING(if regcomp works)
AC_TRY_RUN([
#include <sys/types.h>
#include <regex.h>
main() {
regex_t patbuf;
exit (regcomp (&patbuf, "/hello/", 0) != 0);
}],regcomp_works=yes,regcomp_works=no,AC_DEFINE(CHECK_REGCOMP))
AC_MSG_RESULT($regcomp_works)
if test yes != "$regcomp_works"; then
AC_DEFINE(REGCOMP_BROKEN)
fi
fi
# if test yes = "$with_perl_regex"; then
# AC_MSG_CHECKING(for Perl regex library)
# pcre_candidates="$with_perl_regex $HOME/local/lib* /usr*/local/lib* /usr/lib*"
# for lib in $pcre_candidates; do
# if test -f $lib/libpcreposix.so; then
# pcre_lib="-L$lib -lpcreposix"
# break
# elif test -f $lib/libpcreposix.a; then
# pcre_lib="$lib/libpcreposix.a"
# break
# fi
# done
# if test -z "$pcre_lib"; then
# AC_MSG_RESULT(not found)
# else
# AC_MSG_RESULT($lib)
# AC_DEFINE(HAVE_REGCOMP)
# LDFLAGS="$LDFLAGS $pcre_lib"
# have_regex=yes
# fi
# fi
# Checks for missing prototypes
# -----------------------------
AC_CHECKING(for new missing prototypes)
AC_DEFUN(CHECK_PROTO, [
AC_EGREP_HEADER([[^A-Za-z0-9_]$1([ ]+[A-Za-z0-9_]*)?[ ]*\(],
$2,
,
[
AC_MSG_RESULT([adding prototype for $1])
AC_DEFINE(patsubst([NEED_PROTO_NAME], [NAME], translit([$1], [[a-z]], [[A-Z]])))
])])
if test "$have_remove" = yes ; then
CHECK_PROTO(remove, stdio.h)
else
CHECK_PROTO(unlink, unistd.h)
fi
CHECK_PROTO(malloc, stdlib.h)
CHECK_PROTO(getenv, stdlib.h)
CHECK_PROTO(stat, sys/stat.h)
CHECK_PROTO(lstat, sys/stat.h)
if test "$have_fgetpos" = yes ; then
CHECK_PROTO(fgetpos, stdio.h)
fi
if test "$have_truncate" = yes ; then
CHECK_PROTO(truncate, unistd.h)
fi
if test "$have_ftruncate" = yes ; then
CHECK_PROTO(ftruncate, unistd.h)
fi
# Output files
# ------------
rm -f Makefile
if test "$enable_maintainer_mode" = yes ; then
AC_MSG_RESULT(creating maintainer Makefile)
ln -s maintainer.mak Makefile
makefile_out=
else
makefile_out=Makefile
fi
AC_OUTPUT($makefile_out)
# vim:ts=4:sw=4: