2
dnl Copyright (C) 2003-2004 Remi Denis-Courmont
3
dnl From Remi Denis-Courmont
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,
10
if test $have_getopt_long = yes; then
11
AC_DEFINE(HAVE_GETOPT_LONG)
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
28
# ifndef required_argument
29
# define no_argument 0
30
# define required_argument 1
31
# define optional_argument 2