File: getopt.m4

package info (click to toggle)
ndisc6 0.7.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 664 kB
  • ctags: 179
  • sloc: ansic: 2,407; sh: 865; makefile: 115; perl: 37
file content (36 lines) | stat: -rw-r--r-- 958 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# getopt.m4
dnl Copyright (C) 2003-2004 Remi Denis-Courmont
dnl From Remi Denis-Courmont

AC_DEFUN([RDC_FUNC_GETOPT_LONG],
[AC_CHECK_HEADERS(getopt.h)
AH_TEMPLATE([HAVE_GETOPT_LONG], [Define to 1 if you have the `getopt_long' function.])
AC_SEARCH_LIBS(getopt_long, [gnugetopt], have_getopt_long=yes,
have_getopt_long=no)
if test $have_getopt_long = yes; then
  AC_DEFINE(HAVE_GETOPT_LONG)
  $1
else
  $2
  false
fi
])

AC_DEFUN([RDC_REPLACE_FUNC_GETOPT_LONG],
[AH_BOTTOM([/* Fallback replacement for GNU `getopt_long' */
#ifndef HAVE_GETOPT_LONG
# define getopt_long( argc, argv, optstring, longopts, longindex ) \
	getopt (argc, argv, optstring)
# if !GETOPT_STRUCT_OPTION && !HAVE_GETOPT_H
 struct option { const char *name; int has_arg; int *flag; int val; };
#  define GETOPT_STRUCT_OPTION 1
# endif
# ifndef required_argument
#  define no_argument 0
#  define required_argument 1
#  define optional_argument 2
# endif
#endif])
RDC_FUNC_GETOPT_LONG
])