~ubuntu-branches/ubuntu/gutsy/ntp/gutsy

« back to all changes in this revision

Viewing changes to libopts/m4/libopts.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-18 22:41:56 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070518224156-563ruqxsxvqvoy8h
Tags: 1:4.2.4p0+dfsg-1ubuntu1
* Merge from Debian unstable.
* Remaining Ubuntu changes:
  - Update version in conflicts/replaces to that which was shipped in edgy,
    which was later than that in Debian (due to the ubuntuX).
  - Change default server to ntp.ubuntu.com.
  - Remove stop links from rc0 and rc6
  - Call dh_installinit with --error-handler
  - Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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  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
 
8
dnl
 
9
dnl do always before generated macros:
 
10
dnl
 
11
AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
 
12
[if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then]
 
13
  # =================
 
14
  # AC_HEADER_STDC
 
15
  # =================
 
16
  AC_HEADER_STDC
 
17
  # =================
 
18
  # AC_HEADER_DIRENT
 
19
  # =================
 
20
  AC_HEADER_DIRENT
 
21
  
 
22
  # =================
 
23
  # AC_CHECK_HEADERS
 
24
  # =================
 
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    \
 
28
    utime.h )
 
29
  
 
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])
 
38
  done
 
39
  
 
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])
 
47
  fi
 
48
  
 
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])
 
55
  fi
 
56
  
 
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])
 
63
  fi
 
64
  
 
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,
 
70
     intptr_t, uint_t])
 
71
  
 
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)
 
82
  
 
83
  # ----------------------------------------------------------------------
 
84
  # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
 
85
  # ----------------------------------------------------------------------
 
86
  AC_CHECK_LIB(gen, pathfind)
 
87
  AC_FUNC_VPRINTF
 
88
  AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr])
 
89
[  INVOKE_LIBOPTS_MACROS_FIRST_done=yes
 
90
fi]])
 
91
 
 
92
dnl
 
93
dnl @synopsis  INVOKE_LIBOPTS_MACROS
 
94
dnl
 
95
dnl  This macro will invoke the AutoConf macros specified in libopts.def
 
96
dnl  that have not been disabled with "omit-invocation".
 
97
dnl
 
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
 
105
 
 
106
  if test "X${libopts_cv_with_regex_header}" != Xno
 
107
  then
 
108
    AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
 
109
  else
 
110
    AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
 
111
  fi
 
112
  
 
113
]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
 
114
 
 
115
 
 
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
 
123
 
 
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
 
130
  else
 
131
 
 
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
 
138
 
 
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
 
145
 
 
146
  case "X${libopts_cv_with_libregex_cflags}" in
 
147
  Xyes|Xno|X )
 
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 ;;
 
151
    esac
 
152
  esac
 
153
  case "X${libopts_cv_with_libregex_libs}" in
 
154
  Xyes|Xno|X )
 
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";;
 
158
    esac
 
159
  esac
 
160
  libopts_save_CPPFLAGS="${CPPFLAGS}"
 
161
  libopts_save_LIBS="${LIBS}"
 
162
  fi ## disabled by request
 
163
 
 
164
  case "X${libopts_cv_with_libregex_cflags}" in
 
165
  Xyes|Xno|X )
 
166
    libopts_cv_with_libregex_cflags="" ;;
 
167
  * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
 
168
  esac
 
169
  case "X${libopts_cv_with_libregex_libs}" in
 
170
  Xyes|Xno|X )
 
171
    libopts_cv_with_libregex_libs="" ;;
 
172
  * )
 
173
    LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
 
174
  esac
 
175
  LIBREGEX_CFLAGS=""
 
176
  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
 
183
static regex_t re;
 
184
void comp_re( char const* pzPat ) {
 
185
  int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
 
186
  if (res == 0) return;
 
187
  exit( res ); }
 
188
int main() {
 
189
  regmatch_t m@<:@2@:>@;
 
190
  comp_re( "^.*\@S|@"   );
 
191
  comp_re( "()|no.*" );
 
192
  comp_re( "."       );
 
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 );
 
196
    return 1;
 
197
  }
 
198
  return 0; }],
 
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}])
 
203
 
 
204
  if test "X${libopts_cv_with_libregex}" != Xno
 
205
  then
 
206
    AC_DEFINE([WITH_LIBREGEX],[1],
 
207
        [Define this if a working libregex can be found])
 
208
  else
 
209
    CPPFLAGS="${libopts_save_CPPFLAGS}"
 
210
    LIBS="${libopts_save_LIBS}"
 
211
  fi
 
212
  
 
213
]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
 
214
 
 
215
 
 
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;
 
224
}],
 
225
    [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
 
226
  ) # end of TRY_RUN
 
227
  ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
 
228
  AC_MSG_RESULT([${libopts_cv_run_pathfind}])
 
229
 
 
230
  if test "X${libopts_cv_run_pathfind}" != Xno
 
231
  then
 
232
    AC_DEFINE([HAVE_PATHFIND],[1],
 
233
        [Define this if pathfind(3) works])
 
234
  fi
 
235
  
 
236
]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
 
237
 
 
238
 
 
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
 
