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