1dnl ######################################################################
2dnl find if "extern char *optarg" exists in headers
3AC_DEFUN([AMU_EXTERN_OPTARG],
4[
5AC_CACHE_CHECK(if external definition for optarg[] exists,
6ac_cv_extern_optarg,
7[
8# try to compile program that uses the variable
9AC_TRY_COMPILE(
10[
11#ifdef HAVE_STDIO_H
12# include <stdio.h>
13#endif /* HAVE_STDIO_H */
14#ifdef HAVE_UNISTD_H
15# include <unistd.h>
16#endif /* HAVE_UNISTD_H */
17#ifdef HAVE_STDLIB_H
18# include <stdlib.h>
19#endif /* HAVE_STDLIB_H */
20#ifdef HAVE_SYS_ERRNO_H
21# include <sys/errno.h>
22#endif /* HAVE_SYS_ERRNO_H */
23#ifdef HAVE_ERRNO_H
24# include <errno.h>
25#endif /* HAVE_ERRNO_H */
26],
27[
28char *cp = optarg;
29], ac_cv_extern_optarg=yes, ac_cv_extern_optarg=no)
30])
31if test "$ac_cv_extern_optarg" = yes
32then
33  AC_DEFINE(HAVE_EXTERN_OPTARG)
34fi
35])
36dnl ======================================================================
37