Import argp-standalone 1.1.

This commit is contained in:
Érico Rolim 2021-02-10 16:17:50 -03:00
parent 8333609d29
commit 3d5f6735d4
8 changed files with 265 additions and 156 deletions

View file

@ -389,4 +389,87 @@ __argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
#endif
/* Duplicate the inline definitions in argp-fmtstream.h, for compilers
* that don't do inlining. */
size_t
__argp_fmtstream_write (argp_fmtstream_t __fs,
__const char *__str, size_t __len)
{
if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
{
memcpy (__fs->p, __str, __len);
__fs->p += __len;
return __len;
}
else
return 0;
}
int
__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
{
size_t __len = strlen (__str);
if (__len)
{
size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
return __wrote == __len ? 0 : -1;
}
else
return 0;
}
int
__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
{
if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
return *__fs->p++ = __ch;
else
return EOF;
}
/* Set __FS's left margin to __LMARGIN and return the old value. */
size_t
__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
{
size_t __old;
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
__old = __fs->lmargin;
__fs->lmargin = __lmargin;
return __old;
}
/* Set __FS's right margin to __RMARGIN and return the old value. */
size_t
__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
{
size_t __old;
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
__old = __fs->rmargin;
__fs->rmargin = __rmargin;
return __old;
}
/* Set FS's wrap margin to __WMARGIN and return the old value. */
size_t
__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
{
size_t __old;
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
__old = __fs->wmargin;
__fs->wmargin = __wmargin;
return __old;
}
/* Return the column number of the current output point in __FS. */
size_t
__argp_fmtstream_point (argp_fmtstream_t __fs)
{
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
return __fs->point_col >= 0 ? __fs->point_col : 0;
}
#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */

View file

@ -99,6 +99,17 @@ typedef FILE *argp_fmtstream_t;
#ifndef __const
#define __const const
#endif
/* FIXME: We could use a configure test to check for __attribute__,
* just like lsh does. */
#ifndef PRINTF_STYLE
# if __GNUC__ >= 2
# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a)))
# else
# define PRINTF_STYLE(f, a)
# endif
#endif
struct argp_fmtstream
{
@ -140,10 +151,10 @@ extern void argp_fmtstream_free (argp_fmtstream_t __fs);
extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
__const char *__fmt, ...)
__attribute__ ((__format__ (printf, 2, 3)));
PRINTF_STYLE(2,3);
extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
__const char *__fmt, ...)
__attribute__ ((__format__ (printf, 2, 3)));
PRINTF_STYLE(2,3);
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);

View file

