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 November 8, 2009 at 08:41:10 AM by AutoGen 5.9.10pre13
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]
19 AC_CHECK_HEADERS(dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \
20 setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \
21 sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h \
24 # --------------------------------------------
25 # Verify certain entries from AC_CHECK_HEADERS
26 # --------------------------------------------
27 [for f in sys_types sys_mman sys_param sys_stat sys_wait \
28 string errno stdlib memory setjmp
29 do eval as_ac_var=\${ac_cv_header_${f}_h+set}
30 test "${as_ac_var}" = set] || \
31 AC_MSG_ERROR([You must have ${f}.h on your system])
34 # ================================================
35 # AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise
36 # if varargs.h is present define HAVE_VARARGS_H.
37 # ================================================
38 AC_CHECK_HEADERS(stdarg.h varargs.h, break)
39 [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
40 AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system])
43 # ================================================
44 # Similarly for the string.h and strings.h headers
45 # ================================================
46 AC_CHECK_HEADERS(string.h strings.h, break)
47 [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
48 AC_MSG_ERROR([You must have string.h or strings.h on your system])
51 # =====================
52 # ...and limits headers
53 # =====================
54 AC_CHECK_HEADERS(limits.h sys/limits.h values.h, break)
55 [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
56 AC_MSG_ERROR([You must have one of limits.h, sys/limits.h or values.h])
59 # ----------------------------------------------------------------------
60 # check for various programs used during the build.
61 # On OS/X, "wchar.h" needs "runetype.h" to work properly.
62 # ----------------------------------------------------------------------
63 AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
66 # include <runetype.h>
70 # ----------------------------------------------------------------------
72 # ----------------------------------------------------------------------
73 AC_CHECK_TYPES(wchar_t)
74 AC_CHECK_TYPES(wint_t, [], [], [
77 # include <runetype.h>
84 # ========================
85 # ...and int types headers
86 # ========================
87 AC_CHECK_HEADERS(stdint.h inttypes.h, break)
88 AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
89 intptr_t, uintptr_t, uint_t, pid_t, size_t])
94 AC_CHECK_SIZEOF(char*, 4)
95 AC_CHECK_SIZEOF(int, 4)
96 AC_CHECK_SIZEOF(long, 4)
97 AC_CHECK_SIZEOF(short, 2)
99 # ----------------------------------------------------------------------
100 # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
101 # ----------------------------------------------------------------------
102 AC_CHECK_LIB(gen, pathfind)
105 AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
107 [ INVOKE_LIBOPTS_MACROS_FIRST_done=yes
111 dnl @synopsis INVOKE_LIBOPTS_MACROS
113 dnl This macro will invoke the AutoConf macros specified in libopts.def
114 dnl that have not been disabled with "omit-invocation".
116 AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
117 AC_ARG_WITH([regex-header],
118 AC_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
119 [libopts_cv_with_regex_header=${with_regex_header}],
120 AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
121 libopts_cv_with_regex_header=no)
122 ) # end of AC_ARG_WITH
124 if test "X${libopts_cv_with_regex_header}" != Xno
126 AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
128 AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
131 ]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
134 AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
135 AC_ARG_WITH([libregex],
136 AC_HELP_STRING([--with-libregex], [libregex installation prefix]),
137 [libopts_cv_with_libregex_root=${with_libregex}],
138 AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
139 libopts_cv_with_libregex_root=no)
140 ) # end of AC_ARG_WITH libregex
142 if test "${with_libguile+set}" = set && \
143 test "${withval}" = no
144 then ## disabled by request
145 libopts_cv_with_libregex_root=no
146 libopts_cv_with_libregex_cflags=no
147 libopts_cv_with_libregex_libs=no
150 AC_ARG_WITH([libregex-cflags],
151 AC_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
152 [libopts_cv_with_libregex_cflags=${with_regex_cflags}],
153 AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
154 libopts_cv_with_libregex_cflags=no)
155 ) # end of AC_ARG_WITH libregex-cflags
157 AC_ARG_WITH([libregex-libs],
158 AC_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
159 [libopts_cv_with_libregex_libs=${with_regex_libs}],
160 AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
161 libopts_cv_with_libregex_libs=no)
162 ) # end of AC_ARG_WITH libregex-libs
164 case "X${libopts_cv_with_libregex_cflags}" in
166 case "X${libopts_cv_with_libregex_root}" in
167 Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
168 * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
171 case "X${libopts_cv_with_libregex_libs}" in
173 case "X${libopts_cv_with_libregex_root}" in
174 Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
175 * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
178 libopts_save_CPPFLAGS="${CPPFLAGS}"
179 libopts_save_LIBS="${LIBS}"
180 fi ## disabled by request
182 case "X${libopts_cv_with_libregex_cflags}" in
184 libopts_cv_with_libregex_cflags="" ;;
185 * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
187 case "X${libopts_cv_with_libregex_libs}" in
189 libopts_cv_with_libregex_libs="" ;;
191 LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
195 AC_MSG_CHECKING([whether libregex functions properly])
196 AC_CACHE_VAL([libopts_cv_with_libregex],[
197 AC_TRY_RUN([@%:@include <stdio.h>
198 @%:@include <stdlib.h>
199 @%:@include <sys/types.h>
200 @%:@include REGEX_HEADER
202 void comp_re( char const* pzPat ) {
203 int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
204 if (res == 0) return;
207 regmatch_t m@<:@2@:>@;
208 comp_re( "^.*\@S|@" );
209 comp_re( "()|no.*" );
211 if (regexec( &re, "X", 2, m, 0 ) != 0) return 1;
212 if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
213 fputs( "error: regex -->.<-- did not match\n", stderr );
217 [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
218 [libopts_cv_with_libregex=no]) # end of AC_TRY_RUN
219 ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
220 AC_MSG_RESULT([${libopts_cv_with_libregex}])
222 if test "X${libopts_cv_with_libregex}" != Xno
224 AC_DEFINE([WITH_LIBREGEX],[1],
225 [Define this if a working libregex can be found])
227 CPPFLAGS="${libopts_save_CPPFLAGS}"
228 LIBS="${libopts_save_LIBS}"
231 ]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
234 AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
235 AC_MSG_CHECKING([whether pathfind(3) works])
236 AC_CACHE_VAL([libopts_cv_run_pathfind],[
237 AC_TRY_RUN([@%:@include <string.h>
238 @%:@include <stdlib.h>
239 int main (int argc, char** argv) {
240 char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
241 return (pz == 0) ? 1 : 0;
243 [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
245 ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
246 AC_MSG_RESULT([${libopts_cv_run_pathfind}])
248 if test "X${libopts_cv_run_pathfind}" != Xno
250 AC_DEFINE([HAVE_PATHFIND],[1],
251 [Define this if pathfind(3) works])
254 ]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
257 AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
258 AC_MSG_CHECKING([whether /dev/zero is readable device])
259 AC_CACHE_VAL([libopts_cv_test_dev_zero],[
260 libopts_cv_test_dev_zero=`exec 2> /dev/null
261 dzero=\`ls -lL /dev/zero | egrep ^c......r\`
262 test -z "${dzero}" && exit 1
265 then libopts_cv_test_dev_zero=no
266 elif test -z "$libopts_cv_test_dev_zero"
267 then libopts_cv_test_dev_zero=no
269 ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
270 AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
272 if test "X${libopts_cv_test_dev_zero}" != Xno
274 AC_DEFINE([HAVE_DEV_ZERO],[1],
275 [Define this if /dev/zero is readable device])
278 ]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
281 AC_DEFUN([LIBOPTS_RUN_REALPATH],[
282 AC_MSG_CHECKING([whether we have a functional realpath(3C)])
283 AC_CACHE_VAL([libopts_cv_run_realpath],[
284 AC_TRY_RUN([@%:@include <limits.h>
285 @%:@include <stdlib.h>
286 int main (int argc, char** argv) {
290 char zPath@<:@PATH_MAX+1@:>@;
292 char *pz = realpath(argv@<:@0@:>@, zPath);
293 return (pz == zPath) ? 0 : 1;
295 [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
297 ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
298 AC_MSG_RESULT([${libopts_cv_run_realpath}])
300 if test "X${libopts_cv_run_realpath}" != Xno
302 AC_DEFINE([HAVE_REALPATH],[1],
303 [Define this if we have a functional realpath(3C)])
306 ]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
309 AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
310 AC_MSG_CHECKING([whether strftime() works])
311 AC_CACHE_VAL([libopts_cv_run_strftime],[
312 AC_TRY_RUN([@%:@include <time.h>
313 @%:@include <string.h>
314 char t_buf@<:@ 64 @:>@;
316 static char const z@<:@@:>@ = "Thursday Aug 28 240";
318 tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */
319 tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */
320 tm.tm_hour = 12; /* hour since midnight @<:@0, 23@:>@ */
321 tm.tm_mday = 28; /* day of the month @<:@1, 31@:>@ */
322 tm.tm_mon = 7; /* months since January @<:@0, 11@:>@ */
323 tm.tm_year = 86; /* years since 1900 */
324 tm.tm_wday = 4; /* days since Sunday @<:@0, 6@:>@ */
325 tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */
326 tm.tm_isdst = 1; /* flag for daylight savings time */
327 strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
328 return (strcmp( t_buf, z ) != 0); }],
329 [libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
331 ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
332 AC_MSG_RESULT([${libopts_cv_run_strftime}])
334 if test "X${libopts_cv_run_strftime}" != Xno
336 AC_DEFINE([HAVE_STRFTIME],[1],
337 [Define this if strftime() works])
340 ]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
343 AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
344 AC_MSG_CHECKING([whether fopen accepts "b" mode])
345 AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
346 AC_TRY_RUN([@%:@include <stdio.h>
347 int main (int argc, char** argv) {
348 FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
349 return (fp == NULL) ? 1 : fclose(fp); }],
350 [libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
352 ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
353 AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
355 if test "X${libopts_cv_run_fopen_binary}" != Xno
357 AC_DEFINE([FOPEN_BINARY_FLAG],"b",
358 [fopen(3) accepts a 'b' in the mode flag])
360 AC_DEFINE([FOPEN_BINARY_FLAG],"",
361 [fopen(3) accepts a 'b' in the mode flag])
364 ]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
367 AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
368 AC_MSG_CHECKING([whether fopen accepts "t" mode])
369 AC_CACHE_VAL([libopts_cv_run_fopen_text],[
370 AC_TRY_RUN([@%:@include <stdio.h>
371 int main (int argc, char** argv) {
372 FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
373 return (fp == NULL) ? 1 : fclose(fp); }],
374 [libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
376 ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
377 AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
379 if test "X${libopts_cv_run_fopen_text}" != Xno
381 AC_DEFINE([FOPEN_TEXT_FLAG],"t",
382 [fopen(3) accepts a 't' in the mode flag])
384 AC_DEFINE([FOPEN_TEXT_FLAG],"",
385 [fopen(3) accepts a 't' in the mode flag])
388 ]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
391 AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[
392 AC_ARG_ENABLE([optional-args],
393 AC_HELP_STRING([--disable-optional-args], [not wanting optional option args]),
394 [libopts_cv_enable_optional_args=${enable_optional_args}],
395 AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args,
396 libopts_cv_enable_optional_args=yes)
397 ) # end of AC_ARG_ENABLE
399 if test "X${libopts_cv_enable_optional_args}" = Xno
401 AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1],
402 [Define this if optional arguments are disallowed])
405 ]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS
408 AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
409 INVOKE_LIBOPTS_MACROS_FIRST
410 # Check to see if a reg expr header is specified.
411 LIBOPTS_WITH_REGEX_HEADER
413 # Check to see if a working libregex can be found.
414 LIBOPTS_WITHLIB_REGEX
416 # Check to see if pathfind(3) works.
419 # Check to see if /dev/zero is readable device.
420 LIBOPTS_TEST_DEV_ZERO
422 # Check to see if we have a functional realpath(3C).
425 # Check to see if strftime() works.
428 # Check to see if fopen accepts "b" mode.
429 LIBOPTS_RUN_FOPEN_BINARY
431 # Check to see if fopen accepts "t" mode.
432 LIBOPTS_RUN_FOPEN_TEXT
434 # Check to see if not wanting optional option args.
435 LIBOPTS_DISABLE_OPTIONAL_ARGS
437 ]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
439 dnl @synopsis LIBOPTS_CHECK
441 dnl Time-stamp: "2009-07-22 18:50:49 bkorb"
443 dnl If autoopts-config works, add the linking information to LIBS.
444 dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
445 dnl the config tests that the library needs. Invoke the
446 dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
448 dnl This file is part of AutoGen.
449 dnl AutoGen copyright (c) 1992-2009 by Bruce Korb - all rights reserved
451 dnl AutoGen is free software: you can redistribute it and/or modify it
452 dnl under the terms of the GNU General Public License as published by the
453 dnl Free Software Foundation, either version 3 of the License, or
454 dnl (at your option) any later version.
456 dnl AutoGen is distributed in the hope that it will be useful, but
457 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
458 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
459 dnl See the GNU General Public License for more details.
461 dnl You should have received a copy of the GNU General Public License along
462 dnl with this program. If not, see <http://www.gnu.org/licenses/>.
464 dnl Default to system libopts
466 AC_DEFUN([LIBOPTS_CHECK],[
467 [NEED_LIBOPTS_DIR='']
468 m4_pushdef([AO_Libopts_Dir],
469 [ifelse($1, , [libopts], [$1])])
470 AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
471 AC_ARG_ENABLE([local-libopts],
472 AC_HELP_STRING([--enable-local-libopts],
473 [Force using the supplied libopts tearoff code]),[
474 if test x$enableval = xyes ; then
475 AC_MSG_NOTICE([Using supplied libopts tearoff])
476 LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
477 LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
478 NEED_LIBOPTS_DIR=true
481 AC_ARG_ENABLE([libopts-install],
482 AC_HELP_STRING([--disable-libopts-install],
483 [Do not install libopts with client installation]))
484 AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" != Xno])
486 [if test -z "${NEED_LIBOPTS_DIR}" ; then]
487 AC_MSG_CHECKING([whether autoopts-config can be found])
488 AC_ARG_WITH([autoopts-config],
489 AC_HELP_STRING([--with-autoopts-config],
490 [specify the config-info script]),
491 [lo_cv_with_autoopts_config=${with_autoopts_config}],
492 AC_CACHE_CHECK([whether autoopts-config is specified],
493 [lo_cv_with_autoopts_config],
494 [if autoopts-config --help 2>/dev/null 1>&2
495 then lo_cv_with_autoopts_config=autoopts-config
496 elif libopts-config --help 2>/dev/null 1>&2
497 then lo_cv_with_autoopts_config=libopts-config
498 else lo_cv_with_autoopts_config=no ; fi])
499 ) # end of AC_ARG_WITH
501 AC_CACHE_VAL([lo_cv_test_autoopts],[
502 if test -z "${lo_cv_with_autoopts_config}" \
503 -o X"${lo_cv_with_autoopts_config}" = Xno
505 if autoopts-config --help 2>/dev/null 1>&2
506 then lo_cv_with_autoopts_config=autoopts-config
507 elif libopts-config --help 2>/dev/null 1>&2
508 then lo_cv_with_autoopts_config=libopts-config
509 else lo_cv_with_autoopts_config=false ; fi
511 lo_cv_test_autoopts=`
512 ${lo_cv_with_autoopts_config} --libs` 2> /dev/null
513 if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
514 then lo_cv_test_autoopts=no ; fi
515 ]) # end of CACHE_VAL
516 AC_MSG_RESULT([${lo_cv_test_autoopts}])
518 [if test "X${lo_cv_test_autoopts}" != Xno
520 LIBOPTS_LDADD="${lo_cv_test_autoopts}"
521 LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
523 LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
524 LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
525 NEED_LIBOPTS_DIR=true
527 fi # end of if test -z "${NEED_LIBOPTS_DIR}"]
529 AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
530 AC_SUBST(LIBOPTS_LDADD)
531 AC_SUBST(LIBOPTS_CFLAGS)
532 AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
533 AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
534 m4_popdef([AO_Libopts_Dir])
536 [if test -n "${NEED_LIBOPTS_DIR}" ; then]
537 INVOKE_LIBOPTS_MACROS
539 INVOKE_LIBOPTS_MACROS_FIRST
541 # end of AC_DEFUN of LIBOPTS_CHECK]