245
echo ${dzero}`
 
246
    if test $? -ne 0
 
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
 
250
    fi
 
251
  ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
 
252
  AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
 
253
 
 
254
  if test "X${libopts_cv_test_dev_zero}" != Xno
 
255
  then
 
256
    AC_DEFINE([HAVE_DEV_ZERO],[1],
 
257
        [Define this if /dev/zero is readable device])
 
258
  fi
 
259
  
 
260
]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
 
261
 
 
262
 
 
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) {
 
269
@%:@ifndef PATH_MAX
 
270
choke me!!
 
271
@%:@else
 
272
   char zPath@<:@PATH_MAX+1@:>@;
 
273
@%:@endif
 
274
   char *pz = realpath(argv@<:@0@:>@, zPath);
 
275
   return (pz == zPath) ? 0 : 1;
 
276
}],
 
277
    [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
 
278
  ) # end of TRY_RUN
 
279
  ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
 
280
  AC_MSG_RESULT([${libopts_cv_run_realpath}])
 
281
 
 
282
  if test "X${libopts_cv_run_realpath}" != Xno
 
283
  then
 
284
    AC_DEFINE([HAVE_REALPATH],[1],
 
285
        [Define this if we have a functional realpath(3C)])
 
286
  fi
 
287
  
 
288
]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
 
289
 
 
290
 
 
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 @:>@;
 
297
int main() {
 
298
  static char const z@<:@@:>@ = "Thursday Aug 28 240";
 
299
  struct tm tm;
 
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]
 
312
  ) # end of TRY_RUN
 
313
  ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
 
314
  AC_MSG_RESULT([${libopts_cv_run_strftime}])
 
315
 
 
316
  if test "X${libopts_cv_run_strftime}" != Xno
 
317
  then
 
318
    AC_DEFINE([HAVE_STRFTIME],[1],
 
319
        [Define this if strftime() works])
 
320
  fi
 
321
  
 
322
]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
 
323
 
 
324
 
 
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]
 
333
  ) # end of TRY_RUN
 
334
  ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
 
335
  AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
 
336
 
 
337
  if test "X${libopts_cv_run_fopen_binary}" != Xno
 
338
  then
 
339
    AC_DEFINE([FOPEN_BINARY_FLAG],"b",
 
340
        [fopen(3) accepts a 'b' in the mode flag])
 
341
  else
 
342
    AC_DEFINE([FOPEN_BINARY_FLAG],"",
 
343
        [fopen(3) accepts a 'b' in the mode flag])
 
344
  fi
 
345
  
 
346
]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
 
347
 
 
348
 
 
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]
 
357
  ) # end of TRY_RUN
 
358
  ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
 
359
  AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
 
360
 
 
361
  if test "X${libopts_cv_run_fopen_text}" != Xno
 
362
  then
 
363
    AC_DEFINE([FOPEN_TEXT_FLAG],"t",
 
364
        [fopen(3) accepts a 't' in the mode flag])
 
365
  else
 
366
    AC_DEFINE([FOPEN_TEXT_FLAG],"",
 
367
        [fopen(3) accepts a 't' in the mode flag])
 
368
  fi
 
369
  
 
370
]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
 
371
 
 
372
 
 
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
 
377
 
 
378
  # Check to see if a working libregex can be found.
 
379
  LIBOPTS_WITHLIB_REGEX
 
380
 
 
381
  # Check to see if pathfind(3) works.
 
382
  LIBOPTS_RUN_PATHFIND
 
383
 
 
384
  # Check to see if /dev/zero is readable device.
 
385
  LIBOPTS_TEST_DEV_ZERO
 
386
 
 
387
  # Check to see if we have a functional realpath(3C).
 
388
  LIBOPTS_RUN_REALPATH
 
389
 
 
390
  # Check to see if strftime() works.
 
391
  LIBOPTS_RUN_STRFTIME
 
392
 
 
393
  # Check to see if fopen accepts "b" mode.
 
394
  LIBOPTS_RUN_FOPEN_BINARY
 
395
 
 
396
  # Check to see if fopen accepts "t" mode.
 
397
  LIBOPTS_RUN_FOPEN_TEXT
 
398
 
 
399
]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
 
400
 
 
401
dnl @synopsis  LIBOPTS_CHECK
 
402
dnl
 
403
dnl Time-stamp:        "2006-09-23 19:36:24 bkorb"
 
404
dnl Last Committed:    $Date: 2006/09/24 02:59:00 $
 
405
dnl
 
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.
 
410
dnl
 
411
dnl Default to system libopts
 
412
dnl
 
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
 
426
    fi])
 
427
 
 
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])
 
432
 
 
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
 
447
 
 
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
 
451
        then
 
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
 
457
        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}])
 
464
 
 
465
     [if test "X${lo_cv_test_autoopts}" != Xno
 
466
     then
 
467
        LIBOPTS_LDADD="${lo_cv_test_autoopts}"
 
468
        LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
 
469
     else
 
470
        LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
 
471
        LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
 
472
        NEED_LIBOPTS_DIR=true
 
473
     fi
 
474
  fi # end of if test -z "${NEED_LIBOPTS_DIR}"]
 
475
 
 
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])
 
482
 
 
483
  [if test -n "${NEED_LIBOPTS_DIR}" ; then]
 
484
    INVOKE_LIBOPTS_MACROS
 
485
  else
 
486
    INVOKE_LIBOPTS_MACROS_FIRST
 
487
  [fi
 
488
# end of AC_DEFUN of LIBOPTS_CHECK]
 
489
])