corrected verification examples
[gnutls.git] / src / libopts / m4 / libopts.m4
blobce083de1f7e0194489c8951e2a3b4b363970ff7b
1 dnl  -*- buffer-read-only: t -*- vi: set ro:
2 dnl 
3 dnl DO NOT EDIT THIS FILE   (libopts.m4)
4 dnl 
5 dnl It has been AutoGen-ed  May  6, 2012 at 04:20:55 PM by AutoGen 5.16pre36
6 dnl From the definitions    libopts.def
7 dnl and the template file   conftest.tpl
8 dnl
9 dnl do always before generated macros:
10 dnl
11 AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
12   AC_REQUIRE([AC_HEADER_STDC])
13   AC_HEADER_DIRENT
14   
15   # =================
16   # AC_CHECK_HEADERS
17   # =================
18   AC_CHECK_HEADERS([ \
19       sys/mman.h    sys/param.h   sys/poll.h    sys/procset.h \
20       sys/select.h  sys/socket.h  sys/stropts.h sys/time.h \
21       sys/un.h      sys/wait.h    dlfcn.h       errno.h \
22       fcntl.h       libgen.h      memory.h      netinet/in.h \
23       setjmp.h      stdbool.h     sysexits.h    unistd.h \
24       utime.h])
25   
26   AC_CHECK_HEADERS([stdarg.h     varargs.h],
27       [lo_have_arg_hdr=true;break],
28       [lo_have_arg_hdr=false])
29   
30   AC_CHECK_HEADERS([string.h     strings.h],
31       [lo_have_str_hdr=true;break],
32       [lo_have_str_hdr=false])
33   
34   AC_CHECK_HEADERS([limits.h     sys/limits.h  values.h],
35       [lo_have_lim_hdr=true;break],
36       [lo_have_lim_hdr=false])
37   
38   AC_CHECK_HEADERS([inttypes.h   stdint.h],
39       [lo_have_typ_hdr=true;break],
40       [lo_have_typ_hdr=false])
41   
42   # ----------------------------------------------------------------------
43   # check for various programs used during the build.
44   # On OS/X, "wchar.h" needs "runetype.h" to work properly.
45   # ----------------------------------------------------------------------
46   AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
47   AC_INCLUDES_DEFAULT
48   #if HAVE_RUNETYPE_H
49   # include <runetype.h>
50   #endif
51   ])
52   
53   # --------------------------------------------
54   # Verify certain entries from AC_CHECK_HEADERS
55   # --------------------------------------------
56   [for f in sys_types sys_mman sys_param sys_stat sys_wait \
57            string errno stdlib memory setjmp
58   do eval as_ac_var=\${ac_cv_header_${f}_h+set}
59      test "${as_ac_var}" = set || {
60        ]AC_MSG_ERROR([You must have ${f}.h on your system])[
61      }
62   done
63   
64   ${lo_have_arg_hdr} || \
65     ]AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system])[
66   
67   ${lo_have_str_hdr} || \
68     ]AC_MSG_ERROR([You must have string.h or strings.h on your system])[
69   
70   ${lo_have_lim_hdr} || \
71     ]AC_MSG_ERROR(
72       [You must have one of limits.h, sys/limits.h or values.h])[
73   
74   ${lo_have_typ_hdr} || \
75     ]AC_MSG_ERROR([You must have inttypes.h or stdint.h on your system])
76   
77   # ----------------------------------------------------------------------
78   # Checks for typedefs
79   # ----------------------------------------------------------------------
80   AC_CHECK_TYPES(wchar_t)
81   AC_CHECK_TYPES(wint_t, [], [], [
82     AC_INCLUDES_DEFAULT
83     #if HAVE_RUNETYPE_H
84     # include <runetype.h>
85     #endif
86     #if HAVE_WCHAR_H
87     # include <wchar.h>
88     #endif
89   ])
90   AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
91   intptr_t, uintptr_t, uint_t, pid_t, size_t])
92   AC_CHECK_SIZEOF(char*, 8)
93   AC_CHECK_SIZEOF(int,   4)
94   AC_CHECK_SIZEOF(long,  8)
95   AC_CHECK_SIZEOF(short, 2)
96   
97   # ----------------------------------------------------------------------
98   # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
99   # ----------------------------------------------------------------------
100   AC_CHECK_LIB(gen, pathfind)
101   AC_FUNC_VPRINTF
102   AC_FUNC_FORK
103   AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
104                  strrchr strsignal fchmod fstat chmod])
105   AC_PROG_SED
106   [while :
107   do
108       POSIX_SHELL=`which bash`
109       test -x "$POSIX_SHELL" && break
110       POSIX_SHELL=`which dash`
111       test -x "$POSIX_SHELL" && break
112       POSIX_SHELL=/usr/xpg4/bin/sh
113       test -x "$POSIX_SHELL" && break
114       POSIX_SHELL=`/bin/sh -c '
115           exec 2>/dev/null
116           if ! true ; then exit 1 ; fi
117           echo /bin/sh'`
118       test -x "$POSIX_SHELL" && break
119       ]AC_ERROR([Cannot locate a working POSIX shell])[
120   done]
121   AC_DEFINE_UNQUOTED([POSIX_SHELL], ["${POSIX_SHELL}"],
122            [define to a working POSIX compliant shell])
123   AC_SUBST([POSIX_SHELL])
127 dnl @synopsis  INVOKE_LIBOPTS_MACROS
129 dnl  This macro will invoke the AutoConf macros specified in libopts.def
130 dnl  that have not been disabled with "omit-invocation".
132 AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
133   AC_ARG_WITH([regex-header],
134     AS_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
135     [libopts_cv_with_regex_header=${with_regex_header}],
136     AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
137       libopts_cv_with_regex_header=no)
138   ) # end of AC_ARG_WITH
139   if test "X${libopts_cv_with_regex_header}" != Xno
140   then
141     AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
142   else
143     AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
144   fi
145   
146 ]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
149 AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
150   AC_ARG_WITH([libregex],
151     AS_HELP_STRING([--with-libregex], [libregex installation prefix]),
152     [libopts_cv_with_libregex_root=${with_libregex}],
153     AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
154       libopts_cv_with_libregex_root=no)
155   ) # end of AC_ARG_WITH libregex
157   if test "${with_libregex+set}" = set && \
158      test "X${withval}" = Xno
159   then ## disabled by request
160     libopts_cv_with_libregex_root=no
161     libopts_cv_with_libregex_cflags=no
162     libopts_cv_with_libregex_libs=no
163   else
165   AC_ARG_WITH([libregex-cflags],
166     AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
167     [libopts_cv_with_libregex_cflags=${with_libregex_cflags}],
168     AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
169       libopts_cv_with_libregex_cflags=no)
170   ) # end of AC_ARG_WITH libregex-cflags
172   AC_ARG_WITH([libregex-libs],
173     AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
174     [libopts_cv_with_libregex_libs=${with_libregex_libs}],
175     AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
176       libopts_cv_with_libregex_libs=no)
177   ) # end of AC_ARG_WITH libregex-libs
179   case "X${libopts_cv_with_libregex_cflags}" in
180   Xyes|Xno|X )
181     case "X${libopts_cv_with_libregex_root}" in
182     Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
183     * )        libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
184     esac
185   esac
186   case "X${libopts_cv_with_libregex_libs}" in
187   Xyes|Xno|X )
188     case "X${libopts_cv_with_libregex_root}" in
189     Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
190     * )        libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
191     esac
192   esac
193   libopts_save_CPPFLAGS="${CPPFLAGS}"
194   libopts_save_LIBS="${LIBS}"
195   fi ## disabled by request
197   case "X${libopts_cv_with_libregex_cflags}" in
198   Xyes|Xno|X )
199     libopts_cv_with_libregex_cflags="" ;;
200   * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
201   esac
202   case "X${libopts_cv_with_libregex_libs}" in
203   Xyes|Xno|X )
204     libopts_cv_with_libregex_libs="" ;;
205   * )
206     LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
207   esac
208   LIBREGEX_CFLAGS=""
209   LIBREGEX_LIBS=""
210   AC_MSG_CHECKING([whether libregex functions properly])
211   AC_CACHE_VAL([libopts_cv_with_libregex],[
212   AC_TRY_RUN([@%:@include <stdio.h>
213 @%:@include <stdlib.h>
214 @%:@include <sys/types.h>
215 @%:@include REGEX_HEADER
216 static regex_t re;
217 void comp_re( char const* pzPat ) {
218   int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
219   if (res == 0) return;
220   exit( res ); }
221 int main() {
222   regmatch_t m@<:@2@:>@;
223   comp_re( "^.*\@S|@"   );
224   comp_re( "()|no.*" );
225   comp_re( "."       );
226   if (regexec( &re, "X", 2, m, 0 ) != 0)  return 1;
227   if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
228     fputs( "error: regex -->.<-- did not match\n", stderr );
229     return 1;
230   }
231   return 0; }],
232     [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
233     [libopts_cv_with_libregex=no]) # end of AC_TRY_RUN 
234   ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
235   AC_MSG_RESULT([${libopts_cv_with_libregex}])
236   if test "X${libopts_cv_with_libregex}" != Xno
237   then
238     AC_DEFINE([WITH_LIBREGEX],[1],
239         [Define this if a working libregex can be found])
240   else
241     CPPFLAGS="${libopts_save_CPPFLAGS}"
242     LIBS="${libopts_save_LIBS}"
243   fi
244   
245 ]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
248 AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
249   AC_MSG_CHECKING([whether pathfind(3) works])
250   AC_CACHE_VAL([libopts_cv_run_pathfind],[
251   AC_TRY_RUN([@%:@include <string.h>
252 @%:@include <stdlib.h>
253 int main (int argc, char** argv) {
254    char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
255    return (pz == 0) ? 1 : 0;
257     [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
258   ) # end of TRY_RUN
259   ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
260   AC_MSG_RESULT([${libopts_cv_run_pathfind}])
261   if test "X${libopts_cv_run_pathfind}" != Xno
262   then
263     AC_DEFINE([HAVE_PATHFIND],[1],
264         [Define this if pathfind(3) works])
265   fi
266   
267 ]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
270 AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
271   AC_MSG_CHECKING([whether /dev/zero is readable device])
272   AC_CACHE_VAL([libopts_cv_test_dev_zero],[
273     libopts_cv_test_dev_zero=`exec 2> /dev/null
274 dzero=\`ls -lL /dev/zero | egrep ^c......r\`
275 test -z "${dzero}" && exit 1
276 echo ${dzero}`
277     if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero"
278     then libopts_cv_test_dev_zero=no
279     fi
280   ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
281   AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
282   if test "X${libopts_cv_test_dev_zero}" != Xno
283   then
284     AC_DEFINE([HAVE_DEV_ZERO],[1],
285         [Define this if /dev/zero is readable device])
286   fi
287   
288 ]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
291 AC_DEFUN([LIBOPTS_RUN_REALPATH],[
292   AC_MSG_CHECKING([whether we have a functional realpath(3C)])
293   AC_CACHE_VAL([libopts_cv_run_realpath],[
294   AC_TRY_RUN([@%:@include <limits.h>
295 @%:@include <stdlib.h>
296 int main (int argc, char** argv) {
297 @%:@ifndef PATH_MAX
298 choke me!!
299 @%:@else
300    char zPath@<:@PATH_MAX+1@:>@;
301 @%:@endif
302    char *pz = realpath(argv@<:@0@:>@, zPath);
303    return (pz == zPath) ? 0 : 1;
305     [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
306   ) # end of TRY_RUN
307   ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
308   AC_MSG_RESULT([${libopts_cv_run_realpath}])
309   if test "X${libopts_cv_run_realpath}" != Xno
310   then
311     AC_DEFINE([HAVE_REALPATH],[1],
312         [Define this if we have a functional realpath(3C)])
313   fi
314   
315 ]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
318 AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
319   AC_MSG_CHECKING([whether strftime() works])
320   AC_CACHE_VAL([libopts_cv_run_strftime],[
321   AC_TRY_RUN([@%:@include <time.h>
322 @%:@include <string.h>
323 char t_buf@<:@ 64 @:>@;
324 int main() {
325   static char const z@<:@@:>@ = "Thursday Aug 28 240";
326   struct tm tm;
327   tm.tm_sec   = 36;  /* seconds after the minute @<:@0, 61@:>@  */
328   tm.tm_min   = 44;  /* minutes after the hour @<:@0, 59@:>@ */
329   tm.tm_hour  = 12;  /* hour since midnight @<:@0, 23@:>@ */
330   tm.tm_mday  = 28;  /* day of the month @<:@1, 31@:>@ */
331   tm.tm_mon   =  7;  /* months since January @<:@0, 11@:>@ */
332   tm.tm_year  = 86;  /* years since 1900 */
333   tm.tm_wday  =  4;  /* days since Sunday @<:@0, 6@:>@ */
334   tm.tm_yday  = 239; /* days since January 1 @<:@0, 365@:>@ */
335   tm.tm_isdst =  1;  /* flag for daylight savings time */
336   strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
337   return (strcmp( t_buf, z ) != 0); }],
338     [libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
339   ) # end of TRY_RUN
340   ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
341   AC_MSG_RESULT([${libopts_cv_run_strftime}])
342   if test "X${libopts_cv_run_strftime}" != Xno
343   then
344     AC_DEFINE([HAVE_STRFTIME],[1],
345         [Define this if strftime() works])
346   fi
347   
348 ]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
351 AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
352   AC_MSG_CHECKING([whether fopen accepts "b" mode])
353   AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
354   AC_TRY_RUN([@%:@include <stdio.h>
355 int main (int argc, char** argv) {
356 FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
357 return (fp == NULL) ? 1 : fclose(fp); }],
358     [libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
359   ) # end of TRY_RUN
360   ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
361   AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
362   if test "X${libopts_cv_run_fopen_binary}" != Xno
363   then
364     AC_DEFINE([FOPEN_BINARY_FLAG],"b",
365         [fopen(3) accepts a 'b' in the mode flag])
366   else
367     AC_DEFINE([FOPEN_BINARY_FLAG],"",
368         [fopen(3) accepts a 'b' in the mode flag])
369   fi
370   
371 ]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
374 AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
375   AC_MSG_CHECKING([whether fopen accepts "t" mode])
376   AC_CACHE_VAL([libopts_cv_run_fopen_text],[
377   AC_TRY_RUN([@%:@include <stdio.h>
378 int main (int argc, char** argv) {
379 FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
380 return (fp == NULL) ? 1 : fclose(fp); }],
381     [libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
382   ) # end of TRY_RUN
383   ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
384   AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
385   if test "X${libopts_cv_run_fopen_text}" != Xno
386   then
387     AC_DEFINE([FOPEN_TEXT_FLAG],"t",
388         [fopen(3) accepts a 't' in the mode flag])
389   else
390     AC_DEFINE([FOPEN_TEXT_FLAG],"",
391         [fopen(3) accepts a 't' in the mode flag])
392   fi
393   
394 ]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
397 AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[
398   AC_ARG_ENABLE([optional-args],
399     AS_HELP_STRING([--disable-optional-args], [not wanting optional option args]),
400     [libopts_cv_enable_optional_args=${enable_optional_args}],
401     AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args,
402       libopts_cv_enable_optional_args=yes)
403   ) # end of AC_ARG_ENABLE
404   if test "X${libopts_cv_enable_optional_args}" = Xno
405   then
406     AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1],
407           [Define this if optional arguments are disallowed])
408   fi
409   
410 ]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS
413 AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
414   AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST])
415   # Check to see if a reg expr header is specified.
416   LIBOPTS_WITH_REGEX_HEADER
418   # Check to see if a working libregex can be found.
419   LIBOPTS_WITHLIB_REGEX
421   # Check to see if pathfind(3) works.
422   LIBOPTS_RUN_PATHFIND
424   # Check to see if /dev/zero is readable device.
425   LIBOPTS_TEST_DEV_ZERO
427   # Check to see if we have a functional realpath(3C).
428   LIBOPTS_RUN_REALPATH
430   # Check to see if strftime() works.
431   LIBOPTS_RUN_STRFTIME
433   # Check to see if fopen accepts "b" mode.
434   LIBOPTS_RUN_FOPEN_BINARY
436   # Check to see if fopen accepts "t" mode.
437   LIBOPTS_RUN_FOPEN_TEXT
439   # Check to see if not wanting optional option args.
440   LIBOPTS_DISABLE_OPTIONAL_ARGS
442 ]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
444 dnl @synopsis  LIBOPTS_CHECK
446 dnl Time-stamp:        "2012-02-25 12:54:32 bkorb"
448 dnl If autoopts-config works, add the linking information to LIBS.
449 dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
450 dnl the config tests that the library needs.  Invoke the
451 dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
453 dnl  This file is part of AutoGen.
454 dnl  AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
456 dnl  AutoGen is free software: you can redistribute it and/or modify it
457 dnl  under the terms of the GNU General Public License as published by the
458 dnl  Free Software Foundation, either version 3 of the License, or
459 dnl  (at your option) any later version.
461 dnl  AutoGen is distributed in the hope that it will be useful, but
462 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
463 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
464 dnl  See the GNU General Public License for more details.
466 dnl  You should have received a copy of the GNU General Public License along
467 dnl  with this program.  If not, see <http://www.gnu.org/licenses/>.
469 dnl Default to system libopts
471 AC_DEFUN([LIBOPTS_CHECK_COMMON],[
472   AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST])
473   [NEED_LIBOPTS_DIR='']
474   m4_pushdef([AO_Libopts_Dir],
475             [ifelse($1, , [libopts], [$1])])
476   AC_ARG_ENABLE([local-libopts],
477     AC_HELP_STRING([--enable-local-libopts],
478        [Use the supplied libopts tearoff code]),[
479     if test x$enableval = xyes ; then
480        AC_MSG_NOTICE([Using supplied libopts tearoff])
481        LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
482        NEED_LIBOPTS_DIR=true
483        LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
484     fi])
486   AC_ARG_ENABLE([libopts-install],
487     AC_HELP_STRING([--enable-libopts-install],
488        [Install libopts with client installation]))
489   AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" = Xyes])
491   [if test -z "${NEED_LIBOPTS_DIR}" ; then]
492      AC_MSG_CHECKING([whether autoopts-config can be found])
493      AC_ARG_WITH([autoopts-config],
494         AC_HELP_STRING([--with-autoopts-config],
495              [specify the config-info script]),
496         [lo_cv_with_autoopts_config=${with_autoopts_config}],
497         AC_CACHE_CHECK([whether autoopts-config is specified],
498              [lo_cv_with_autoopts_config],
499              [if autoopts-config --help 2>/dev/null 1>&2
500         then lo_cv_with_autoopts_config=autoopts-config
501         elif libopts-config --help 2>/dev/null 1>&2
502         then lo_cv_with_autoopts_config=libopts-config
503         else lo_cv_with_autoopts_config=no ; fi])
504      ) # end of AC_ARG_WITH
506      AC_CACHE_VAL([lo_cv_test_autoopts],[
507         if test -z "${lo_cv_with_autoopts_config}" \
508                 -o X"${lo_cv_with_autoopts_config}" = Xno
509         then
510            if autoopts-config --help 2>/dev/null 1>&2
511            then lo_cv_with_autoopts_config=autoopts-config
512            elif libopts-config --help 2>/dev/null 1>&2
513            then lo_cv_with_autoopts_config=libopts-config
514            else lo_cv_with_autoopts_config=false ; fi
515         fi
516         lo_cv_test_autoopts=`
517             ${lo_cv_with_autoopts_config} --libs` 2> /dev/null
518         if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
519         then lo_cv_test_autoopts=no ; fi
520      ]) # end of CACHE_VAL
521      AC_MSG_RESULT([${lo_cv_test_autoopts}])
523      [if test "X${lo_cv_test_autoopts}" != Xno
524      then
525         LIBOPTS_LDADD="${lo_cv_test_autoopts}"
526         LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
527      else
528         LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
529         LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
530         NEED_LIBOPTS_DIR=true
531      fi
532   fi # end of if test -z "${NEED_LIBOPTS_DIR}"
533   if test -n "${LIBOPTS_BUILD_BLOCKED}" ; then
534     NEED_LIBOPTS_DIR=''
535   fi]
536   AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
537   AC_SUBST(LIBOPTS_LDADD)
538   AC_SUBST(LIBOPTS_CFLAGS)
539   AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
540   m4_popdef([AO_Libopts_Dir])
541 [# end of AC_DEFUN of LIBOPTS_CHECK_COMMON]
544 dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however
545 dnl AM_COND_IF is new to Automake 1.11.  To use it on new Automake without
546 dnl requiring same, a fallback implementation for older Automake is provided.
547 dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code
548 dnl is correct only in terms of m4sh generated script.
550 m4_ifndef([AM_COND_IF],
551   [AC_DEFUN([AM_COND_IF], [
552     if test -z "$$1_TRUE"; then :
553       m4_n([$2])[]dnl
554       m4_ifval([$3],[
555     else
556       $3
557     ])dnl
558     fi[]dnl
559   ])dnl
562 AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [
563   m4_pushdef([AO_Libopts_Dir],
564               [ifelse($1, , [libopts], [$1])])
565   LIBOPTS_BUILD_BLOCKED=true
566   LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
567   m4_popdef([AO_Libopts_Dir])dnl
568 # end of AC_DEFUN of LIBOPTS_CHECK_NOBUILD
571 AC_DEFUN([LIBOPTS_CHECK], [
572   m4_pushdef([AO_Libopts_Dir],
573               [ifelse($1, , [libopts], [$1])])
574   LIBOPTS_BUILD_BLOCKED=''
575   LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
576   AM_COND_IF([NEED_LIBOPTS], [
577     INVOKE_LIBOPTS_MACROS
578     AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
579   ])dnl
580   m4_popdef([AO_Libopts_Dir])dnl
581 # end of AC_DEFUN of LIBOPTS_CHECK