/[inetutils]/inetutils/m4/getopt.m4
ViewVC logotype

Diff of /inetutils/m4/getopt.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ams, Fri Jan 21 13:02:48 2005 UTC revision 1.2 by gray, Fri Jul 29 10:52:44 2005 UTC
# Line 1  Line 1 
1  # getopt.m4 serial 6  # getopt.m4 serial 9
2  dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.  dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3  dnl This file is free software, distributed under the terms of the GNU  dnl This file is free software; the Free Software Foundation
4  dnl General Public License.  As a special exception to the GNU General  dnl gives unlimited permission to copy and/or distribute it,
5  dnl Public License, this file may be distributed as part of a program  dnl with or without modifications, as long as this notice is preserved.
 dnl that contains a configuration script generated by Autoconf, under  
 dnl the same distribution terms as the rest of that program.  
6    
7  # The getopt module assume you want GNU getopt, with getopt_long etc,  # The getopt module assume you want GNU getopt, with getopt_long etc,
8  # rather than vanilla POSIX getopt.  This means your your code should  # rather than vanilla POSIX getopt.  This means your your code should
# Line 28  AC_DEFUN([gl_GETOPT], Line 26  AC_DEFUN([gl_GETOPT],
26    if test -z "$GETOPT_H"; then    if test -z "$GETOPT_H"; then
27      GETOPT_H=      GETOPT_H=
28      AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])      AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
29      AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])      if test -z "$GETOPT_H"; then
30          AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
31        fi
32    
33      dnl BSD getopt_long uses an incompatible method to reset option processing,      dnl BSD getopt_long uses an incompatible method to reset option processing,
34      dnl and (as of 2004-10-15) mishandles optional option-arguments.      dnl and (as of 2004-10-15) mishandles optional option-arguments.
35      AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])      if test -z "$GETOPT_H"; then
36          AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
37        fi
38    
39        dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
40        dnl option string (as of 2005-05-05).
41        if test -z "$GETOPT_H"; then
42          AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
43          [AC_RUN_IFELSE(
44            [AC_LANG_PROGRAM([#include <getopt.h>],
45               [[
46                 char *myargv[3];
47                 myargv[0] = "conftest";
48                 myargv[1] = "-+";
49                 myargv[2] = 0;
50                 return getopt (2, myargv, "+a") != '?';
51               ]])],
52            [gl_cv_func_gnu_getopt=yes],
53            [gl_cv_func_gnu_getopt=no],
54            [dnl cross compiling - pessimistically guess based on decls
55             dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
56             dnl option string (as of 2005-05-05).
57             AC_CHECK_DECL([getopt_clip],
58               [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
59               [#include <getopt.h>])])])
60          if test "$gl_cv_func_gnu_getopt" = "no"; then
61            GETOPT_H=getopt.h
62          fi
63        fi
64    
65      if test -n "$GETOPT_H"; then      if test -n "$GETOPT_H"; then
66        gl_GETOPT_SUBSTITUTE        gl_GETOPT_SUBSTITUTE

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26