1181834Srobertodnl  -*- buffer-read-only: t -*- vi: set ro:
2181834Srobertodnl 
3181834Srobertodnl DO NOT EDIT THIS FILE   (libopts.m4)
4181834Srobertodnl 
5181834Srobertodnl It has been AutoGen-ed  Saturday May  5, 2007 at 12:02:37 PM PDT
6181834Srobertodnl From the definitions    libopts.def
7181834Srobertodnl and the template file   conftest.tpl
8181834Srobertodnl
9181834Srobertodnl do always before generated macros:
10181834Srobertodnl
11181834SrobertoAC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
12181834Sroberto[if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then]
13181834Sroberto  # =================
14181834Sroberto  # AC_HEADER_STDC
15181834Sroberto  # =================
16181834Sroberto  AC_HEADER_STDC
17181834Sroberto  # =================
18181834Sroberto  # AC_HEADER_DIRENT
19181834Sroberto  # =================
20181834Sroberto  AC_HEADER_DIRENT
21181834Sroberto  
22181834Sroberto  # =================
23181834Sroberto  # AC_CHECK_HEADERS
24181834Sroberto  # =================
25181834Sroberto  AC_CHECK_HEADERS(dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \
26181834Sroberto    setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \
27181834Sroberto    sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h    \
28181834Sroberto    utime.h sysexits.h)
29181834Sroberto  
30181834Sroberto  # --------------------------------------------
31181834Sroberto  # Verify certain entries from AC_CHECK_HEADERS
32181834Sroberto  # --------------------------------------------
33181834Sroberto  [for f in sys_types sys_mman sys_param sys_stat sys_wait \
34181834Sroberto           string errno stdlib memory setjmp
35181834Sroberto  do eval as_ac_var=\${ac_cv_header_${f}_h+set}
36181834Sroberto     test "${as_ac_var}" = set] || \
37181834Sroberto       AC_MSG_ERROR([You must have ${f}.h on your system])
38181834Sroberto  done
39181834Sroberto  
40181834Sroberto  # ================================================
41181834Sroberto  # AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise
42181834Sroberto  # if varargs.h is present define HAVE_VARARGS_H.
43181834Sroberto  # ================================================
44181834Sroberto  AC_CHECK_HEADERS(stdarg.h varargs.h, break)
45181834Sroberto  [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
46181834Sroberto    AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system])
47181834Sroberto  fi
48181834Sroberto  
49181834Sroberto  # ================================================
50181834Sroberto  # Similarly for the string.h and strings.h headers
51181834Sroberto  # ================================================
52181834Sroberto  AC_CHECK_HEADERS(string.h strings.h, break)
53181834Sroberto  [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
54181834Sroberto    AC_MSG_ERROR([You must have string.h or strings.h on your system])
55181834Sroberto  fi
56181834Sroberto  
57181834Sroberto  # =====================
58181834Sroberto  # ...and limits headers
59181834Sroberto  # =====================
60181834Sroberto  AC_CHECK_HEADERS(limits.h sys/limits.h values.h, break)
61181834Sroberto  [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
62181834Sroberto    AC_MSG_ERROR([You must have one of limits.h, sys/limits.h or values.h])
63181834Sroberto  fi
64181834Sroberto  
65181834Sroberto  # ========================
66181834Sroberto  # ...and int types headers
67181834Sroberto  # ========================
68181834Sroberto  AC_CHECK_HEADERS(stdint.h inttypes.h, break)
69181834Sroberto  AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
70181834Sroberto     intptr_t, uint_t])
71181834Sroberto  
72181834Sroberto  # ====================
73181834Sroberto  # uintptr type & sizes
74181834Sroberto  # ====================
75181834Sroberto  AC_CHECK_TYPES([uintptr_t], ,
76181834Sroberto         [AC_DEFINE([uintptr_t], unsigned long,
77181834Sroberto                    [Alternate uintptr_t for systems without it.])])
78181834Sroberto  AC_CHECK_SIZEOF(char*, 4)
79181834Sroberto  AC_CHECK_SIZEOF(int,   4)
80181834Sroberto  AC_CHECK_SIZEOF(long,  4)
81181834Sroberto  AC_CHECK_SIZEOF(short, 2)
82181834Sroberto  
83181834Sroberto  # ----------------------------------------------------------------------
84181834Sroberto  # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
85181834Sroberto  # ----------------------------------------------------------------------
86181834Sroberto  AC_CHECK_LIB(gen, pathfind)
87181834Sroberto  AC_FUNC_VPRINTF
88181834Sroberto  AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr])
89181834Sroberto[  INVOKE_LIBOPTS_MACROS_FIRST_done=yes
90181834Srobertofi]])
91181834Sroberto
92181834Srobertodnl
93181834Srobertodnl @synopsis  INVOKE_LIBOPTS_MACROS
94181834Srobertodnl
95181834Srobertodnl  This macro will invoke the AutoConf macros specified in libopts.def
96181834Srobertodnl  that have not been disabled with "omit-invocation".
97181834Srobertodnl
98181834SrobertoAC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
99181834Sroberto  AC_ARG_WITH([regex-header],
100181834Sroberto    AC_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
101181834Sroberto    [libopts_cv_with_regex_header=${with_regex_header}],
102181834Sroberto    AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
103181834Sroberto      libopts_cv_with_regex_header=no)
104181834Sroberto  ) # end of AC_ARG_WITH
105181834Sroberto
106181834Sroberto  if test "X${libopts_cv_with_regex_header}" != Xno
107181834Sroberto  then
108181834Sroberto    AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
109181834Sroberto  else
110181834Sroberto    AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
111181834Sroberto  fi
112181834Sroberto  
113181834Sroberto]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
114181834Sroberto
115181834Sroberto
116181834SrobertoAC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
117181834Sroberto  AC_ARG_WITH([libregex],
118181834Sroberto    AC_HELP_STRING([--with-libregex], [libregex installation prefix]),
119181834Sroberto    [libopts_cv_with_libregex_root=${with_libregex}],
120181834Sroberto    AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
121181834Sroberto      libopts_cv_with_libregex_root=no)
122181834Sroberto  ) # end of AC_ARG_WITH libregex
123181834Sroberto
124181834Sroberto  if test "${with_libguile+set}" = set && \
125181834Sroberto     test "${withval}" = no
126181834Sroberto  then ## disabled by request
127181834Sroberto    libopts_cv_with_libregex_root=no
128181834Sroberto    libopts_cv_with_libregex_cflags=no
129181834Sroberto    libopts_cv_with_libregex_libs=no
130181834Sroberto  else
131181834Sroberto
132181834Sroberto  AC_ARG_WITH([libregex-cflags],
133181834Sroberto    AC_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
134181834Sroberto    [libopts_cv_with_libregex_cflags=${with_regex_cflags}],
135181834Sroberto    AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
136181834Sroberto      libopts_cv_with_libregex_cflags=no)
137181834Sroberto  ) # end of AC_ARG_WITH libregex-cflags
138181834Sroberto
139181834Sroberto  AC_ARG_WITH([libregex-libs],
140181834Sroberto    AC_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
141181834Sroberto    [libopts_cv_with_libregex_libs=${with_regex_libs}],
142181834Sroberto    AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
143181834Sroberto      libopts_cv_with_libregex_libs=no)
144181834Sroberto  ) # end of AC_ARG_WITH libregex-libs
145181834Sroberto
146181834Sroberto  case "X${libopts_cv_with_libregex_cflags}" in
147181834Sroberto  Xyes|Xno|X )
148181834Sroberto    case "X${libopts_cv_with_libregex_root}" in
149181834Sroberto    Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
150181834Sroberto    * )        libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
151181834Sroberto    esac
152181834Sroberto  esac
153181834Sroberto  case "X${libopts_cv_with_libregex_libs}" in
154181834Sroberto  Xyes|Xno|X )
155181834Sroberto    case "X${libopts_cv_with_libregex_root}" in
156181834Sroberto    Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
157181834Sroberto    * )        libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
158181834Sroberto    esac
159181834Sroberto  esac
160181834Sroberto  libopts_save_CPPFLAGS="${CPPFLAGS}"
161181834Sroberto  libopts_save_LIBS="${LIBS}"
162181834Sroberto  fi ## disabled by request
163181834Sroberto
164181834Sroberto  case "X${libopts_cv_with_libregex_cflags}" in
165181834Sroberto  Xyes|Xno|X )
166181834Sroberto    libopts_cv_with_libregex_cflags="" ;;
167181834Sroberto  * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
168181834Sroberto  esac
169181834Sroberto  case "X${libopts_cv_with_libregex_libs}" in
170181834Sroberto  Xyes|Xno|X )
171181834Sroberto    libopts_cv_with_libregex_libs="" ;;
172181834Sroberto  * )
173181834Sroberto    LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
174181834Sroberto  esac
175181834Sroberto  LIBREGEX_CFLAGS=""
176181834Sroberto  LIBREGEX_LIBS=""
177181834Sroberto  AC_MSG_CHECKING([whether libregex functions properly])
178181834Sroberto  AC_CACHE_VAL([libopts_cv_with_libregex],[
179181834Sroberto  AC_TRY_RUN([@%:@include <stdio.h>
180181834Sroberto@%:@include <stdlib.h>
181181834Sroberto@%:@include <sys/types.h>
182181834Sroberto@%:@include REGEX_HEADER
183181834Srobertostatic regex_t re;
184181834Srobertovoid comp_re( char const* pzPat ) {
185181834Sroberto  int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
186181834Sroberto  if (res == 0) return;
187181834Sroberto  exit( res ); }
188181834Srobertoint main() {
189181834Sroberto  regmatch_t m@<:@2@:>@;
190181834Sroberto  comp_re( "^.*\@S|@"   );
191181834Sroberto  comp_re( "()|no.*" );
192181834Sroberto  comp_re( "."       );
193181834Sroberto  if (regexec( &re, "X", 2, m, 0 ) != 0)  return 1;
194181834Sroberto  if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
195181834Sroberto    fputs( "error: regex -->.<-- did not match\n", stderr );
196181834Sroberto    return 1;
197181834Sroberto  }
198181834Sroberto  return 0; }],
199181834Sroberto    [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
200181834Sroberto    [libopts_cv_with_libregex=no]) # end of AC_TRY_RUN 
201181834Sroberto  ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
202181834Sroberto  AC_MSG_RESULT([${libopts_cv_with_libregex}])
203181834Sroberto
204181834Sroberto  if test "X${libopts_cv_with_libregex}" != Xno
205181834Sroberto  then
206181834Sroberto    AC_DEFINE([WITH_LIBREGEX],[1],
207181834Sroberto        [Define this if a working libregex can be found])
208181834Sroberto  else
209181834Sroberto    CPPFLAGS="${libopts_save_CPPFLAGS}"
210181834Sroberto    LIBS="${libopts_save_LIBS}"
211181834Sroberto  fi
212181834Sroberto  
213181834Sroberto]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
214181834Sroberto
215181834Sroberto
216181834SrobertoAC_DEFUN([LIBOPTS_RUN_PATHFIND],[
217181834Sroberto  AC_MSG_CHECKING([whether pathfind(3) works])
218181834Sroberto  AC_CACHE_VAL([libopts_cv_run_pathfind],[
219181834Sroberto  AC_TRY_RUN([@%:@include <string.h>
220181834Sroberto@%:@include <stdlib.h>
221181834Srobertoint main (int argc, char** argv) {
222181834Sroberto   char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
223181834Sroberto   return (pz == 0) ? 1 : 0;
224181834Sroberto}],
225181834Sroberto    [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
226181834Sroberto  ) # end of TRY_RUN
227181834Sroberto  ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
228181834Sroberto  AC_MSG_RESULT([${libopts_cv_run_pathfind}])
229181834Sroberto
230181834Sroberto  if test "X${libopts_cv_run_pathfind}" != Xno
231181834Sroberto  then
232181834Sroberto    AC_DEFINE([HAVE_PATHFIND],[1],
233181834Sroberto        [Define this if pathfind(3) works])
234181834Sroberto  fi
235181834Sroberto  
236181834Sroberto]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
237181834Sroberto
238181834Sroberto
239181834SrobertoAC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
240181834Sroberto  AC_MSG_CHECKING([whether /dev/zero is readable device])
241181834Sroberto  AC_CACHE_VAL([libopts_cv_test_dev_zero],[
242181834Sroberto    libopts_cv_test_dev_zero=`exec 2> /dev/null
243181834Srobertodzero=\`ls -lL /dev/zero | egrep ^c......r\`
244181834Srobertotest -z "${dzero}" && exit 1
245181834Srobertoecho ${dzero}`
246181834Sroberto    if test $? -ne 0
247181834Sroberto    then libopts_cv_test_dev_zero=no
248181834Sroberto    elif test -z "$libopts_cv_test_dev_zero"
249181834Sroberto    then libopts_cv_test_dev_zero=no
250181834Sroberto    fi
251181834Sroberto  ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
252181834Sroberto  AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
253181834Sroberto
254181834Sroberto  if test "X${libopts_cv_test_dev_zero}" != Xno
255181834Sroberto  then
256181834Sroberto    AC_DEFINE([HAVE_DEV_ZERO],[1],
257181834Sroberto        [Define this if /dev/zero is readable device])
258181834Sroberto  fi
259181834Sroberto  
260181834Sroberto]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
261181834Sroberto
262181834Sroberto
263181834SrobertoAC_DEFUN([LIBOPTS_RUN_REALPATH],[
264181834Sroberto  AC_MSG_CHECKING([whether we have a functional realpath(3C)])
265181834Sroberto  AC_CACHE_VAL([libopts_cv_run_realpath],[
266181834Sroberto  AC_TRY_RUN([@%:@include <limits.h>
267181834Sroberto@%:@include <stdlib.h>
268181834Srobertoint main (int argc, char** argv) {
269181834Sroberto@%:@ifndef PATH_MAX
270181834Srobertochoke me!!
271181834Sroberto@%:@else
272181834Sroberto   char zPath@<:@PATH_MAX+1@:>@;
273181834Sroberto@%:@endif
274181834Sroberto   char *pz = realpath(argv@<:@0@:>@, zPath);
275181834Sroberto   return (pz == zPath) ? 0 : 1;
276181834Sroberto}],
277181834Sroberto    [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
278181834Sroberto  ) # end of TRY_RUN
279181834Sroberto  ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
280181834Sroberto  AC_MSG_RESULT([${libopts_cv_run_realpath}])
281181834Sroberto
282181834Sroberto  if test "X${libopts_cv_run_realpath}" != Xno
283181834Sroberto  then
284181834Sroberto    AC_DEFINE([HAVE_REALPATH],[1],
285181834Sroberto        [Define this if we have a functional realpath(3C)])
286181834Sroberto  fi
287181834Sroberto  
288181834Sroberto]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
289181834Sroberto
290181834Sroberto
291181834SrobertoAC_DEFUN([LIBOPTS_RUN_STRFTIME],[
292181834Sroberto  AC_MSG_CHECKING([whether strftime() works])
293181834Sroberto  AC_CACHE_VAL([libopts_cv_run_strftime],[
294181834Sroberto  AC_TRY_RUN([@%:@include <time.h>
295181834Sroberto@%:@include <string.h>
296181834Srobertochar t_buf@<:@ 64 @:>@;
297181834Srobertoint main() {
298181834Sroberto  static char const z@<:@@:>@ = "Thursday Aug 28 240";
299181834Sroberto  struct tm tm;
300181834Sroberto  tm.tm_sec   = 36;  /* seconds after the minute @<:@0, 61@:>@  */
301181834Sroberto  tm.tm_min   = 44;  /* minutes after the hour @<:@0, 59@:>@ */
302181834Sroberto  tm.tm_hour  = 12;  /* hour since midnight @<:@0, 23@:>@ */
303181834Sroberto  tm.tm_mday  = 28;  /* day of the month @<:@1, 31@:>@ */
304181834Sroberto  tm.tm_mon   =  7;  /* months since January @<:@0, 11@:>@ */
305181834Sroberto  tm.tm_year  = 86;  /* years since 1900 */
306181834Sroberto  tm.tm_wday  =  4;  /* days since Sunday @<:@0, 6@:>@ */
307181834Sroberto  tm.tm_yday  = 239; /* days since January 1 @<:@0, 365@:>@ */
308181834Sroberto  tm.tm_isdst =  1;  /* flag for daylight savings time */
309181834Sroberto  strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
310181834Sroberto  return (strcmp( t_buf, z ) != 0); }],
311181834Sroberto    [libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
312181834Sroberto  ) # end of TRY_RUN
313181834Sroberto  ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
314181834Sroberto  AC_MSG_RESULT([${libopts_cv_run_strftime}])
315181834Sroberto
316181834Sroberto  if test "X${libopts_cv_run_strftime}" != Xno
317181834Sroberto  then
318181834Sroberto    AC_DEFINE([HAVE_STRFTIME],[1],
319181834Sroberto        [Define this if strftime() works])
320181834Sroberto  fi
321181834Sroberto  
322181834Sroberto]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
323181834Sroberto
324181834Sroberto
325181834SrobertoAC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
326181834Sroberto  AC_MSG_CHECKING([whether fopen accepts "b" mode])
327181834Sroberto  AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
328181834Sroberto  AC_TRY_RUN([@%:@include <stdio.h>
329181834Srobertoint main (int argc, char** argv) {
330181834SrobertoFILE* fp = fopen("conftest.@S|@ac_ext", "rb");
331181834Srobertoreturn (fp == NULL) ? 1 : fclose(fp); }],
332181834Sroberto    [libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
333181834Sroberto  ) # end of TRY_RUN
334181834Sroberto  ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
335181834Sroberto  AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
336181834Sroberto
337181834Sroberto  if test "X${libopts_cv_run_fopen_binary}" != Xno
338181834Sroberto  then
339181834Sroberto    AC_DEFINE([FOPEN_BINARY_FLAG],"b",
340181834Sroberto	[fopen(3) accepts a 'b' in the mode flag])
341181834Sroberto  else
342181834Sroberto    AC_DEFINE([FOPEN_BINARY_FLAG],"",
343181834Sroberto	[fopen(3) accepts a 'b' in the mode flag])
344181834Sroberto  fi
345181834Sroberto  
346181834Sroberto]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
347181834Sroberto
348181834Sroberto
349181834SrobertoAC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
350181834Sroberto  AC_MSG_CHECKING([whether fopen accepts "t" mode])
351181834Sroberto  AC_CACHE_VAL([libopts_cv_run_fopen_text],[
352181834Sroberto  AC_TRY_RUN([@%:@include <stdio.h>
353181834Srobertoint main (int argc, char** argv) {
354181834SrobertoFILE* fp = fopen("conftest.@S|@ac_ext", "rt");
355181834Srobertoreturn (fp == NULL) ? 1 : fclose(fp); }],
356181834Sroberto    [libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
357181834Sroberto  ) # end of TRY_RUN
358181834Sroberto  ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
359181834Sroberto  AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
360181834Sroberto
361181834Sroberto  if test "X${libopts_cv_run_fopen_text}" != Xno
362181834Sroberto  then
363181834Sroberto    AC_DEFINE([FOPEN_TEXT_FLAG],"t",
364181834Sroberto	[fopen(3) accepts a 't' in the mode flag])
365181834Sroberto  else
366181834Sroberto    AC_DEFINE([FOPEN_TEXT_FLAG],"",
367181834Sroberto	[fopen(3) accepts a 't' in the mode flag])
368181834Sroberto  fi
369181834Sroberto  
370181834Sroberto]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
371181834Sroberto
372181834Sroberto
373181834SrobertoAC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[
374181834Sroberto  AC_ARG_ENABLE([optional-args],
375181834Sroberto    AC_HELP_STRING([--disable-optional-args], [not wanting optional option args]),
376181834Sroberto    [libopts_cv_enable_optional_args=${enable_optional_args}],
377181834Sroberto    AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args,
378181834Sroberto      libopts_cv_enable_optional_args=yes)
379181834Sroberto  ) # end of AC_ARG_ENABLE
380181834Sroberto
381181834Sroberto  if test "X${libopts_cv_enable_optional_args}" = Xno
382181834Sroberto  then
383181834Sroberto    AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1],
384181834Sroberto          [Define this if optional arguments are disallowed])
385181834Sroberto  fi
386181834Sroberto  
387181834Sroberto]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS
388181834Sroberto
389181834Sroberto
390181834SrobertoAC_DEFUN([INVOKE_LIBOPTS_MACROS],[
391181834Sroberto  INVOKE_LIBOPTS_MACROS_FIRST
392181834Sroberto  # Check to see if a reg expr header is specified.
393181834Sroberto  LIBOPTS_WITH_REGEX_HEADER
394181834Sroberto
395181834Sroberto  # Check to see if a working libregex can be found.
396181834Sroberto  LIBOPTS_WITHLIB_REGEX
397181834Sroberto
398181834Sroberto  # Check to see if pathfind(3) works.
399181834Sroberto  LIBOPTS_RUN_PATHFIND
400181834Sroberto
401181834Sroberto  # Check to see if /dev/zero is readable device.
402181834Sroberto  LIBOPTS_TEST_DEV_ZERO
403181834Sroberto
404181834Sroberto  # Check to see if we have a functional realpath(3C).
405181834Sroberto  LIBOPTS_RUN_REALPATH
406181834Sroberto
407181834Sroberto  # Check to see if strftime() works.
408181834Sroberto  LIBOPTS_RUN_STRFTIME
409181834Sroberto
410181834Sroberto  # Check to see if fopen accepts "b" mode.
411181834Sroberto  LIBOPTS_RUN_FOPEN_BINARY
412181834Sroberto
413181834Sroberto  # Check to see if fopen accepts "t" mode.
414181834Sroberto  LIBOPTS_RUN_FOPEN_TEXT
415181834Sroberto
416181834Sroberto  # Check to see if not wanting optional option args.
417181834Sroberto  LIBOPTS_DISABLE_OPTIONAL_ARGS
418181834Sroberto
419181834Sroberto]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
420181834Sroberto
421181834Srobertodnl @synopsis  LIBOPTS_CHECK
422181834Srobertodnl
423181834Srobertodnl Time-stamp:        "2006-09-23 19:36:24 bkorb"
424181834Srobertodnl Last Committed:    $Date: 2006/09/24 02:59:00 $
425181834Srobertodnl
426181834Srobertodnl If autoopts-config works, add the linking information to LIBS.
427181834Srobertodnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
428181834Srobertodnl the config tests that the library needs.  Invoke the
429181834Srobertodnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
430181834Srobertodnl
431181834Srobertodnl Default to system libopts
432181834Srobertodnl
433181834SrobertoAC_DEFUN([LIBOPTS_CHECK],[
434181834Sroberto  [NEED_LIBOPTS_DIR='']
435181834Sroberto  m4_pushdef([AO_Libopts_Dir],
436181834Sroberto	    [ifelse($1, , [libopts], [$1])])
437181834Sroberto  AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
438181834Sroberto  AC_ARG_ENABLE([local-libopts],
439181834Sroberto    AC_HELP_STRING([--enable-local-libopts],
440181834Sroberto       [Force using the supplied libopts tearoff code]),[
441181834Sroberto    if test x$enableval = xyes ; then
442181834Sroberto       AC_MSG_NOTICE([Using supplied libopts tearoff])
443181834Sroberto       LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
444181834Sroberto       LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
445181834Sroberto       NEED_LIBOPTS_DIR=true
446181834Sroberto    fi])
447181834Sroberto
448181834Sroberto  AC_ARG_ENABLE([libopts-install],
449181834Sroberto    AC_HELP_STRING([--disable-libopts-install],
450181834Sroberto       [Do not install libopts with client installation]))
451181834Sroberto  AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" != Xno])
452181834Sroberto
453181834Sroberto  [if test -z "${NEED_LIBOPTS_DIR}" ; then]
454181834Sroberto     AC_MSG_CHECKING([whether autoopts-config can be found])
455181834Sroberto     AC_ARG_WITH([autoopts-config],
456181834Sroberto        AC_HELP_STRING([--with-autoopts-config],
457181834Sroberto             [specify the config-info script]),
458181834Sroberto        [lo_cv_with_autoopts_config=${with_autoopts_config}],
459181834Sroberto        AC_CACHE_CHECK([whether autoopts-config is specified],
460181834Sroberto             [lo_cv_with_autoopts_config],
461181834Sroberto             [if autoopts-config --help 2>/dev/null 1>&2
462181834Sroberto        then lo_cv_with_autoopts_config=autoopts-config
463181834Sroberto        elif libopts-config --help 2>/dev/null 1>&2
464181834Sroberto        then lo_cv_with_autoopts_config=libopts-config
465181834Sroberto        else lo_cv_with_autoopts_config=no ; fi])
466181834Sroberto     ) # end of AC_ARG_WITH
467181834Sroberto
468181834Sroberto     AC_CACHE_VAL([lo_cv_test_autoopts],[
469181834Sroberto        if test -z "${lo_cv_with_autoopts_config}" \
470181834Sroberto                -o X"${lo_cv_with_autoopts_config}" = Xno
471181834Sroberto        then
472181834Sroberto           if autoopts-config --help 2>/dev/null 1>&2
473181834Sroberto           then lo_cv_with_autoopts_config=autoopts-config
474181834Sroberto           elif libopts-config --help 2>/dev/null 1>&2
475181834Sroberto           then lo_cv_with_autoopts_config=libopts-config
476181834Sroberto           else lo_cv_with_autoopts_config=false ; fi
477181834Sroberto        fi
478181834Sroberto        lo_cv_test_autoopts=`
479181834Sroberto            ${lo_cv_with_autoopts_config} --libs` 2> /dev/null
480181834Sroberto        if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
481181834Sroberto        then lo_cv_test_autoopts=no ; fi
482181834Sroberto     ]) # end of CACHE_VAL
483181834Sroberto     AC_MSG_RESULT([${lo_cv_test_autoopts}])
484181834Sroberto
485181834Sroberto     [if test "X${lo_cv_test_autoopts}" != Xno
486181834Sroberto     then
487181834Sroberto        LIBOPTS_LDADD="${lo_cv_test_autoopts}"
488181834Sroberto        LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
489181834Sroberto     else
490181834Sroberto        LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
491181834Sroberto        LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
492181834Sroberto        NEED_LIBOPTS_DIR=true
493181834Sroberto     fi
494181834Sroberto  fi # end of if test -z "${NEED_LIBOPTS_DIR}"]
495181834Sroberto
496181834Sroberto  AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
497181834Sroberto  AC_SUBST(LIBOPTS_LDADD)
498181834Sroberto  AC_SUBST(LIBOPTS_CFLAGS)
499181834Sroberto  AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
500181834Sroberto  AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
501181834Sroberto  m4_popdef([AO_Libopts_Dir])
502181834Sroberto
503181834Sroberto  [if test -n "${NEED_LIBOPTS_DIR}" ; then]
504181834Sroberto    INVOKE_LIBOPTS_MACROS
505181834Sroberto  else
506181834Sroberto    INVOKE_LIBOPTS_MACROS_FIRST
507181834Sroberto  [fi
508181834Sroberto# end of AC_DEFUN of LIBOPTS_CHECK]
509181834Sroberto])
510