1
dnl -*- buffer-read-only: t -*- vi: set ro:
3
dnl DO NOT EDIT THIS FILE (libopts.m4)
5
dnl It has been AutoGen-ed Thursday October 12, 2006 at 05:44:50 PM PDT
6
dnl From the definitions libopts.def
7
dnl and the template file conftest.tpl
9
dnl do always before generated macros:
11
AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
12
[if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then]
25
AC_CHECK_HEADERS(dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \
26
setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \
27
sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h \
30
# --------------------------------------------
31
# Verify certain entries from AC_CHECK_HEADERS
32
# --------------------------------------------
33
[for f in sys_types sys_mman sys_param sys_stat sys_wait \
34
string errno stdlib memory setjmp
35
do eval as_ac_var=\${ac_cv_header_${f}_h+set}
36
test "${as_ac_var}" = set] || \
37
AC_MSG_ERROR([You must have ${f}.h on your system])
40
# ================================================
41
# AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise
42
# if varargs.h is present define HAVE_VARARGS_H.
43
# ================================================
44
AC_CHECK_HEADERS(stdarg.h varargs.h, break)
45
[if test `eval echo '${'$as_ac_Header'}'` != yes; then]
46
AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system])
49
# ================================================
50
# Similarly for the string.h and strings.h headers
51
# ================================================
52
AC_CHECK_HEADERS(string.h strings.h, break)
53
[if test `eval echo '${'$as_ac_Header'}'` != yes; then]
54
AC_MSG_ERROR([You must have string.h or strings.h on your system])
57
# =====================
58
# ...and limits headers
59
# =====================
60
AC_CHECK_HEADERS(limits.h sys/limits.h values.h, break)
61
[if test `eval echo '${'$as_ac_Header'}'` != yes; then]
62
AC_MSG_ERROR([You must have one of limits.h, sys/limits.h or values.h])
65
# ========================
66
# ...and int types headers
67
# ========================
68
AC_CHECK_HEADERS(stdint.h inttypes.h, break)
69
AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
72
# ====================
73
# uintptr type & sizes
74
# ====================
75
AC_CHECK_TYPES([uintptr_t], ,
76
[AC_DEFINE([uintptr_t], unsigned long,
77
[Alternate uintptr_t for systems without it.])])
78
AC_CHECK_SIZEOF(char*, 4)
79
AC_CHECK_SIZEOF(int, 4)
80
AC_CHECK_SIZEOF(long, 4)
81
AC_CHECK_SIZEOF(short, 2)
83
# ----------------------------------------------------------------------
84
# AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
85
# ----------------------------------------------------------------------
86
AC_CHECK_LIB(gen, pathfind)
88
AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr])
89
[ INVOKE_LIBOPTS_MACROS_FIRST_done=yes
93
dnl @synopsis INVOKE_LIBOPTS_MACROS
95
dnl This macro will invoke the AutoConf macros specified in libopts.def
96
dnl that have not been disabled with "omit-invocation".
98
AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
99
AC_ARG_WITH([regex-header],
100
AC_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
101
[libopts_cv_with_regex_header=${with_regex_header}],
102
AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
103
libopts_cv_with_regex_header=no)
104
) # end of AC_ARG_WITH
106
if test "X${libopts_cv_with_regex_header}" != Xno
108
AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
110
AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
113
]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
116
AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
117
AC_ARG_WITH([libregex],
118
AC_HELP_STRING([--with-libregex], [libregex installation prefix]),
119
[libopts_cv_with_libregex_root=${with_libregex}],
120
AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
121
libopts_cv_with_libregex_root=no)
122
) # end of AC_ARG_WITH libregex
124
if test "${with_libguile+set}" = set && \
125
test "${withval}" = no
126
then ## disabled by request
127
libopts_cv_with_libregex_root=no
128
libopts_cv_with_libregex_cflags=no
129
libopts_cv_with_libregex_libs=no
132
AC_ARG_WITH([libregex-cflags],
133
AC_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
134
[libopts_cv_with_libregex_cflags=${with_regex_cflags}],
135
AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
136
libopts_cv_with_libregex_cflags=no)
137
) # end of AC_ARG_WITH libregex-cflags
139
AC_ARG_WITH([libregex-libs],
140
AC_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
141
[libopts_cv_with_libregex_libs=${with_regex_libs}],
142
AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
143
libopts_cv_with_libregex_libs=no)
144
) # end of AC_ARG_WITH libregex-libs
146
case "X${libopts_cv_with_libregex_cflags}" in
148
case "X${libopts_cv_with_libregex_root}" in
149
Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
150
* ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
153
case "X${libopts_cv_with_libregex_libs}" in
155
case "X${libopts_cv_with_libregex_root}" in
156
Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
157
* ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
160
libopts_save_CPPFLAGS="${CPPFLAGS}"
161
libopts_save_LIBS="${LIBS}"
162
fi ## disabled by request
164
case "X${libopts_cv_with_libregex_cflags}" in
166
libopts_cv_with_libregex_cflags="" ;;
167
* ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
169
case "X${libopts_cv_with_libregex_libs}" in
171
libopts_cv_with_libregex_libs="" ;;
173
LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
177
AC_MSG_CHECKING([whether libregex functions properly])
178
AC_CACHE_VAL([libopts_cv_with_libregex],[
179
AC_TRY_RUN([@%:@include <stdio.h>
180
@%:@include <stdlib.h>
181
@%:@include <sys/types.h>
182
@%:@include REGEX_HEADER
184
void comp_re( char const* pzPat ) {
185
int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
186
if (res == 0) return;
189
regmatch_t m@<:@2@:>@;
190
comp_re( "^.*\@S|@" );
191
comp_re( "()|no.*" );
193
if (regexec( &re, "X", 2, m, 0 ) != 0) return 1;
194
if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
195
fputs( "error: regex -->.<-- did not match\n", stderr );
199
[libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
200
[libopts_cv_with_libregex=no]) # end of AC_TRY_RUN
201
]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
202
AC_MSG_RESULT([${libopts_cv_with_libregex}])
204
if test "X${libopts_cv_with_libregex}" != Xno
206
AC_DEFINE([WITH_LIBREGEX],[1],
207
[Define this if a working libregex can be found])
209
CPPFLAGS="${libopts_save_CPPFLAGS}"
210
LIBS="${libopts_save_LIBS}"
213
]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
216
AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
217
AC_MSG_CHECKING([whether pathfind(3) works])
218
AC_CACHE_VAL([libopts_cv_run_pathfind],[
219
AC_TRY_RUN([@%:@include <string.h>
220
@%:@include <stdlib.h>
221
int main (int argc, char** argv) {
222
char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
223
return (pz == 0) ? 1 : 0;
225
[libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
227
]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
228
AC_MSG_RESULT([${libopts_cv_run_pathfind}])
230
if test "X${libopts_cv_run_pathfind}" != Xno
232
AC_DEFINE([HAVE_PATHFIND],[1],
233
[Define this if pathfind(3) works])
236
]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
239
AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
240
AC_MSG_CHECKING([whether /dev/zero is readable device])
241
AC_CACHE_VAL([libopts_cv_test_dev_zero],[
242
libopts_cv_test_dev_zero=`exec 2> /dev/null
243
dzero=\`ls -l /dev/zero | egrep ^c......r\`
244
test -z "${dzero}" && exit 1
247
then libopts_cv_test_dev_zero=no
248
elif test -z "$libopts_cv_test_dev_zero"
249
then libopts_cv_test_dev_zero=no
251
]) # end of CACHE_VAL of libopts_cv_test_dev_zero
252
AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
254
if test "X${libopts_cv_test_dev_zero}" != Xno
256
AC_DEFINE([HAVE_DEV_ZERO],[1],
257
[Define this if /dev/zero is readable device])
260
]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
263
AC_DEFUN([LIBOPTS_RUN_REALPATH],[
264
AC_MSG_CHECKING([whether we have a functional realpath(3C)])
265
AC_CACHE_VAL([libopts_cv_run_realpath],[
266
AC_TRY_RUN([@%:@include <limits.h>
267
@%:@include <stdlib.h>
268
int main (int argc, char** argv) {
272
char zPath@<:@PATH_MAX+1@:>@;
274
char *pz = realpath(argv@<:@0@:>@, zPath);
275
return (pz == zPath) ? 0 : 1;
277
[libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
279
]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
280
AC_MSG_RESULT([${libopts_cv_run_realpath}])
282
if test "X${libopts_cv_run_realpath}" != Xno
284
AC_DEFINE([HAVE_REALPATH],[1],
285
[Define this if we have a functional realpath(3C)])
288
]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
291
AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
292
AC_MSG_CHECKING([whether strftime() works])
293
AC_CACHE_VAL([libopts_cv_run_strftime],[
294
AC_TRY_RUN([@%:@include <time.h>
295
@%:@include <string.h>
296
char t_buf@<:@ 64 @:>@;
298
static char const z@<:@@:>@ = "Thursday Aug 28 240";
300
tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */
301
tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */
302
tm.tm_hour = 12; /* hour since midnight @<:@0, 23@:>@ */
303
tm.tm_mday = 28; /* day of the month @<:@1, 31@:>@ */
304
tm.tm_mon = 7; /* months since January @<:@0, 11@:>@ */
305
tm.tm_year = 86; /* years since 1900 */
306
tm.tm_wday = 4; /* days since Sunday @<:@0, 6@:>@ */
307
tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */
308
tm.tm_isdst = 1; /* flag for daylight savings time */
309
strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
310
return (strcmp( t_buf, z ) != 0); }],
311
[libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
313
]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
314
AC_MSG_RESULT([${libopts_cv_run_strftime}])
316
if test "X${libopts_cv_run_strftime}" != Xno
318
AC_DEFINE([HAVE_STRFTIME],[1],
319
[Define this if strftime() works])
322
]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
325
AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
326
AC_MSG_CHECKING([whether fopen accepts "b" mode])
327
AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
328
AC_TRY_RUN([@%:@include <stdio.h>
329
int main (int argc, char** argv) {
330
FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
331
return (fp == NULL) ? 1 : fclose(fp); }],
332
[libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
334
]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
335
AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
337
if test "X${libopts_cv_run_fopen_binary}" != Xno
339
AC_DEFINE([FOPEN_BINARY_FLAG],"b",
340
[fopen(3) accepts a 'b' in the mode flag])
342
AC_DEFINE([FOPEN_BINARY_FLAG],"",
343
[fopen(3) accepts a 'b' in the mode flag])
346
]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
349
AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
350
AC_MSG_CHECKING([whether fopen accepts "t" mode])
351
AC_CACHE_VAL([libopts_cv_run_fopen_text],[
352
AC_TRY_RUN([@%:@include <stdio.h>
353
int main (int argc, char** argv) {
354
FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
355
return (fp == NULL) ? 1 : fclose(fp); }],
356
[libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
358
]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
359
AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
361
if test "X${libopts_cv_run_fopen_text}" != Xno
363
AC_DEFINE([FOPEN_TEXT_FLAG],"t",
364
[fopen(3) accepts a 't' in the mode flag])
366
AC_DEFINE([FOPEN_TEXT_FLAG],"",
367
[fopen(3) accepts a 't' in the mode flag])
370
]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
373
AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
374
INVOKE_LIBOPTS_MACROS_FIRST
375
# Check to see if a reg expr header is specified.
376
LIBOPTS_WITH_REGEX_HEADER
378
# Check to see if a working libregex can be found.
379
LIBOPTS_WITHLIB_REGEX
381
# Check to see if pathfind(3) works.
384
# Check to see if /dev/zero is readable device.
385
LIBOPTS_TEST_DEV_ZERO
387
# Check to see if we have a functional realpath(3C).
390
# Check to see if strftime() works.
393
# Check to see if fopen accepts "b" mode.
394
LIBOPTS_RUN_FOPEN_BINARY
396
# Check to see if fopen accepts "t" mode.
397
LIBOPTS_RUN_FOPEN_TEXT
399
]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
401
dnl @synopsis LIBOPTS_CHECK
403
dnl Time-stamp: "2006-09-23 19:36:24 bkorb"
404
dnl Last Committed: $Date: 2006/09/24 02:59:00 $
406
dnl If autoopts-config works, add the linking information to LIBS.
407
dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
408
dnl the config tests that the library needs. Invoke the
409
dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
411
dnl Default to system libopts
413
AC_DEFUN([LIBOPTS_CHECK],[
414
[NEED_LIBOPTS_DIR='']
415
m4_pushdef([AO_Libopts_Dir],
416
[ifelse($1, , [libopts], [$1])])
417
AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
418
AC_ARG_ENABLE([local-libopts],
419
AC_HELP_STRING([--enable-local-libopts],
420
[Force using the supplied libopts tearoff code]),[
421
if test x$enableval = xyes ; then
422
AC_MSG_NOTICE([Using supplied libopts tearoff])
423
LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
424
LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
425
NEED_LIBOPTS_DIR=true
428
AC_ARG_ENABLE([libopts-install],
429
AC_HELP_STRING([--disable-libopts-install],
430
[Do not install libopts with client installation]))
431
AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" != Xno])
433
[if test -z "${NEED_LIBOPTS_DIR}" ; then]
434
AC_MSG_CHECKING([whether autoopts-config can be found])
435
AC_ARG_WITH([autoopts-config],
436
AC_HELP_STRING([--with-autoopts-config],
437
[specify the config-info script]),
438
[lo_cv_with_autoopts_config=${with_autoopts_config}],
439
AC_CACHE_CHECK([whether autoopts-config is specified],
440
[lo_cv_with_autoopts_config],
441
[if autoopts-config --help 2>/dev/null 1>&2
442
then lo_cv_with_autoopts_config=autoopts-config
443
elif libopts-config --help 2>/dev/null 1>&2
444
then lo_cv_with_autoopts_config=libopts-config
445
else lo_cv_with_autoopts_config=no ; fi])
446
) # end of AC_ARG_WITH
448
AC_CACHE_VAL([lo_cv_test_autoopts],[
449
if test -z "${lo_cv_with_autoopts_config}" \
450
-o X"${lo_cv_with_autoopts_config}" = Xno
452
if autoopts-config --help 2>/dev/null 1>&2
453
then lo_cv_with_autoopts_config=autoopts-config
454
elif libopts-config --help 2>/dev/null 1>&2
455
then lo_cv_with_autoopts_config=libopts-config
456
else lo_cv_with_autoopts_config=false ; fi
458
lo_cv_test_autoopts=`
459
${lo_cv_with_autoopts_config} --libs` 2> /dev/null
460
if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
461
then lo_cv_test_autoopts=no ; fi
462
]) # end of CACHE_VAL
463
AC_MSG_RESULT([${lo_cv_test_autoopts}])
465
[if test "X${lo_cv_test_autoopts}" != Xno
467
LIBOPTS_LDADD="${lo_cv_test_autoopts}"
468
LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
470
LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
471
LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
472
NEED_LIBOPTS_DIR=true
474
fi # end of if test -z "${NEED_LIBOPTS_DIR}"]
476
AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
477
AC_SUBST(LIBOPTS_LDADD)
478
AC_SUBST(LIBOPTS_CFLAGS)
479
AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
480
AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
481
m4_popdef([AO_Libopts_Dir])
483
[if test -n "${NEED_LIBOPTS_DIR}" ; then]
484
INVOKE_LIBOPTS_MACROS
486
INVOKE_LIBOPTS_MACROS_FIRST
488
# end of AC_DEFUN of LIBOPTS_CHECK]