~ubuntu-branches/debian/stretch/ndisc6/stretch

« back to all changes in this revision

Viewing changes to m4/getopt.m4

  • Committer: Bazaar Package Importer
  • Author(s): Rémi Denis-Courmont
  • Date: 2006-10-08 20:21:18 UTC
  • Revision ID: james.westby@ubuntu.com-20061008202118-zil2ffq4mjo3xcbk
Tags: upstream-0.7.3
Import upstream version 0.7.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# getopt.m4
 
2
dnl Copyright (C) 2003-2004 Remi Denis-Courmont
 
3
dnl From Remi Denis-Courmont
 
4
 
 
5
AC_DEFUN([RDC_FUNC_GETOPT_LONG],
 
6
[AC_CHECK_HEADERS(getopt.h)
 
7
AH_TEMPLATE([HAVE_GETOPT_LONG], [Define to 1 if you have the `getopt_long' function.])
 
8
AC_SEARCH_LIBS(getopt_long, [gnugetopt], have_getopt_long=yes,
 
9
have_getopt_long=no)
 
10
if test $have_getopt_long = yes; then
 
11
  AC_DEFINE(HAVE_GETOPT_LONG)
 
12
  $1
 
13
else
 
14
  $2
 
15
  false
 
16
fi
 
17
])
 
18
 
 
19
AC_DEFUN([RDC_REPLACE_FUNC_GETOPT_LONG],
 
20
[AH_BOTTOM([/* Fallback replacement for GNU `getopt_long' */
 
21
#ifndef HAVE_GETOPT_LONG
 
22
# define getopt_long( argc, argv, optstring, longopts, longindex ) \
 
23
        getopt (argc, argv, optstring)
 
24
# if !GETOPT_STRUCT_OPTION && !HAVE_GETOPT_H
 
25
 struct option { const char *name; int has_arg; int *flag; int val; };
 
26
#  define GETOPT_STRUCT_OPTION 1
 
27
# endif
 
28
# ifndef required_argument
 
29
#  define no_argument 0
 
30
#  define required_argument 1
 
31
#  define optional_argument 2
 
32
# endif
 
33
#endif])
 
34
RDC_FUNC_GETOPT_LONG
 
35
])
 
36