@ -72,6 +72,8 @@ char *alloca ();
#include "argp-namefrob.h"
/* FIXME: We could use a configure test to check for __attribute__,
* just like lsh does. */
#ifndef UNUSED
# if __GNUC__ >= 2
# define UNUSED __attribute__ ((__unused__))
@ -201,11 +203,10 @@ static const struct uparam_name uparam_names[] =
static void
fill_in_uparams (const struct argp_state *state)
{
/* FIXME: Can we define var as a pointer to _unsigned_ char,
* or will that clash with the getenv() prototype? */
const char *var = getenv ("ARGP_HELP_FMT");
/* FIXME: Can we get away without an explicit cast? */
const unsigned char *var = (unsigned char *) getenv ("ARGP_HELP_FMT");
#define SKIPWS(p) do { while (isspace ( (unsigned) *p)) p++; } while (0);
#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
if (var)
/* Parse var. */
@ -213,14 +214,14 @@ fill_in_uparams (const struct argp_state *state)
{
SKIPWS (var);
if (isalpha ( (unsigned) *var))
if (isalpha (*var))
{
size_t var_len;
const struct uparam_name *un;
int unspec = 0, val = 0;
const char *arg = var;
const unsigned char *arg = var;
while (isalnum ( (unsigned) *arg) || *arg == '-' || *arg == '_')
while (isalnum (*arg) || *arg == '-' || *arg == '_')
arg++;
var_len = arg - var;
@ -245,10 +246,10 @@ fill_in_uparams (const struct argp_state *state)
else
val = 1;
}
else if (isdigit ( (unsigned) *arg))
else if (isdigit (*arg))
{
val = atoi (arg);
while (isdigit ( (unsigned) *arg))
while (isdigit (*arg))
arg++;
SKIPWS (arg);
}
@ -737,17 +738,19 @@ hol_cluster_is_child (const struct hol_cluster *cl1,
/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail
that should be used for comparisons, and returns true iff it should be
treated as a non-option. */
/* FIXME: Can we use unsigned char * for the argument? */
static int
canon_doc_option (const char **name)
{
int non_opt;
/* Skip initial whitespace. */
while (isspace ( (unsigned) **name))
while (isspace ( (unsigned char) **name))
(*name)++;
/* Decide whether this looks like an option (leading `-') or not. */
non_opt = (**name != '-');
/* Skip until part of name used for sorting. */
while (**name && !isalnum ( (unsigned) **name))
while (**name && !isalnum ( (unsigned char) **name))
(*name)++;
return non_opt;
}
@ -787,6 +790,7 @@ hol_entry_cmp (const struct hol_entry *entry1,
int short2 = hol_entry_first_short (entry2);
int doc1 = odoc (entry1->opt);
int doc2 = odoc (entry2->opt);
/* FIXME: Can we use unsigned char * instead? */
const char *long1 = hol_entry_first_long (entry1);
const char *long2 = hol_entry_first_long (entry2);
@ -809,15 +813,18 @@ hol_entry_cmp (const struct hol_entry *entry1,
first, but as they're not displayed, it doesn't matter where
they are. */
{
char first1 = short1 ? short1 : long1 ? *long1 : 0;
char first2 = short2 ? short2 : long2 ? *long2 : 0;
unsigned char first1 = short1 ? short1 : long1 ? *long1 : 0;
unsigned char first2 = short2 ? short2 : long2 ? *long2 : 0;
#ifdef _tolower
int lower_cmp = _tolower ( (unsigned) first1) - _tolower ( (unsigned) first2);
int lower_cmp = _tolower (first1) - _tolower (first2);
#else
int lower_cmp = tolower ( (unsigned) first1) - tolower ( (unsigned) first2);
int lower_cmp = tolower (first1) - tolower (first2);
#endif
/* Compare ignoring case, except when the options are both the
same letter, in which case lower-case always comes first. */
/* NOTE: The subtraction below does the right thing
even with eight-bit chars: first1 and first2 are
converted to int *before* the subtraction. */
return lower_cmp ? lower_cmp : first2 - first1;
}
}
@ -1107,7 +1114,17 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
int old_wm = __argp_fmtstream_wmargin (stream);
/* PEST is a state block holding some of our variables that we'd like to
share with helper functions. */
#ifdef __GNUC__
struct pentry_state pest = { entry, stream, hhstate, 1, state };
#else /* !__GNUC__ */
/* Decent initializers are a GNU extension */
struct pentry_state pest;
pest.entry = entry;
pest.stream = stream;
pest.hhstate = hhstate;
pest.first = 1;
pest.state = state;
#endif /* !__GNUC__ */
if (! odoc (real))
for (opt = real, num = entry->num; num > 0; opt++, num--)
@ -1720,8 +1737,8 @@ char *__argp_basename(char *name)
return short_name ? short_name + 1 : name;
}
static const char *
short_program_name(const struct argp_state *state)
char *
__argp_short_program_name(const struct argp_state *state)
{
if (state)
return state->name;
@ -1729,12 +1746,15 @@ short_program_name(const struct argp_state *state)
return program_invocation_short_name;
#elif HAVE_PROGRAM_INVOCATION_NAME
return __argp_basename(program_invocation_name);
#else
#else /* !HAVE_PROGRAM_INVOCATION_NAME */
/* FIXME: What now? Miles suggests that it is better to use NULL,
but currently the value is passed on directly to fputs_unlocked,
so that requires more changes. */
# if __GNUC__
# warning No reasonable value to return
return "";
#endif
# endif /* __GNUC__ */
#endif /* !HAVE_PROGRAM_INVOCATION_NAME */
}
/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
@ -1748,7 +1768,7 @@ __argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags)
flags |= ARGP_HELP_LONG_ONLY;
_help (state ? state->root_argp : 0, state, stream, flags,
short_program_name(state));
__argp_short_program_name(state));
if (!state || ! (state->flags & ARGP_NO_EXIT))
{
@ -1779,7 +1799,7 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
__flockfile (stream);
fputs_unlocked (short_program_name(state),
fputs_unlocked (__argp_short_program_name(state),
stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
@ -1820,7 +1840,7 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
{
__flockfile (stream);
fputs_unlocked (short_program_name(state),
fputs_unlocked (__argp_short_program_name(state),
stream);
if (fmt)

View file

@ -44,8 +44,10 @@
#define __argp_state_help argp_state_help
#undef __argp_usage
#define __argp_usage argp_usage
#undef __arg_basename
#undef __argp_basename
#define __argp_basename _argp_basename
#undef __argp_short_program_name
#define __argp_short_program_name _argp_short_program_name
/* argp-fmtstream functions */
#undef __argp_make_fmtstream

View file

@ -138,6 +138,8 @@ argp_default_parser (int key, char *arg, struct argp_state *state)
case OPT_HANG:
_argp_hang = atoi (arg ? arg : "3600");
fprintf(state->err_stream, "%s: pid = %ld\n",
state->name, (long) getpid());
while (_argp_hang-- > 0)
__sleep (1);
break;
@ -196,12 +198,6 @@ struct group
/* Which argp this group is from. */
const struct argp *argp;
#if 0
/* Points to the point in SHORT_OPTS corresponding to the end of the short
options for this group. We use it to determine from which group a
particular short options is from. */
char *short_end;
#endif
/* The number of non-option args sucessfully handled by this parser. */
unsigned args_processed;
@ -644,18 +640,7 @@ parser_init (struct parser *parser, const struct argp *argp,
parser->state.next = 1;
}
else
{
#if HAVE_PROGRAM_INVOCATION_SHORT_NAME
parser->state.name = program_invocation_short_name;
#elif HAVE_PROGRAM_INVOCATION_NAME
parser->state.name = __argp_basename(program_invocation_name);
#else
/* FIXME: What now? Miles suggests that it is better to use NULL,
but currently the value is passed on directly to
fputs_unlocked(), so that requires more changes. */
parser->state.name = "";
#endif
}
parser->state.name = __argp_short_program_name(NULL);
return 0;
}
@ -942,8 +927,9 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
{
if (parser->state.quoted && parser->state.next < parser->state.quoted)
/* The next argument pointer has been moved to before the quoted
region, so pretend we never saw the quoting `--', and start looking for options again. If the `--' is still there
we'lljust process it one more time. */
region, so pretend we never saw the quoting `--', and start
looking for options again. If the `--' is still there we'll just
process it one more time. */
parser->state.quoted = parser->args_only = 0;
/* Give FIRST_NONOPT & LAST_NONOPT rational values if NEXT has been
@ -1028,30 +1014,6 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
parser->state.argv[parser->state.next]);
}
#if 0
/* FIXME: This doesn't seem right. It would be cleaner not to exhange any
* arguments until we get a new non-option argument in the input. */
if (parser->ordering == PERMUTE)
{
if ( (parser->first_nonopt != parser->last_nonopt)
&& (parser->last_nonopt != parser->state.next) )
exchange(parser);
else if (parser->last_nonopt != parser->state.next)
parser->first_nonopt = parser->state.next;
/* Skip any additional non-options
and extend the range of non-options previously skipped. */
while ( (parser->state.next < parser->state.argc)
&& (classify_arg(parser,
parser->state.argv[parser->state.next],
NULL) == ARG_ARG))
parser->state.next++;
parser->last_nonopt = parser->state.next;
}
#endif
if (parser->state.next >= parser->state.argc)
/* Almost done. If there are non-options that we skipped
previously, we should process them now. */

25
argp.h
View file

@ -39,6 +39,17 @@
typedef int error_t;
# define __error_t_defined
#endif
/* FIXME: We could use a configure test to check for __attribute__,
* just like lsh does. */
#ifndef PRINTF_STYLE
# if __GNUC__ >= 2
# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a)))
# else
# define PRINTF_STYLE(f, a)
# endif
#endif
#ifdef __cplusplus
extern "C" {
@ -478,10 +489,10 @@ extern void __argp_usage (__const struct argp_state *__state) __THROW;
message, then exit (1). */
extern void argp_error (__const struct argp_state *__restrict __state,
__const char *__restrict __fmt, ...) __THROW
__attribute__ ((__format__ (__printf__, 2, 3)));
PRINTF_STYLE(2,3);
extern void __argp_error (__const struct argp_state *__restrict __state,
__const char *__restrict __fmt, ...) __THROW
__attribute__ ((__format__ (__printf__, 2, 3)));
PRINTF_STYLE(2,3);
/* Similar to the standard gnu error-reporting function error(), but will
respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
@ -494,11 +505,11 @@ extern void __argp_error (__const struct argp_state *__restrict __state,
extern void argp_failure (__const struct argp_state *__restrict __state,
int __status, int __errnum,
__const char *__restrict __fmt, ...) __THROW
__attribute__ ((__format__ (__printf__, 4, 5)));
PRINTF_STYLE(4,5);
extern void __argp_failure (__const struct argp_state *__restrict __state,
int __status, int __errnum,
__const char *__restrict __fmt, ...) __THROW
__attribute__ ((__format__ (__printf__, 4, 5)));
PRINTF_STYLE(4,5);
/* Returns true if the option OPT is a valid short option. */
extern int _option_is_short (__const struct argp_option *__opt) __THROW;
@ -522,6 +533,12 @@ extern void *__argp_input (__const struct argp *__restrict __argp,
extern char *_argp_basename(char *name) __THROW;
extern char *__argp_basename(char *name) __THROW;
/* Getting the program name given an argp state */
extern char *
_argp_short_program_name(const struct argp_state *state) __THROW;
extern char *
__argp_short_program_name(const struct argp_state *state) __THROW;
#ifdef __USE_EXTERN_INLINES

171
configure vendored
View file

@ -692,7 +692,7 @@ fi
PACKAGE=argp
VERSION=standalone-1.0
VERSION=standalone-1.1
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@ -779,10 +779,17 @@ fi
# GNU libc defaults to supplying the ISO C library functions only. The
# _GNU_SOURCE define enables these extensions, in particular we want
# errno.h to declare program_invocation_name. Enable it on all
# systems; no problems have been reported with it so far.
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:786: checking for $ac_word" >&5
echo "configure:793: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -812,7 +819,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:816: checking for $ac_word" >&5
echo "configure:823: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -863,7 +870,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:867: checking for $ac_word" >&5
echo "configure:874: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -895,7 +902,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:899: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:906: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -906,12 +913,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 910 "configure"
#line 917 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -937,12 +944,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:941: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:948: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:946: checking whether we are using GNU C" >&5
echo "configure:953: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -951,7 +958,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -970,7 +977,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:974: checking whether ${CC-cc} accepts -g" >&5
echo "configure:981: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1002,7 +1009,7 @@ else
fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:1006: checking whether ${MAKE-make} sets \${MAKE}" >&5
echo "configure:1013: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1031,7 +1038,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1035: checking for $ac_word" >&5
echo "configure:1042: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1062,7 +1069,7 @@ fi
echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
echo "configure:1066: checking for ${CC-cc} option to accept ANSI C" >&5
echo "configure:1073: checking for ${CC-cc} option to accept ANSI C" >&5
if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1078,7 +1085,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__
do
CC="$ac_save_CC $ac_arg"
cat > conftest.$ac_ext <<EOF
#line 1082 "configure"
#line 1089 "configure"
#include "confdefs.h"
#include <stdarg.h>
#include <stdio.h>
@ -1115,7 +1122,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
; return 0; }
EOF
if { (eval echo configure:1119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_prog_cc_stdc="$ac_arg"; break
else
@ -1145,7 +1152,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1149: checking how to run the C preprocessor" >&5
echo "configure:1156: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1160,13 +1167,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1164 "configure"
#line 1171 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1170: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1177,13 +1184,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1181 "configure"
#line 1188 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1194,13 +1201,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1198 "configure"
#line 1205 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1225,12 +1232,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:1229: checking for ANSI C header files" >&5
echo "configure:1236: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1234 "configure"
#line 1241 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1238,7 +1245,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1249: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1255,7 +1262,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1259 "configure"
#line 1266 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1273,7 +1280,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1277 "configure"
#line 1284 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1294,7 +1301,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1298 "configure"
#line 1305 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1305,7 +1312,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1332,17 +1339,17 @@ for ac_hdr in limits.h malloc.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1336: checking for $ac_hdr" >&5
echo "configure:1343: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1341 "configure"
#line 1348 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1346: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1370,12 +1377,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:1374: checking for working const" >&5
echo "configure:1381: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1379 "configure"
#line 1386 "configure"
#include "confdefs.h"
int main() {
@ -1424,7 +1431,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:1428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -1445,21 +1452,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
echo "configure:1449: checking for inline" >&5
echo "configure:1456: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
#line 1456 "configure"
#line 1463 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
if { (eval echo configure:1463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@ -1485,12 +1492,12 @@ EOF
esac
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:1489: checking for size_t" >&5
echo "configure:1496: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1494 "configure"
#line 1501 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1521,19 +1528,19 @@ fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
echo "configure:1525: checking for working alloca.h" >&5
echo "configure:1532: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1530 "configure"
#line 1537 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
if { (eval echo configure:1537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@ -1554,12 +1561,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
echo "configure:1558: checking for alloca" >&5
echo "configure:1565: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1563 "configure"
#line 1570 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@ -1587,7 +1594,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
if { (eval echo configure:1591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@ -1619,12 +1626,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
echo "configure:1623: checking whether alloca needs Cray hooks" >&5
echo "configure:1630: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1628 "configure"
#line 1635 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@ -1649,12 +1656,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1653: checking for $ac_func" >&5
echo "configure:1660: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1658 "configure"
#line 1665 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1677,7 +1684,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1704,7 +1711,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
echo "configure:1708: checking stack direction for C alloca" >&5
echo "configure:1715: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1712,7 +1719,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
#line 1716 "configure"
#line 1723 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@ -1731,7 +1738,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@ -1753,12 +1760,12 @@ EOF
fi
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
echo "configure:1757: checking for vprintf" >&5
echo "configure:1764: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1762 "configure"
#line 1769 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
@ -1781,7 +1788,7 @@ vprintf();
; return 0; }
EOF
if { (eval echo configure:1785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
@ -1805,12 +1812,12 @@ fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
echo "configure:1809: checking for _doprnt" >&5
echo "configure:1816: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1814 "configure"
#line 1821 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
@ -1833,7 +1840,7 @@ _doprnt();
; return 0; }
EOF
if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
@ -1860,12 +1867,12 @@ fi
for ac_func in strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1864: checking for $ac_func" >&5
echo "configure:1871: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1869 "configure"
#line 1876 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1888,7 +1895,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1916,12 +1923,12 @@ done
for ac_func in mempcpy strndup strchrnul
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1920: checking for $ac_func" >&5
echo "configure:1927: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1925 "configure"
#line 1932 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1944,7 +1951,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1973,12 +1980,12 @@ done
for ac_func in flockfile putc_unlocked
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1977: checking for $ac_func" >&5
echo "configure:1984: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1982 "configure"
#line 1989 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2001,7 +2008,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -2028,12 +2035,12 @@ done
for ac_func in fputs_unlocked fwrite_unlocked
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2032: checking for $ac_func" >&5
echo "configure:2039: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2037 "configure"
#line 2044 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2056,7 +2063,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -2084,12 +2091,12 @@ done
for ac_func in strdup asprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2088: checking for $ac_func" >&5
echo "configure:2095: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2093 "configure"
#line 2100 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2112,7 +2119,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -2138,19 +2145,19 @@ done
echo $ac_n "checking for program_invocation_name""... $ac_c" 1>&6
echo "configure:2142: checking for program_invocation_name" >&5
echo "configure:2149: checking for program_invocation_name" >&5
if eval "test \"`echo '$''{'lsh_cv_var_program_invocation_name'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2147 "configure"
#line 2154 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
void *p = (void *) &program_invocation_name;
; return 0; }
EOF
if { (eval echo configure:2154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lsh_cv_var_program_invocation_name=yes
else
@ -2171,19 +2178,19 @@ EOF
fi
echo $ac_n "checking for program_invocation_short_name""... $ac_c" 1>&6
echo "configure:2175: checking for program_invocation_short_name" >&5
echo "configure:2182: checking for program_invocation_short_name" >&5
if eval "test \"`echo '$''{'lsh_cv_var_program_invocation_short_name'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2180 "configure"
#line 2187 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
void *p = (void *) &program_invocation_short_name;
; return 0; }
EOF
if { (eval echo configure:2187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lsh_cv_var_program_invocation_short_name=yes
else

View file

@ -4,10 +4,17 @@ dnl This configure.in is only for building a standalone argp library.
AC_INIT(argp-ba.c)
AM_INIT_AUTOMAKE(argp, standalone-1.0)
AM_INIT_AUTOMAKE(argp, standalone-1.1)
AM_CONFIG_HEADER(config.h)
# GNU libc defaults to supplying the ISO C library functions only. The
# _GNU_SOURCE define enables these extensions, in particular we want
# errno.h to declare program_invocation_name. Enable it on all
# systems; no problems have been reported with it so far.
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET